summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSinan <sbulutw@gmail.com>2020-07-07 01:02:37 -0700
committerGitHub <noreply@github.com>2020-07-07 10:02:37 +0200
commit5fb6a06c3706173bed5d535200634462094391c0 (patch)
tree56f35f8df358f93a4551c4af2d4bdfdc65f0acb9
parent6e38fc56f606daf80fc0fb6af514a96673026e53 (diff)
downloadspack-5fb6a06c3706173bed5d535200634462094391c0.tar.gz
spack-5fb6a06c3706173bed5d535200634462094391c0.tar.bz2
spack-5fb6a06c3706173bed5d535200634462094391c0.tar.xz
spack-5fb6a06c3706173bed5d535200634462094391c0.zip
gunrock: improved package recipe (added variants for applications and others) (#17340)
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com> Co-authored-by: Sinan81 <sbulut@3vgeomatics.com>
-rw-r--r--var/spack/repos/builtin/packages/gunrock/package.py100
1 files changed, 97 insertions, 3 deletions
diff --git a/var/spack/repos/builtin/packages/gunrock/package.py b/var/spack/repos/builtin/packages/gunrock/package.py
index f47c1bf635..391b31b723 100644
--- a/var/spack/repos/builtin/packages/gunrock/package.py
+++ b/var/spack/repos/builtin/packages/gunrock/package.py
@@ -12,7 +12,10 @@ class Gunrock(CMakePackage, CudaPackage):
homepage = "https://gunrock.github.io/docs/"
git = "https://github.com/gunrock/gunrock.git"
- version('master', submodules=True)
+ # tagged versions are broken. See
+ # https://github.com/gunrock/gunrock/issues/777
+ # Hence, prefer master version.
+ version('master', submodules=True, preferred=True)
version('1.1', submodules=True, tag='v1.1')
version('1.0', submodules=True, tag='v1.0')
version('0.5.1', submodules=True, tag='v0.5.1')
@@ -23,9 +26,100 @@ class Gunrock(CMakePackage, CudaPackage):
version('0.2', submodules=True, tag='v0.2')
version('0.1', submodules=True, tag='v0.1')
- depends_on('cuda')
+ variant('cuda', default=True, description="Build with Cuda support")
+
+ variant('lib', default=True, description='Build main gunrock library')
+ variant('shared_libs', default=True, description='Turn off to build for static libraries')
+ variant('tests', default=True, description='Build functional tests / examples')
+ variant('mgpu_tests', default=False, description='Builds Gunrock applications and enables the ctest framework for single GPU implementations')
+ variant('cuda_verbose_ptxas', default=False, description='Enable verbose output from the PTXAS assembler')
+ variant('google_tests', default=False, description='Build unit tests using googletest')
+ variant('code_coverage', default=False, description="run code coverage on Gunrock's source code")
+ # apps
+ msg = 'select either all or individual applications'
+ variant(
+ "applications",
+ values=disjoint_sets(
+ ('all',), ('bc', 'bfs', 'cc', 'pr', 'sssp', 'dobfs', 'hits',
+ 'salsa', 'mst', 'wtf', 'topk')
+ ).allow_empty_set().with_default('all').with_error(msg),
+ description="Application to be built"
+ )
+
+ variant('boost', default=True, description='Build with Boost')
+ variant('metis', default=False, description='Build with Metis support')
+
+ depends_on('googletest', when='+google_tests')
+ depends_on('lcov', when='+code_coverage')
+ depends_on('boost@1.58.0:', when='+boost')
+ depends_on('metis', when='+metis')
+
+ conflicts('cuda_arch=none', when='+cuda',
+ msg='Must specify CUDA compute capabilities of your GPU. \
+See "spack info gunrock"')
+
+ def cmake_args(self):
+ spec = self.spec
+ args = []
+ args.extend([
+ '-DGUNROCK_BUILD_LIB={0}'.format(
+ 'ON' if '+lib' in spec else 'OFF'),
+ '-DGUNROCK_BUILD_SHARED_LIBS={0}'.format(
+ 'ON' if '+shared_libs' in spec else 'OFF'),
+ '-DGUNROCK_BUILD_TESTS={0}'.format(
+ 'ON' if '+tests' in spec else 'OFF'),
+ '-DGUNROCK_MGPU_TESTS={0}'.format(
+ 'ON' if '+mgpu_tests' in spec else 'OFF'),
+ '-DCUDA_VERBOSE_PTXAS={0}'.format(
+ 'ON' if '+cuda_verbose_ptxas' in spec else 'OFF'),
+ '-DGUNROCK_GOOGLE_TESTS={0}'.format(
+ 'ON' if '+google_tests' in spec else 'OFF'),
+ '-DGUNROCK_CODE_COVERAGE={0}'.format(
+ 'ON' if '+code_coverage' in spec else 'OFF'),
+ ])
+
+ # turn off auto detect, which undoes custom cuda arch options
+ args.append('-DCUDA_AUTODETECT_GENCODE=OFF')
+
+ cuda_arch_list = self.spec.variants['cuda_arch'].value
+ if cuda_arch_list[0] != 'none':
+ for carch in cuda_arch_list:
+ args.append('-DGUNROCK_GENCODE_SM' + carch + '=ON')
+
+ app_list = self.spec.variants['applications'].value
+ if app_list[0] != 'none':
+ args.extend([
+ '-DGUNROCK_BUILD_APPLICATIONS={0}'.format(
+ 'ON' if spec.satisfies('applications=all') else 'OFF'),
+ '-DGUNROCK_APP_BC={0}'.format(
+ 'ON' if spec.satisfies('applications=bc') else 'OFF'),
+ '-DGUNROCK_APP_BFS={0}'.format(
+ 'ON' if spec.satisfies('applications=bfs') else 'OFF'),
+ '-DGUNROCK_APP_CC={0}'.format(
+ 'ON' if spec.satisfies('applications=cc') else 'OFF'),
+ '-DGUNROCK_APP_PR={0}'.format(
+ 'ON' if spec.satisfies('applications=pr') else 'OFF'),
+ '-DGUNROCK_APP_SSSP={0}'.format(
+ 'ON' if spec.satisfies('applications=sssp') else 'OFF'),
+ '-DGUNROCK_APP_DOBFS={0}'.format(
+ 'ON' if spec.satisfies('applications=dobfs') else 'OFF'),
+ '-DGUNROCK_APP_HITS={0}'.format(
+ 'ON' if spec.satisfies('applications=hits') else 'OFF'),
+ '-DGUNROCK_APP_SALSA={0}'.format(
+ 'ON' if spec.satisfies('applications=salsa') else 'OFF'),
+ '-DGUNROCK_APP_MST={0}'.format(
+ 'ON' if spec.satisfies('applications=mst') else 'OFF'),
+ '-DGUNROCK_APP_WTF={0}'.format(
+ 'ON' if spec.satisfies('applications=wtf') else 'OFF'),
+ '-DGUNROCK_APP_TOPK={0}'.format(
+ 'ON' if spec.satisfies('applications=topk') else 'OFF'),
+ ])
+
+ return args
def install(self, spec, prefix):
with working_dir(self.build_directory):
- install_tree('bin', prefix.bin)
install_tree('lib', prefix.lib)
+ # bin dir is created only if tests/examples are built
+ if '+tests' in spec:
+ install_tree('bin', prefix.bin)