summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/py-torch-geometric/package.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/py-torch-geometric/package.py b/var/spack/repos/builtin/packages/py-torch-geometric/package.py
index 84d633c261..a8fc7ed366 100644
--- a/var/spack/repos/builtin/packages/py-torch-geometric/package.py
+++ b/var/spack/repos/builtin/packages/py-torch-geometric/package.py
@@ -20,6 +20,8 @@ class PyTorchGeometric(PythonPackage):
version('1.6.0', sha256='7d5231cdcc2ebd4444f406cbf1537eb49bf90ab6f446eaf1b7af5cdbe105f3c9')
+ variant('cuda', default=False, description="Enable CUDA support")
+
depends_on('python@3.6:', type=('build', 'run'))
depends_on('py-setuptools', type='build')
depends_on('py-pytest-runner', type='build')
@@ -37,3 +39,24 @@ class PyTorchGeometric(PythonPackage):
depends_on('py-h5py~mpi', type=('build', 'run'))
depends_on('py-ase', type=('build', 'run'))
depends_on('py-jinja2', type=('build', 'run'))
+ depends_on('py-torch-sparse+cuda', when='+cuda', type=('build', 'run'))
+ depends_on('py-torch-scatter+cuda', when='+cuda', type=('build', 'run'))
+ depends_on('py-torch-cluster+cuda', when='+cuda', type=('build', 'run'))
+ depends_on('py-torch-spline-conv+cuda', when='+cuda', type=('build', 'run'))
+ depends_on('py-torch-sparse~cuda', when='~cuda', type=('build', 'run'))
+ depends_on('py-torch-scatter~cuda', when='~cuda', type=('build', 'run'))
+ depends_on('py-torch-cluster~cuda', when='~cuda', type=('build', 'run'))
+ depends_on('py-torch-spline-conv~cuda', when='~cuda', type=('build', 'run'))
+
+ def setup_build_environment(self, env):
+ if '+cuda' in self.spec:
+ cuda_arches = list(
+ self.spec['py-torch'].variants['cuda_arch'].value)
+ for i, x in enumerate(cuda_arches):
+ cuda_arches[i] = '{0}.{1}'.format(x[0:-1], x[-1])
+ env.set('TORCH_CUDA_ARCH_LIST', str.join(' ', cuda_arches))
+
+ env.set('FORCE_CUDA', '1')
+ env.set('CUDA_HOME', self.spec['cuda'].prefix)
+ else:
+ env.set('FORCE_CUDA', '0')