From df4b77f1202fa69576cfe37b9d19d656aa40707c Mon Sep 17 00:00:00 2001 From: Justin Stanley Date: Tue, 26 Feb 2019 18:50:08 -0600 Subject: libbeagle package: add cuda support (#10650) libbeagle compiles against CUDA by default but no there is no mention of it in the package recipe. This PR adds explicit cuda paths and variants, and fixes the target architecture as well (for those who don't have compute_13) --- .../repos/builtin/packages/libbeagle/package.py | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/libbeagle/package.py b/var/spack/repos/builtin/packages/libbeagle/package.py index 61e2ae26fa..6e5d99a7e5 100644 --- a/var/spack/repos/builtin/packages/libbeagle/package.py +++ b/var/spack/repos/builtin/packages/libbeagle/package.py @@ -6,7 +6,7 @@ from spack import * -class Libbeagle(AutotoolsPackage): +class Libbeagle(AutotoolsPackage, CudaPackage): """Beagle performs genotype calling, genotype phasing, imputation of ungenotyped markers, and identity-by-descent segment detection.""" @@ -24,6 +24,33 @@ class Libbeagle(AutotoolsPackage): depends_on('pkgconfig', type='build') depends_on('java', type='build') + def patch(self): + # update cuda architecture if necessary + if '+cuda' in self.spec: + arch = self.spec.variants['cuda_arch'].value + archflag = '' + + if arch[0] != 'none': + archflag = '-arch=%s' % arch[0] + + filter_file('-arch compute_13', archflag, + 'libhmsbeagle/GPU/kernels/Makefile.am', + string=True) + + # point CUDA_LIBS to libcuda.so + filter_file('-L$with_cuda/lib', '-L$with_cuda/lib64/stubs', + 'configure.ac', string=True) + + def configure_args(self): + args = [] + + if '+cuda' in self.spec: + args.append('--with-cuda=%s' % spec['cuda'].prefix) + else: + args.append('--without-cuda') + + return args + def url_for_version(self, version): url = "https://github.com/beagle-dev/beagle-lib/archive/beagle_release_{0}.tar.gz" return url.format(version.underscored) -- cgit v1.2.3-70-g09d2