summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew W Elble <aweits@rit.edu>2021-03-07 21:23:49 -0500
committerGitHub <noreply@github.com>2021-03-08 02:23:49 +0000
commita0b5dcca3c0e5f4a99b5253f39dc7f72ef4782ae (patch)
treef612d823bcb342400ea7b2ec9174a2b9f81b7276
parent8d3272f82dba4959ac3da068720d9befbf3ca044 (diff)
downloadspack-a0b5dcca3c0e5f4a99b5253f39dc7f72ef4782ae.tar.gz
spack-a0b5dcca3c0e5f4a99b5253f39dc7f72ef4782ae.tar.bz2
spack-a0b5dcca3c0e5f4a99b5253f39dc7f72ef4782ae.tar.xz
spack-a0b5dcca3c0e5f4a99b5253f39dc7f72ef4782ae.zip
py-tensorflow-probability: new package (#22165)
* py-tensorflow-probability: new package * setuptools dep, quoting syntax
-rw-r--r--var/spack/repos/builtin/packages/py-cloudpickle/package.py1
-rw-r--r--var/spack/repos/builtin/packages/py-dm-tree/package.py59
-rw-r--r--var/spack/repos/builtin/packages/py-tensorflow-probability/package.py81
3 files changed, 141 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/py-cloudpickle/package.py b/var/spack/repos/builtin/packages/py-cloudpickle/package.py
index 453535a8ea..2f5ff6422c 100644
--- a/var/spack/repos/builtin/packages/py-cloudpickle/package.py
+++ b/var/spack/repos/builtin/packages/py-cloudpickle/package.py
@@ -14,6 +14,7 @@ class PyCloudpickle(PythonPackage):
version('1.6.0', sha256='9bc994f9e9447593bd0a45371f0e7ac7333710fcf64a4eb9834bf149f4ef2f32')
version('1.2.1', sha256='603244e0f552b72a267d47a7d9b347b27a3430f58a0536037a290e7e0e212ecf')
+ version('1.1.1', sha256='7d43c4d0c7e9735ee8a352c96f84031dabd6676170c4e5e0585a469cc4769f22')
version('0.5.2', sha256='b0e63dd89ed5285171a570186751bc9b84493675e99e12789e9a5dc5490ef554')
depends_on('python@3.5:', type=('build', 'run'), when='@1.6.0:')
diff --git a/var/spack/repos/builtin/packages/py-dm-tree/package.py b/var/spack/repos/builtin/packages/py-dm-tree/package.py
new file mode 100644
index 0000000000..db112aaa5b
--- /dev/null
+++ b/var/spack/repos/builtin/packages/py-dm-tree/package.py
@@ -0,0 +1,59 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+import tempfile
+
+
+class PyDmTree(PythonPackage):
+ """tree is a library for working with nested data structures. In a
+ way, tree generalizes the builtin map() function which only
+ supports flat sequences, and allows to apply a function to each
+ leaf preserving the overall structure."""
+
+ homepage = "https://github.com/deepmind/tree"
+ pypi = "dm-tree/dm-tree-0.1.5.tar.gz"
+
+ maintainers = ['aweits']
+
+ version('0.1.5', sha256='a951d2239111dfcc468071bc8ff792c7b1e3192cab5a3c94d33a8b2bda3127fa')
+
+ depends_on('py-setuptools', type='build')
+ depends_on('bazel', type='build')
+ depends_on('py-six@1.12.0:', type=('build', 'run'))
+
+ @run_after('install')
+ def clean(self):
+ remove_linked_tree(self.tmp_path)
+
+ def patch(self):
+ self.tmp_path = tempfile.mkdtemp(dir='/tmp', prefix='spack')
+ env['TEST_TMPDIR'] = self.tmp_path
+ env['HOME'] = self.tmp_path
+ args = [
+ # Don't allow user or system .bazelrc to override build settings
+ "'--nohome_rc',\n",
+ "'--nosystem_rc',\n",
+ # Bazel does not work properly on NFS, switch to /tmp
+ "'--output_user_root={0}',\n".format(self.tmp_path),
+ "'build',\n",
+ # Spack logs don't handle colored output well
+ "'--color=no',\n",
+ "'--jobs={0}',\n".format(make_jobs),
+ # Enable verbose output for failures
+ "'--verbose_failures',\n",
+ # Show (formatted) subcommands being executed
+ "'--subcommands=pretty_print',\n",
+ "'--spawn_strategy=local',\n",
+ # Ask bazel to explain what it's up to
+ # Needs a filename as argument
+ "'--explain=explainlogfile.txt',\n",
+ # Increase verbosity of explanation,
+ "'--verbose_explanations',\n",
+ # bazel uses system PYTHONPATH instead of spack paths
+ "'--action_env', 'PYTHONPATH={0}',\n".format(env['PYTHONPATH']),
+ ]
+ filter_file("'build',",
+ ' '.join(args),
+ 'setup.py')
diff --git a/var/spack/repos/builtin/packages/py-tensorflow-probability/package.py b/var/spack/repos/builtin/packages/py-tensorflow-probability/package.py
new file mode 100644
index 0000000000..fa856746b8
--- /dev/null
+++ b/var/spack/repos/builtin/packages/py-tensorflow-probability/package.py
@@ -0,0 +1,81 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+import tempfile
+
+
+class PyTensorflowProbability(Package):
+ """TensorFlow Probability (TFP) is a Python library built on
+ TensorFlow that makes it easy to combine probabilistic models and
+ deep learning on modern hardware (TPU, GPU). It's for data
+ scientists, statisticians, ML researchers, and practitioners who
+ want to encode domain knowledge to understand data and make
+ predictions."""
+
+ homepage = "https://www.tensorflow.org/probability"
+ url = "https://github.com/tensorflow/probability/archive/v0.12.1.tar.gz"
+
+ maintainers = ['aweits']
+
+ version('0.12.1', sha256='1fe89e85fd053bf36e8645a5a1a53b729bc254cf1516bc224fcbd1e4ff50083a')
+ version('0.8.0', sha256='f6049549f6d6b82962523a6bf61c40c1d0c7ac685f209c0084a6da81dd78181d',
+ url='https://github.com/tensorflow/probability/archive/0.8.0.tar.gz')
+
+ extends('python')
+
+ depends_on('py-setuptools', type='build')
+
+ depends_on('py-six@1.10.0:', type=('build', 'run'))
+ depends_on('py-numpy@1.13.3:', type=('build', 'run'))
+ depends_on('py-decorator', type=('build', 'run'))
+
+ depends_on('py-tensorflow@1.14:', type=('build', 'run'), when='@0.8.0')
+ depends_on('py-gast@0.2:0.2.999', type=('build', 'run'), when='@0.8.0')
+ depends_on('py-cloudpickle@1.1.1', type=('build', 'run'), when='@0.8.0')
+
+ depends_on('py-tensorflow@2.4:', type=('build', 'run'), when='@0.12.0:')
+ depends_on('py-cloudpickle@1.3:', type=('build', 'run'), when='@0.12.0:')
+ depends_on('py-gast@0.3.2:', type=('build', 'run'), when='@0.12.0:')
+ depends_on('py-dm-tree', type=('build', 'run'), when='@0.12.0:')
+
+ depends_on('bazel@3.2.0:', type='build')
+
+ def install(self, spec, prefix):
+ self.tmp_path = tempfile.mkdtemp(dir='/tmp', prefix='spack')
+ env['TEST_TMPDIR'] = self.tmp_path
+ env['HOME'] = self.tmp_path
+
+ args = [
+ # Don't allow user or system .bazelrc to override build settings
+ '--nohome_rc',
+ '--nosystem_rc',
+ # Bazel does not work properly on NFS, switch to /tmp
+ '--output_user_root=' + self.tmp_path,
+ 'build',
+ # Spack logs don't handle colored output well
+ '--color=no',
+ '--jobs={0}'.format(make_jobs),
+ # Enable verbose output for failures
+ '--verbose_failures',
+ # Show (formatted) subcommands being executed
+ '--subcommands=pretty_print',
+ '--spawn_strategy=local',
+ # Ask bazel to explain what it's up to
+ # Needs a filename as argument
+ '--explain=explainlogfile.txt',
+ # Increase verbosity of explanation,
+ '--verbose_explanations',
+ # bazel uses system PYTHONPATH instead of spack paths
+ '--action_env', 'PYTHONPATH={0}'.format(env['PYTHONPATH']),
+ '--copt=-O3',
+ '--copt=-march=native',
+ ':pip_pkg',
+ ]
+
+ bazel(*args)
+
+ setup_py('install', '--prefix={0}'.format(prefix),
+ '--single-version-externally-managed', '--root=/')
+ remove_linked_tree(self.tmp_path)