From 3978db91dc4385b492b8dcbc1f2b87326f217b1b Mon Sep 17 00:00:00 2001 From: Adrien Bernede <51493078+adrienbernede@users.noreply.github.com> Date: Fri, 7 Aug 2020 15:42:07 -0700 Subject: Feature/raja chai umpire update (#17665) * Changing raja, chai, and umpire packages so all will compile with each other. * Need a CUDA version of CHAI when compiling with raja+cuda+chai * Updating checks for commit. * Adding comments explaining why chai+umpire tests were disabled * Reactivating tests for CHAI and Umpire * reordering versions * Unified handling of Cuda Arch * Adding latest versions * Unused/Untested: removed * Aesthetic and test mode in Chai * Unified handling of Cuda Arch * Using 'ON' consistently, instead of 'On' * Apply suggestions from code review Co-authored-by: Adam J. Stewart * Fix, suggestion and patch: Chai depends on RAJA, not the other way. Apply suggested master-main version mapping. Add Umpire version 3.0.0 and patch. Co-authored-by: Robert Blake Co-authored-by: Adam J. Stewart --- var/spack/repos/builtin/packages/chai/package.py | 61 ++++++++++++++++++++++ var/spack/repos/builtin/packages/raja/package.py | 25 ++++++--- .../packages/umpire/camp_target_umpire_3.0.0.patch | 18 +++++++ var/spack/repos/builtin/packages/umpire/package.py | 6 ++- 4 files changed, 102 insertions(+), 8 deletions(-) create mode 100644 var/spack/repos/builtin/packages/chai/package.py create mode 100644 var/spack/repos/builtin/packages/umpire/camp_target_umpire_3.0.0.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/chai/package.py b/var/spack/repos/builtin/packages/chai/package.py new file mode 100644 index 0000000000..66296f5ddf --- /dev/null +++ b/var/spack/repos/builtin/packages/chai/package.py @@ -0,0 +1,61 @@ +# Copyright 2013-2019 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) + +from spack import * + + +class Chai(CMakePackage, CudaPackage): + """ + Copy-hiding array interface for data migration between memory spaces + """ + + homepage = "https://github.com/LLNL/CHAI" + git = "https://github.com/LLNL/CHAI.git" + + version('develop', branch='develop', submodules='True') + version('master', branch='main', submodules='True') + version('2.1.1', tag='v2.1.1', submodules='True') + version('2.1.0', tag='v2.1.0', submodules='True') + version('2.0.0', tag='v2.0.0', submodules='True') + version('1.2.0', tag='v1.2.0', submodules='True') + version('1.1.0', tag='v1.1.0', submodules='True') + version('1.0', tag='v1.0', submodules='True') + + variant('shared', default=True, description='Build Shared Libs') + variant('raja', default=False, description='Build plugin for RAJA') + + depends_on('cmake@3.8:', type='build') + depends_on('umpire') + depends_on('raja', when="+raja") + + depends_on('cmake@3.9:', type='build', when="+cuda") + depends_on('umpire+cuda', when="+cuda") + depends_on('raja+cuda', when="+raja+cuda") + + def cmake_args(self): + spec = self.spec + + options = [] + + if '+cuda' in spec: + options.extend([ + '-DENABLE_CUDA=ON', + '-DCUDA_TOOLKIT_ROOT_DIR=%s' % (spec['cuda'].prefix)]) + + if not spec.satisfies('cuda_arch=none'): + cuda_arch = spec.variants['cuda_arch'].value + options.append('-DCUDA_ARCH=sm_{0}'.format(cuda_arch[0])) + flag = '-arch sm_{0}'.format(cuda_arch[0]) + options.append('-DCMAKE_CUDA_FLAGS:STRING={0}'.format(flag)) + else: + options.append('-DENABLE_CUDA=OFF') + + options.append('-Dumpire_DIR:PATH=' + + spec['umpire'].prefix.share.umpire.cmake) + + options.append('-DENABLE_TESTS={0}'.format( + 'ON' if self.run_tests else 'OFF')) + + return options diff --git a/var/spack/repos/builtin/packages/raja/package.py b/var/spack/repos/builtin/packages/raja/package.py index 5f984c8e08..0f0df14282 100644 --- a/var/spack/repos/builtin/packages/raja/package.py +++ b/var/spack/repos/builtin/packages/raja/package.py @@ -13,7 +13,7 @@ class Raja(CMakePackage, CudaPackage): git = "https://github.com/LLNL/RAJA.git" version('develop', branch='develop', submodules='True') - version('main', branch='main', submodules='True') + version('master', branch='main', submodules='True') version('0.11.0', tag='v0.11.0', submodules="True") version('0.10.1', tag='v0.10.1', submodules="True") version('0.10.0', tag='v0.10.0', submodules="True") @@ -39,20 +39,27 @@ class Raja(CMakePackage, CudaPackage): options = [] options.append('-DENABLE_OPENMP={0}'.format( - 'On' if '+openmp' in spec else 'Off')) + 'ON' if '+openmp' in spec else 'Off')) if '+cuda' in spec: options.extend([ - '-DENABLE_CUDA=On', + '-DENABLE_CUDA=ON', '-DCUDA_TOOLKIT_ROOT_DIR=%s' % (spec['cuda'].prefix)]) + if not spec.satisfies('cuda_arch=none'): cuda_arch = spec.variants['cuda_arch'].value options.append('-DCUDA_ARCH=sm_{0}'.format(cuda_arch[0])) - # shared vs static libs - if "+shared" in spec: - options.append('-DBUILD_SHARED_LIBS=ON') + flag = '-arch sm_{0}'.format(cuda_arch[0]) + options.append('-DCMAKE_CUDA_FLAGS:STRING={0}'.format(flag)) else: - options.append('-DBUILD_SHARED_LIBS=OFF') + options.append('-DENABLE_CUDA=OFF') + + options.append('-DBUILD_SHARED_LIBS={0}'.format( + 'ON' if '+shared' in spec else 'OFF')) + + options.append('-DENABLE_CHAI={0}'.format( + 'ON' if '+chai' in spec else 'OFF')) + # Work around spack adding -march=ppc64le to SPACK_TARGET_ARGS which # is used by the spack compiler wrapper. This can go away when BLT # removes -Werror from GTest flags @@ -61,4 +68,8 @@ class Raja(CMakePackage, CudaPackage): else: options.append('-DENABLE_TESTS=ON') + if '+chai' in spec: + options.extend([ + '-DENABLE_CHAI=ON']) + return options diff --git a/var/spack/repos/builtin/packages/umpire/camp_target_umpire_3.0.0.patch b/var/spack/repos/builtin/packages/umpire/camp_target_umpire_3.0.0.patch new file mode 100644 index 0000000000..2deb565cd3 --- /dev/null +++ b/var/spack/repos/builtin/packages/umpire/camp_target_umpire_3.0.0.patch @@ -0,0 +1,18 @@ +diff --git a/umpire-config.cmake.in b/umpire-config.cmake.in +index a98ad5fe..4e54e173 100644 +--- a/umpire-config.cmake.in ++++ b/umpire-config.cmake.in +@@ -7,6 +7,13 @@ + get_filename_component(UMPIRE_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + set(UMPIRE_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include") + ++if (NOT TARGET camp) ++ if (NOT DEFINED camp_DIR) ++ set(camp_DIR @CMAKE_INSTALL_PREFIX@/lib/cmake/camp) ++ endif () ++ find_package(camp REQUIRED) ++endif () ++ + set(Umpire_VERSION_MAJOR @Umpire_VERSION_MAJOR@) + set(Umpire_VERSION_MINOR @Umpire_VERSION_MINOR@) + set(Umpire_VERSION_PATCH @Umpire_VERSION_PATCH@) diff --git a/var/spack/repos/builtin/packages/umpire/package.py b/var/spack/repos/builtin/packages/umpire/package.py index cc9ccbebd5..00f09b8a42 100644 --- a/var/spack/repos/builtin/packages/umpire/package.py +++ b/var/spack/repos/builtin/packages/umpire/package.py @@ -15,7 +15,8 @@ class Umpire(CMakePackage, CudaPackage): git = 'https://github.com/LLNL/Umpire.git' version('develop', branch='develop', submodules='True') - version('main', branch='main', submodules='True') + version('master', branch='main', submodules='True') + version('3.0.0', tag='v3.0.0', submodules='True') version('2.1.0', tag='v2.1.0', submodules='True') version('2.0.0', tag='v2.0.0', submodules='True') version('1.1.0', tag='v1.1.0', submodules='True') @@ -35,6 +36,8 @@ class Umpire(CMakePackage, CudaPackage): version('0.1.4', tag='v0.1.4', submodules='True') version('0.1.3', tag='v0.1.3', submodules='True') + patch('camp_target_umpire_3.0.0.patch', when='@3.0.0') + variant('fortran', default=False, description='Build C/Fortran API') variant('c', default=True, description='Build C API') variant('numa', default=False, description='Enable NUMA support') @@ -61,6 +64,7 @@ class Umpire(CMakePackage, CudaPackage): if not spec.satisfies('cuda_arch=none'): cuda_arch = spec.variants['cuda_arch'].value + options.append('-DCUDA_ARCH=sm_{0}'.format(cuda_arch[0])) flag = '-arch sm_{0}'.format(cuda_arch[0]) options.append('-DCMAKE_CUDA_FLAGS:STRING={0}'.format(flag)) -- cgit v1.2.3-70-g09d2