Update kokkos for new 3.x build systems (#16358)
* change old Makefile-based Kokkos to kokkos-legacy * add Kokkos 3.x packages Co-authored-by: Jeremiah J Wilke <jjwilke@kokkos-dev-2.sandia.gov>
This commit is contained in:
		| @@ -28,9 +28,9 @@ class Arborx(CMakePackage): | ||||
|     # ArborX relies on Kokkos to provide devices, thus having one-to-one match | ||||
|     # The only way to disable those devices is to make sure Kokkos does not | ||||
|     # provide them | ||||
|     depends_on('kokkos@2.7.00:+cuda+enable_lambda cxxstd=c++14', when='+cuda') | ||||
|     depends_on('kokkos@2.7.00:+openmp cxxstd=c++14', when='+openmp') | ||||
|     depends_on('kokkos@2.7.00:+serial cxxstd=c++14', when='+serial') | ||||
|     depends_on('kokkos-legacy@2.7.00:+cuda+enable_lambda cxxstd=c++14', when='+cuda') | ||||
|     depends_on('kokkos-legacy@2.7.00:+openmp cxxstd=c++14', when='+openmp') | ||||
|     depends_on('kokkos-legacy@2.7.00:+serial cxxstd=c++14', when='+serial') | ||||
| 
 | ||||
|     def cmake_args(self): | ||||
|         spec = self.spec | ||||
|   | ||||
| @@ -22,9 +22,9 @@ class Cabana(CMakePackage): | ||||
|     variant('cuda', default=False, description="enable Cuda backend") | ||||
| 
 | ||||
|     depends_on("cmake@3.9:", type='build') | ||||
|     depends_on("kokkos+serial", when="+serial") | ||||
|     depends_on("kokkos+openmp", when="+openmp") | ||||
|     depends_on("kokkos+cuda", when="+cuda") | ||||
|     depends_on("kokkos-legacy+serial", when="+serial") | ||||
|     depends_on("kokkos-legacy+openmp", when="+openmp") | ||||
|     depends_on("kokkos-legacy+cuda", when="+cuda") | ||||
| 
 | ||||
|     def cmake_args(self): | ||||
|         options = [ | ||||
|   | ||||
| @@ -34,7 +34,7 @@ class Examinimd(MakefilePackage): | ||||
| 
 | ||||
|     conflicts('+openmp', when='+pthreads') | ||||
| 
 | ||||
|     depends_on('kokkos') | ||||
|     depends_on('kokkos-legacy') | ||||
|     depends_on('mpi', when='+mpi') | ||||
| 
 | ||||
|     @property | ||||
|   | ||||
| @@ -0,0 +1,50 @@ | ||||
| # Copyright 2013-2020 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 KokkosKernelsLegacy(MakefilePackage): | ||||
|     """Kokkos C++ Performance Portability Programming EcoSystem: Math Kernels - | ||||
|     Provides BLAS, Sparse BLAS and Graph Kernels.""" | ||||
| 
 | ||||
|     homepage = "https://github.com/kokkos/kokkos-kernels" | ||||
|     url      = "https://github.com/kokkos/kokkos-kernels/archive/2.7.00.tar.gz" | ||||
| 
 | ||||
|     version('2.7.00', sha256='adf4af44eadbdfbeb9ec69dd5fae4e2852bd1fbe4a69213efd199e49f4098254') | ||||
|     version('2.6.00', sha256='14ebf806f66b9ca73949a478b8d959be7fa1165a640935760a724d7cc0a66335') | ||||
|     version('2.5.00', sha256='2c2289da3a41dafd97726e90507debafbb9f5e49ca5b0f5c8d1e044a5796f000') | ||||
| 
 | ||||
|     # make sure kokkos kernels version matches kokkos | ||||
|     depends_on('kokkos-legacy@2.5.00', when='@2.5.00') | ||||
|     depends_on('kokkos-legacy@2.6.00', when='@2.6.00') | ||||
|     depends_on('kokkos-legacy@2.7.00', when='@2.7.00') | ||||
| 
 | ||||
|     patch('makefile.patch') | ||||
| 
 | ||||
|     def edit(self, spec, prefix): | ||||
|         makefile = FileFilter("src/Makefile") | ||||
|         makefile.filter('CXX = .*', 'CXX = ' + env['CXX']) | ||||
| 
 | ||||
|     def build(self, spec, prefix): | ||||
|         with working_dir('build', create=True): | ||||
|             makefile_path = '%s%s' % (self.stage.source_path, '/src/Makefile') | ||||
|             copy(makefile_path, 'Makefile') | ||||
|             make_args = [ | ||||
|                 'KOKKOSKERNELS_INSTALL_PATH=%s' % prefix, | ||||
|                 'KOKKOSKERNELS_PATH=%s' % self.stage.source_path, | ||||
|                 'KOKKOS_PATH=%s' % spec['kokkos'].prefix | ||||
|             ] | ||||
| 
 | ||||
|             make('build', *make_args) | ||||
| 
 | ||||
|     def install(self, spec, prefix): | ||||
|         with working_dir('build', create=False): | ||||
|             make_args = [ | ||||
|                 'KOKKOSKERNELS_INSTALL_PATH=%s' % prefix, | ||||
|                 'KOKKOSKERNELS_PATH=%s' % self.stage.source_path, | ||||
|                 'KOKKOS_PATH=%s' % spec['kokkos'].prefix | ||||
|             ] | ||||
|             make('install', *make_args) | ||||
| @@ -2,52 +2,142 @@ | ||||
| # Spack Project Developers. See the top-level COPYRIGHT file for details. | ||||
| # | ||||
| # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||||
| 
 | ||||
| from spack import * | ||||
| 
 | ||||
| 
 | ||||
| class KokkosKernels(MakefilePackage): | ||||
|     """Kokkos C++ Performance Portability Programming EcoSystem: Math Kernels - | ||||
|     Provides BLAS, Sparse BLAS and Graph Kernels.""" | ||||
| class KokkosKernels(CMakePackage, CudaPackage): | ||||
|     """Kokkos Kernels provides math kernels, often BLAS or LAPACK | ||||
|     for small matrices, that can be used in larger Kokkos parallel routines""" | ||||
| 
 | ||||
|     homepage = "https://github.com/kokkos/kokkos-kernels" | ||||
|     url      = "https://github.com/kokkos/kokkos-kernels/archive/2.7.00.tar.gz" | ||||
|     git = "https://github.com/kokkos/kokkos-kernels.git" | ||||
| 
 | ||||
|     version('2.7.00', sha256='adf4af44eadbdfbeb9ec69dd5fae4e2852bd1fbe4a69213efd199e49f4098254') | ||||
|     version('2.6.00', sha256='14ebf806f66b9ca73949a478b8d959be7fa1165a640935760a724d7cc0a66335') | ||||
|     version('2.5.00', sha256='2c2289da3a41dafd97726e90507debafbb9f5e49ca5b0f5c8d1e044a5796f000') | ||||
|     version('develop', git='https://github.com/kokkos/kokkos-kernels', | ||||
|             branch='develop') | ||||
|     version('3.1',     url='https://github.com/kokkos/kokkos-kernels/archive/3.1.00.tar.gz', | ||||
|             sha256="27fea241ae92f41bd5b070b1a590ba3a56a06aca750207a98bea2f64a4a40c89", | ||||
|             default=True) | ||||
|     version('3.0',     url='https://github.com/kokkos/kokkos-kernels/archive/3.0.00.tar.gz', | ||||
|             sha256="e4b832aed3f8e785de24298f312af71217a26067aea2de51531e8c1e597ef0e6") | ||||
|     version('develop', branch='develop') | ||||
|     version('master',  branch='master') | ||||
| 
 | ||||
|     # make sure kokkos kernels version matches kokkos | ||||
|     depends_on('kokkos@2.5.00', when='@2.5.00') | ||||
|     depends_on('kokkos@2.6.00', when='@2.6.00') | ||||
|     depends_on('kokkos@2.7.00', when='@2.7.00') | ||||
|     depends_on('kokkos@develop', when='@develop') | ||||
|     depends_on("kokkos") | ||||
|     depends_on("kokkos@develop", when="@develop") | ||||
|     depends_on("cmake@3.10:", type='build') | ||||
| 
 | ||||
|     patch('makefile.patch') | ||||
|     backends = { | ||||
|         'serial': (False,  "enable Serial backend (default)"), | ||||
|         'cuda': (False,  "enable Cuda backend"), | ||||
|         'openmp': (False,  "enable OpenMP backend"), | ||||
|     } | ||||
| 
 | ||||
|     def edit(self, spec, prefix): | ||||
|         makefile = FileFilter("src/Makefile") | ||||
|         makefile.filter('CXX = .*', 'CXX = ' + env['CXX']) | ||||
|     for backend in backends: | ||||
|         deflt, descr = backends[backend] | ||||
|         variant(backend.lower(), default=deflt, description=descr) | ||||
|         depends_on("kokkos+%s" % backend.lower(), when="+%s" % backend.lower()) | ||||
| 
 | ||||
|     def build(self, spec, prefix): | ||||
|         with working_dir('build', create=True): | ||||
|             makefile_path = '%s%s' % (self.stage.source_path, '/src/Makefile') | ||||
|             copy(makefile_path, 'Makefile') | ||||
|             make_args = [ | ||||
|                 'KOKKOSKERNELS_INSTALL_PATH=%s' % prefix, | ||||
|                 'KOKKOSKERNELS_PATH=%s' % self.stage.source_path, | ||||
|                 'KOKKOS_PATH=%s' % spec['kokkos'].prefix | ||||
|             ] | ||||
|     space_etis = { | ||||
|         "execspace_cuda": ('auto', "", "cuda"), | ||||
|         "execspace_openmp": ('auto', "", "openmp"), | ||||
|         "execspace_threads": ('auto', "", "pthread"), | ||||
|         "execspace_serial": ('auto', "", "serial"), | ||||
|         "memspace_cudauvmspace": ('auto', "", "cuda"), | ||||
|         "memspace_cudaspace": ('auto', "", "cuda"), | ||||
|     } | ||||
|     for eti in space_etis: | ||||
|         deflt, descr, backend_required = space_etis[eti] | ||||
|         variant(eti, default=deflt, description=descr) | ||||
|         depends_on("kokkos+%s" % backend_required, when="+%s" % eti) | ||||
| 
 | ||||
|             make('build', *make_args) | ||||
|     numeric_etis = { | ||||
|         "ordinals": ("int",        "ORDINAL_",  # default, cmake name | ||||
|                      ["int", "int64_t"]),  # allowed values | ||||
|         "offsets": ("int,size_t", "OFFSET_", | ||||
|                     ["int", "size_t"]), | ||||
|         "layouts": ("left",       "LAYOUT", | ||||
|                     ["left", "right"]), | ||||
|         "scalars": ("double",     "", | ||||
|                     ["float", "double", "complex_float", "complex_double"]) | ||||
|     } | ||||
|     for eti in numeric_etis: | ||||
|         deflt, cmake_name, vals = numeric_etis[eti] | ||||
|         variant(eti, default=deflt, values=vals, multi=True) | ||||
| 
 | ||||
|     def install(self, spec, prefix): | ||||
|         with working_dir('build', create=False): | ||||
|             make_args = [ | ||||
|                 'KOKKOSKERNELS_INSTALL_PATH=%s' % prefix, | ||||
|                 'KOKKOSKERNELS_PATH=%s' % self.stage.source_path, | ||||
|                 'KOKKOS_PATH=%s' % spec['kokkos'].prefix | ||||
|             ] | ||||
|             make('install', *make_args) | ||||
|     tpls = { | ||||
|         # variant name   #deflt   #spack name   #root var name #docstring | ||||
|         "blas": (False, "blas", "BLAS", "Link to system BLAS"), | ||||
|         "lapack": (False, "lapack", "LAPACK", "Link to system LAPACK"), | ||||
|         "mkl": (False, "mkl", "MKL", "Link to system MKL"), | ||||
|         "cublas": (False, "cuda", None, "Link to CUDA BLAS library"), | ||||
|         "cusparse": (False, "cuda", None, "Link to CUDA sparse library"), | ||||
|         "superlu": (False, "superlu", "SUPERLU", "Link to SuperLU library"), | ||||
|         "cblas": (False, "cblas", "CBLAS", "Link to CBLAS library"), | ||||
|         "lapacke": (False, "clapack", "LAPACKE", "Link to LAPACKE library"), | ||||
|     } | ||||
| 
 | ||||
|     for tpl in tpls: | ||||
|         deflt, spackname, rootname, descr = tpls[tpl] | ||||
|         variant(tpl, default=deflt, description=descr) | ||||
|         depends_on(spackname, when="+%s" % tpl) | ||||
| 
 | ||||
|     def cmake_args(self): | ||||
|         spec = self.spec | ||||
|         options = [] | ||||
| 
 | ||||
|         isdiy = "+diy" in spec | ||||
|         if isdiy: | ||||
|             options.append("-DSpack_WORKAROUND=On") | ||||
| 
 | ||||
|         options.append("-DKokkos_ROOT=%s" % spec["kokkos"].prefix) | ||||
|         # Compiler weirdness due to nvcc_wrapper | ||||
|         options.append("-DCMAKE_CXX_COMPILER=%s" % spec["kokkos"].kokkos_cxx) | ||||
| 
 | ||||
|         if self.run_tests: | ||||
|             options.append("-DKokkosKernels_ENABLE_TESTS=ON") | ||||
| 
 | ||||
|         for tpl in self.tpls: | ||||
|             on_flag = "+%s" % tpl | ||||
|             off_flag = "~%s" % tpl | ||||
|             dflt, spackname, rootname, descr = self.tpls[tpl] | ||||
|             if on_flag in self.spec: | ||||
|                 options.append("-DKokkosKernels_ENABLE_TPL_%s=ON" % | ||||
|                                tpl.upper()) | ||||
|                 if rootname: | ||||
|                     options.append("-D%s_ROOT=%s" % | ||||
|                                    (rootname, spec[spackname].prefix)) | ||||
|                 else: | ||||
|                     pass  # this should get picked up automatically, we hope | ||||
|             elif off_flag in self.spec: | ||||
|                 options.append( | ||||
|                     "-DKokkosKernels_ENABLE_TPL_%s=OFF" % tpl.upper()) | ||||
| 
 | ||||
|         for eti in self.numeric_etis: | ||||
|             deflt, cmake_name, vals = self.numeric_etis[eti] | ||||
|             for val in vals: | ||||
|                 keyval = "%s=%s" % (eti, val) | ||||
|                 cmake_option = "KokkosKernels_INST_%s%s" % ( | ||||
|                     cmake_name.upper(), val.upper()) | ||||
|                 if keyval in spec: | ||||
|                     options.append("-D%s=ON" % cmake_option) | ||||
|                 else: | ||||
|                     options.append("-D%s=OFF" % cmake_option) | ||||
| 
 | ||||
|         for eti in self.space_etis: | ||||
|             deflt, descr = self.space_etis[eti] | ||||
|             if deflt == "auto": | ||||
|                 value = spec.variants[eti].value | ||||
|                 # spack does these as strings, not reg booleans | ||||
|                 if str(value) == "True": | ||||
|                     options.append("-DKokkosKernels_INST_%s=ON" % eti.upper()) | ||||
|                 elif str(value) == "False": | ||||
|                     options.append("-DKokkosKernels_INST_%s=OFF" % eti.upper()) | ||||
|                 else: | ||||
|                     pass  # don't pass anything, let CMake decide | ||||
|             else:  # simple option | ||||
|                 on_flag = "+%s" % eti | ||||
|                 off_flag = "~%s" % eti | ||||
|                 if on_flag in self.spec: | ||||
|                     options.append("-DKokkosKernels_INST_%s=ON" % eti.upper()) | ||||
|                 elif off_flag in self.spec: | ||||
|                     options.append("-DKokkosKernels_INST_%s=OFF" % eti.upper()) | ||||
| 
 | ||||
|         return options | ||||
|   | ||||
							
								
								
									
										229
									
								
								var/spack/repos/builtin/packages/kokkos-legacy/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										229
									
								
								var/spack/repos/builtin/packages/kokkos-legacy/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,229 @@ | ||||
| # Copyright 2013-2020 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 KokkosLegacy(Package): | ||||
|     """Kokkos implements a programming model in C++ for writing performance | ||||
|     portable applications targeting all major HPC platforms.""" | ||||
| 
 | ||||
|     homepage = "https://github.com/kokkos/kokkos" | ||||
|     url      = "https://github.com/kokkos/kokkos/archive/2.03.00.tar.gz" | ||||
|     git      = "https://github.com/kokkos/kokkos.git" | ||||
| 
 | ||||
|     version('2.9.00', sha256='e0621197791ed3a381b4f02c78fa529f3cff3abb74d52157b4add17e8aa04bc4') | ||||
|     version('2.8.00', sha256='1c72661f2d770517bff98837001b42b9c677d1df29f7493a1d7c008549aff630') | ||||
|     version('2.7.24', sha256='a308a80ea1488f4c18884b828ce7ae9f5210b9a6b2f61b208d875084d8da8cb0') | ||||
|     version('2.7.00',  sha256='01595996e612ef7410aa42fa265a23101cfe1b6993fa9810ca844db5c89ad765') | ||||
|     version('2.5.00',  sha256='ea232594bf746abb99ae2aafaeef5d07adc089968010a62a88aaa892106d9476') | ||||
|     version('2.04.11', sha256='f2680aee0169f6cbbec38410f9c80bf8a160435f6a07769c1e9112da8b9349a0') | ||||
|     version('2.04.04', sha256='5bac8ddc2fac9bc6e01dd40f92ca6cbbb346a25deca5be2fec71acf712d0d0c7') | ||||
|     version('2.04.00', sha256='b04658d368986df207662a7a37c1ad974c321447bc2c2b5b696d7e9ee4481f34') | ||||
|     version('2.03.13', sha256='002748bdd0319d5ab82606cf92dc210fc1c05d0607a2e1d5538f60512b029056') | ||||
|     version('2.03.05', sha256='b18ddaa1496130ff3f675ea9ddbc6df9cdf378d53edf96df89e70ff189e10e1d') | ||||
|     version('2.03.00', sha256='722bea558d8986efee765ac912febb3c1ce289a8e9bdfef77cd0145df0ea8a3d') | ||||
|     version('2.02.15', sha256='6b4a7f189f0341f378f950f3c798f520d2e473b13435b137ff3b666e799a076d') | ||||
|     version('2.02.07', sha256='7b4ac81021d6868f4eb8e2a1cb92ba76bad9c3f197403b8b1eac0f11c983247c') | ||||
| 
 | ||||
|     variant('debug', default=False, description="Build debug version of Kokkos") | ||||
| 
 | ||||
|     variant('serial', default=True, description="enable Serial backend (default)") | ||||
|     variant('pthreads', default=False, description="enable Pthreads backend") | ||||
|     variant('qthreads', default=False, description="enable Qthreads backend") | ||||
|     variant('cuda', default=False, description="enable Cuda backend") | ||||
|     variant('openmp', default=False, description="enable OpenMP backend") | ||||
| 
 | ||||
|     # Compilation options | ||||
|     variant('pic', default=False, | ||||
|             description="enable position independent code (-fPIC flag)") | ||||
| 
 | ||||
|     # Kokkos options | ||||
|     variant('aggressive_vectorization', default=False, | ||||
|             description="set aggressive_vectorization Kokkos option") | ||||
|     variant('disable_profiling', default=False, | ||||
|             description="set disable_profiling Kokkos option") | ||||
|     variant('disable_dualview_modify_check', default=False, | ||||
|             description="set disable_dualview_modify_check Kokkos option") | ||||
|     variant('enable_profile_load_print', default=False, | ||||
|             description="set enable_profile_load_print Kokkos option") | ||||
|     variant('compiler_warnings', default=False, | ||||
|             description="set compiler_warnings Kokkos option") | ||||
|     variant('disable_deprecated_code', default=False, | ||||
|             description="set disable_deprecated_code Kokkos option") | ||||
|     variant('enable_eti', default=False, | ||||
|             description="set enable_eti Kokkos option") | ||||
| 
 | ||||
|     # CUDA options | ||||
|     variant('force_uvm', default=False, | ||||
|             description="set force_uvm Kokkos CUDA option") | ||||
|     variant('use_ldg', default=False, | ||||
|             description="set use_ldg Kokkos CUDA option") | ||||
|     variant('rdc', default=False, | ||||
|             description="set rdc Kokkos CUDA option") | ||||
|     variant('enable_lambda', default=False, | ||||
|             description="set enable_lambda Kokkos CUDA option") | ||||
| 
 | ||||
|     host_values = ('AMDAVX', 'ARMv80', 'ARMv81', 'ARMv8-ThunderX', | ||||
|                    'Power7', 'Power8', 'Power9', | ||||
|                    'WSM', 'SNB', 'HSW', 'BDW', 'SKX', | ||||
|                    'KNC', 'KNL') | ||||
| 
 | ||||
|     gpu_values = ('Kepler30', 'Kepler32', 'Kepler35', 'Kepler37', | ||||
|                   'Maxwell50', 'Maxwell52', 'Maxwell53', | ||||
|                   'Pascal60', 'Pascal61', | ||||
|                   'Volta70', 'Volta72') | ||||
| 
 | ||||
|     # C++ standard variant | ||||
|     variant('cxxstd', default='none', | ||||
|             values=('c++11', 'c++14', 'c++17', 'c++1y', 'c++1z', 'c++2a'), | ||||
|             multi=False, | ||||
|             description='set cxxstandard Kokkos option') | ||||
| 
 | ||||
|     # Host architecture variant | ||||
|     variant( | ||||
|         'host_arch', | ||||
|         default='none', | ||||
|         values=host_values, | ||||
|         description='Set the host architecture to use' | ||||
|     ) | ||||
| 
 | ||||
|     # GPU architecture variant | ||||
|     variant( | ||||
|         'gpu_arch', | ||||
|         default='none', | ||||
|         values=gpu_values, | ||||
|         description='Set the GPU architecture to use' | ||||
|     ) | ||||
| 
 | ||||
|     # Checks on Kokkos version and Kokkos options | ||||
|     conflicts('+aggressive_vectorization', when='@:2.0.99',) | ||||
|     conflicts('+disable_profiling', when='@:2.0.99',) | ||||
|     conflicts('+disable_dualview_modify_check', when='@:2.03.04',) | ||||
|     conflicts('+enable_profile_load_print', when='@:2.03.04',) | ||||
|     conflicts('+compiler_warnings', when='@:2.03.14',) | ||||
|     conflicts('+disable_deprecated_code', when='@:2.5.99',) | ||||
|     conflicts('+enable_eti', when='@:2.6.99',) | ||||
| 
 | ||||
|     # Check that we haven't specified a gpu architecture | ||||
|     # without specifying CUDA | ||||
|     for p in gpu_values: | ||||
|         conflicts('gpu_arch={0}'.format(p), when='~cuda', | ||||
|                   msg='Must specify CUDA backend to use a GPU architecture.') | ||||
| 
 | ||||
|     # Check that we haven't specified a Kokkos CUDA option | ||||
|     # without specifying CUDA | ||||
|     conflicts('+force_uvm', when='~cuda', | ||||
|               msg='Must enable CUDA to use force_uvm.') | ||||
|     conflicts('+use_ldg', when='~cuda', | ||||
|               msg='Must enable CUDA to use use_ldg.') | ||||
|     conflicts('+rdc', when='~cuda', | ||||
|               msg='Must enable CUDA to use rdc.') | ||||
|     conflicts('+enable_lambda', when='~cuda', | ||||
|               msg='Must enable CUDA to use enable_lambda.') | ||||
| 
 | ||||
|     # Check that we haven't asked for a GPU architecture that | ||||
|     # the revision of kokkos does not support | ||||
|     conflicts('gpu_arch=Volta70', when='@:2.5.99') | ||||
|     conflicts('gpu_arch=Volta72', when='@:2.5.99') | ||||
| 
 | ||||
|     # conflicts on kokkos version and cuda enabled | ||||
|     # see kokkos issue #1296 | ||||
|     # https://github.com/kokkos/kokkos/issues/1296 | ||||
|     conflicts('+cuda', when='@2.5.00:2.7.00', | ||||
|               msg='Kokkos build system has issue (#1296) when CUDA enabled' | ||||
|               ' in version 2.5.00 through 2.7.00.') | ||||
| 
 | ||||
|     # Specify that v1.x is required as v2.x has API changes | ||||
|     depends_on('hwloc@:1') | ||||
|     depends_on('qthreads', when='+qthreads') | ||||
|     depends_on('cuda', when='+cuda') | ||||
| 
 | ||||
|     # generate_makefile.bash calls cmake | ||||
|     depends_on('cmake@3.10:', type='build') | ||||
| 
 | ||||
|     def install(self, spec, prefix): | ||||
|         generate = which(join_path(self.stage.source_path, | ||||
|                                    'generate_makefile.bash')) | ||||
|         with working_dir('build', create=True): | ||||
|             g_args = [ | ||||
|                 '--prefix=%s' % prefix, | ||||
|                 '--with-hwloc=%s' % spec['hwloc'].prefix, | ||||
|             ] | ||||
|             arch_args = [] | ||||
|             kokkos_options_args = [] | ||||
|             cuda_options_args = [] | ||||
| 
 | ||||
|             # PIC | ||||
|             if '+pic' in spec: | ||||
|                 g_args.append('--cxxflags=-fPIC') | ||||
| 
 | ||||
|             # C++ standard | ||||
|             cxxstandard = spec.variants['cxxstd'].value | ||||
|             if cxxstandard != 'none': | ||||
|                 g_args.append('--cxxstandard=%s' % cxxstandard) | ||||
| 
 | ||||
|             # Build Debug | ||||
|             if '+debug' in spec: | ||||
|                 g_args.append('--debug') | ||||
| 
 | ||||
|             # Backends | ||||
|             if '+serial' in spec: | ||||
|                 g_args.append('--with-serial') | ||||
|             if '+openmp' in spec: | ||||
|                 g_args.append('--with-openmp') | ||||
|             if '+pthreads' in spec: | ||||
|                 g_args.append('--with-pthread') | ||||
|             if '+qthreads' in spec: | ||||
|                 g_args.append('--with-qthreads=%s' % spec['qthreads'].prefix) | ||||
|             if '+cuda' in spec: | ||||
|                 g_args.append('--with-cuda=%s' % spec['cuda'].prefix) | ||||
|             # Host architectures | ||||
|             host_arch = spec.variants['host_arch'].value | ||||
|             # GPU architectures | ||||
|             gpu_arch  = spec.variants['gpu_arch'].value | ||||
|             if host_arch != 'none': | ||||
|                 arch_args.append(host_arch) | ||||
|             if gpu_arch != 'none': | ||||
|                 arch_args.append(gpu_arch) | ||||
|             # Combined architecture flags | ||||
|             if arch_args: | ||||
|                 g_args.append('--arch={0}'.format(','.join(arch_args))) | ||||
| 
 | ||||
|             # CUDA options | ||||
|             if '+force_uvm' in spec: | ||||
|                 cuda_options_args.append('force_uvm') | ||||
|             if '+use_ldg' in spec: | ||||
|                 cuda_options_args.append('use_ldg') | ||||
|             if '+rdc' in spec: | ||||
|                 cuda_options_args.append('rdc') | ||||
|             if '+enable_lambda' in spec: | ||||
|                 cuda_options_args.append('enable_lambda') | ||||
|             if cuda_options_args: | ||||
|                 g_args.append('--with-cuda-options={0}' | ||||
|                               .format(','.join(cuda_options_args))) | ||||
| 
 | ||||
|             # Kokkos options | ||||
|             if '+aggressive_vectorization' in spec: | ||||
|                 kokkos_options_args.append('aggressive_vectorization') | ||||
|             if '+disable_profiling' in spec: | ||||
|                 kokkos_options_args.append('disable_profiling') | ||||
|             if '+disable_dualview_modify_check' in spec: | ||||
|                 kokkos_options_args.append('disable_dualview_modify_check') | ||||
|             if '+enable_profile_load_print' in spec: | ||||
|                 kokkos_options_args.append('enable_profile_load_print') | ||||
|             if '+compiler_warnings' in spec: | ||||
|                 kokkos_options_args.append('compiler_warnings') | ||||
|             if '+disable_deprecated_code' in spec: | ||||
|                 kokkos_options_args.append('disable_deprecated_code') | ||||
|             if '+enable_eti' in spec: | ||||
|                 kokkos_options_args.append('enable_eti') | ||||
|             if kokkos_options_args: | ||||
|                 g_args.append('--with-options={0}' | ||||
|                               .format(','.join(kokkos_options_args))) | ||||
| 
 | ||||
|             generate(*g_args) | ||||
|             make() | ||||
|             make('install') | ||||
| @@ -0,0 +1,43 @@ | ||||
| # Copyright 2013-2020 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 * | ||||
| import os | ||||
| 
 | ||||
| 
 | ||||
| class KokkosNvccWrapper(CMakePackage): | ||||
|     """The NVCC wrapper provides a wrapper around NVCC to make it a | ||||
|        'full' C++ compiler that accepts all flags""" | ||||
| 
 | ||||
|     homepage = "https://github.com/kokkos/kokkos" | ||||
|     git = "https://github.com/kokkos/nvcc_wrapper.git" | ||||
| 
 | ||||
|     version('3.1', url='https://github.com/kokkos/nvcc_wrapper/archive/3.1.tar.gz', | ||||
|             sha256="5171530763bb2845aa70651f3a8e5dc95b6eed76379323fde3205f97ed28ec8c", | ||||
|             default=True) | ||||
|     version('master', branch='master') | ||||
| 
 | ||||
|     variant("mpi", default=True, | ||||
|             description="use with MPI as the underlying compiler") | ||||
|     depends_on("cuda") | ||||
|     depends_on("mpi", when="+mpi") | ||||
|     depends_on("cmake@3.10:", type='build') | ||||
| 
 | ||||
|     def cmake_args(self): | ||||
|         options = [ | ||||
|             "-DCMAKE_CXX_COMPILER=%s" % os.environ["SPACK_CXX"], | ||||
|             "-DCMAKE_CUDA_HOST_COMPILER=%s" % os.environ["SPACK_CXX"], | ||||
|             "-DCMAKE_C_COMPILER=%s" % os.environ["SPACK_CC"], | ||||
|         ] | ||||
|         return options | ||||
| 
 | ||||
|     def setup_dependent_build_environment(self, env, dependent_spec): | ||||
|         wrapper = join_path(self.prefix.bin, "nvcc_wrapper") | ||||
|         env.set('MPICH_CXX', wrapper) | ||||
|         env.set('OMPI_CXX', wrapper) | ||||
|         env.set('KOKKOS_CXX', spack_cxx) | ||||
| 
 | ||||
|     def setup_dependent_package(self, module, dependent_spec): | ||||
|         wrapper = join_path(self.prefix.bin, "nvcc_wrapper") | ||||
|         self.spec.kokkos_cxx = wrapper | ||||
| @@ -2,231 +2,245 @@ | ||||
| # Spack Project Developers. See the top-level COPYRIGHT file for details. | ||||
| # | ||||
| # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||||
| 
 | ||||
| from spack import * | ||||
| 
 | ||||
| 
 | ||||
| class Kokkos(Package): | ||||
| class Kokkos(CMakePackage, CudaPackage): | ||||
|     """Kokkos implements a programming model in C++ for writing performance | ||||
|     portable applications targeting all major HPC platforms.""" | ||||
| 
 | ||||
|     homepage = "https://github.com/kokkos/kokkos" | ||||
|     url      = "https://github.com/kokkos/kokkos/archive/2.03.00.tar.gz" | ||||
|     git      = "https://github.com/kokkos/kokkos.git" | ||||
|     git = "https://github.com/kokkos/kokkos.git" | ||||
| 
 | ||||
|     version('develop', branch='develop') | ||||
|     version('3.1.00', sha256='b935c9b780e7330bcb80809992caa2b66fd387e3a1c261c955d622dae857d878') | ||||
|     version('3.0.00', sha256='c00613d0194a4fbd0726719bbed8b0404ed06275f310189b3493f5739042a92b') | ||||
|     version('2.9.00', sha256='e0621197791ed3a381b4f02c78fa529f3cff3abb74d52157b4add17e8aa04bc4') | ||||
|     version('2.8.00', sha256='1c72661f2d770517bff98837001b42b9c677d1df29f7493a1d7c008549aff630') | ||||
|     version('2.7.24', sha256='a308a80ea1488f4c18884b828ce7ae9f5210b9a6b2f61b208d875084d8da8cb0') | ||||
|     version('2.7.00',  sha256='01595996e612ef7410aa42fa265a23101cfe1b6993fa9810ca844db5c89ad765') | ||||
|     version('2.5.00',  sha256='ea232594bf746abb99ae2aafaeef5d07adc089968010a62a88aaa892106d9476') | ||||
|     version('2.04.11', sha256='f2680aee0169f6cbbec38410f9c80bf8a160435f6a07769c1e9112da8b9349a0') | ||||
|     version('2.04.04', sha256='5bac8ddc2fac9bc6e01dd40f92ca6cbbb346a25deca5be2fec71acf712d0d0c7') | ||||
|     version('2.04.00', sha256='b04658d368986df207662a7a37c1ad974c321447bc2c2b5b696d7e9ee4481f34') | ||||
|     version('2.03.13', sha256='002748bdd0319d5ab82606cf92dc210fc1c05d0607a2e1d5538f60512b029056') | ||||
|     version('2.03.05', sha256='b18ddaa1496130ff3f675ea9ddbc6df9cdf378d53edf96df89e70ff189e10e1d') | ||||
|     version('2.03.00', sha256='722bea558d8986efee765ac912febb3c1ce289a8e9bdfef77cd0145df0ea8a3d') | ||||
|     version('2.02.15', sha256='6b4a7f189f0341f378f950f3c798f520d2e473b13435b137ff3b666e799a076d') | ||||
|     version('2.02.07', sha256='7b4ac81021d6868f4eb8e2a1cb92ba76bad9c3f197403b8b1eac0f11c983247c') | ||||
|     version('master',  branch='master') | ||||
|     version('3.0', url="https://github.com/kokkos/kokkos/archive/3.0.00.tar.gz", | ||||
|             sha256="c00613d0194a4fbd0726719bbed8b0404ed06275f310189b3493f5739042a92b") | ||||
|     version('3.1', url="https://github.com/kokkos/kokkos/archive/3.1.00.tar.gz", | ||||
|             sha256="b935c9b780e7330bcb80809992caa2b66fd387e3a1c261c955d622dae857d878", | ||||
|             default=True) | ||||
| 
 | ||||
|     variant('debug', default=False, description="Build debug version of Kokkos") | ||||
|     depends_on("cmake@3.10:", type='build') | ||||
| 
 | ||||
|     variant('serial', default=True, description="enable Serial backend (default)") | ||||
|     variant('pthreads', default=False, description="enable Pthreads backend") | ||||
|     variant('qthreads', default=False, description="enable Qthreads backend") | ||||
|     variant('cuda', default=False, description="enable Cuda backend") | ||||
|     variant('openmp', default=False, description="enable OpenMP backend") | ||||
|     devices_variants = { | ||||
|         'cuda': [False, 'Whether to build CUDA backend'], | ||||
|         'openmp': [False, 'Whether to build OpenMP backend'], | ||||
|         'pthread': [False, 'Whether to build Pthread backend'], | ||||
|         'serial': [True,  'Whether to build serial backend'], | ||||
|         'hip': [False, 'Whether to build HIP backend'], | ||||
|     } | ||||
|     conflicts("+hip", when="@:3.0") | ||||
| 
 | ||||
|     # Compilation options | ||||
|     variant('pic', default=False, | ||||
|             description="enable position independent code (-fPIC flag)") | ||||
|     tpls_variants = { | ||||
|         'hpx': [False, 'Whether to enable the HPX library'], | ||||
|         'hwloc': [False, 'Whether to enable the HWLOC library'], | ||||
|         'numactl': [False, 'Whether to enable the LIBNUMA library'], | ||||
|         'memkind': [False, 'Whether to enable the MEMKIND library'], | ||||
|     } | ||||
| 
 | ||||
|     # Kokkos options | ||||
|     variant('aggressive_vectorization', default=False, | ||||
|             description="set aggressive_vectorization Kokkos option") | ||||
|     variant('disable_profiling', default=False, | ||||
|             description="set disable_profiling Kokkos option") | ||||
|     variant('disable_dualview_modify_check', default=False, | ||||
|             description="set disable_dualview_modify_check Kokkos option") | ||||
|     variant('enable_profile_load_print', default=False, | ||||
|             description="set enable_profile_load_print Kokkos option") | ||||
|     variant('compiler_warnings', default=False, | ||||
|             description="set compiler_warnings Kokkos option") | ||||
|     variant('disable_deprecated_code', default=False, | ||||
|             description="set disable_deprecated_code Kokkos option") | ||||
|     variant('enable_eti', default=False, | ||||
|             description="set enable_eti Kokkos option") | ||||
|     options_variants = { | ||||
|         'aggressive_vectorization': [False, | ||||
|                                      'Aggressively vectorize loops'], | ||||
|         'compiler_warnings': [False, | ||||
|                               'Print all compiler warnings'], | ||||
|         'cuda_lambda': [False, | ||||
|                         'Activate experimental lambda features'], | ||||
|         'cuda_ldg_intrinsic': [False, | ||||
|                                'Use CUDA LDG intrinsics'], | ||||
|         'cuda_relocatable_device_code': [False, | ||||
|                                          'Enable RDC for CUDA'], | ||||
|         'cuda_uvm': [False, | ||||
|                      'Enable unified virtual memory (UVM) for CUDA'], | ||||
|         'debug': [False, | ||||
|                   'Activate extra debug features - may increase compiletimes'], | ||||
|         'debug_bounds_check': [False, | ||||
|                                'Use bounds checking - will increase runtime'], | ||||
|         'debug_dualview_modify_check': [False, 'Debug check on dual views'], | ||||
|         'deprecated_code': [False, 'Whether to enable deprecated code'], | ||||
|         'examples': [False, 'Whether to build OpenMP  backend'], | ||||
|         'explicit_instantiation': [False, | ||||
|                                    'Explicitly instantiate template types'], | ||||
|         'hpx_async_dispatch': [False, | ||||
|                                'Whether HPX supports asynchronous dispath'], | ||||
|         'profiling': [True, | ||||
|                       'Create bindings for profiling tools'], | ||||
|         'profiling_load_print': [False, | ||||
|                                  'Print which profiling tools got loaded'], | ||||
|         'qthread': [False, 'Eenable the QTHREAD library'], | ||||
|         'tests': [False, 'Build for tests'], | ||||
|     } | ||||
| 
 | ||||
|     # CUDA options | ||||
|     variant('force_uvm', default=False, | ||||
|             description="set force_uvm Kokkos CUDA option") | ||||
|     variant('use_ldg', default=False, | ||||
|             description="set use_ldg Kokkos CUDA option") | ||||
|     variant('rdc', default=False, | ||||
|             description="set rdc Kokkos CUDA option") | ||||
|     variant('enable_lambda', default=False, | ||||
|             description="set enable_lambda Kokkos CUDA option") | ||||
|     amd_gpu_arches = [ | ||||
|         'fiji', | ||||
|         'gfx901', | ||||
|         'vega900', | ||||
|         'vega906', | ||||
|     ] | ||||
|     variant("amd_gpu_arch", default='none', values=amd_gpu_arches, | ||||
|             description="AMD GPU architecture") | ||||
|     conflicts("+hip", when="amd_gpu_arch=none") | ||||
| 
 | ||||
|     host_values = ('AMDAVX', 'ARMv80', 'ARMv81', 'ARMv8-ThunderX', | ||||
|                    'Power7', 'Power8', 'Power9', | ||||
|                    'WSM', 'SNB', 'HSW', 'BDW', 'SKX', | ||||
|                    'KNC', 'KNL') | ||||
|     spack_micro_arch_map = { | ||||
|         "aarch64": "", | ||||
|         "arm": "", | ||||
|         "ppc": "", | ||||
|         "ppc64": "", | ||||
|         "ppc64le": "", | ||||
|         "ppcle": "", | ||||
|         "sparc": None, | ||||
|         "sparc64": None, | ||||
|         "x86": "", | ||||
|         "x86_64": "", | ||||
|         "thunderx2": "THUNDERX2", | ||||
|         "k10": None, | ||||
|         "zen": "ZEN", | ||||
|         "bulldozer": "", | ||||
|         "piledriver": "", | ||||
|         "zen2": "ZEN2", | ||||
|         "steamroller": "KAVERI", | ||||
|         "excavator": "CARIZO", | ||||
|         "a64fx": "", | ||||
|         "power7": "POWER7", | ||||
|         "power8": "POWER8", | ||||
|         "power9": "POWER9", | ||||
|         "power8le": "POWER8", | ||||
|         "power9le": "POWER9", | ||||
|         "i686": None, | ||||
|         "pentium2": None, | ||||
|         "pentium3": None, | ||||
|         "pentium4": None, | ||||
|         "prescott": None, | ||||
|         "nocona": None, | ||||
|         "nehalem": None, | ||||
|         "sandybridge": "SNB", | ||||
|         "haswell": "HSW", | ||||
|         "mic_knl": "KNL", | ||||
|         "cannonlake": "SKX", | ||||
|         "cascadelake": "SKX", | ||||
|         "westmere": "WSM", | ||||
|         "core2": None, | ||||
|         "ivybridge": "SNB", | ||||
|         "broadwell": "BDW", | ||||
|         "skylake": "SKX", | ||||
|         "icelake": "SKX", | ||||
|         "skylake_avx512": "SKX", | ||||
|     } | ||||
| 
 | ||||
|     gpu_values = ('Kepler30', 'Kepler32', 'Kepler35', 'Kepler37', | ||||
|                   'Maxwell50', 'Maxwell52', 'Maxwell53', | ||||
|                   'Pascal60', 'Pascal61', | ||||
|                   'Volta70', 'Volta72') | ||||
|     spack_cuda_arch_map = { | ||||
|         "30": 'kepler30', | ||||
|         "32": 'kepler32', | ||||
|         "35": 'kepler35', | ||||
|         "37": 'kepler37', | ||||
|         "50": 'maxwell50', | ||||
|         "52": 'maxwell52', | ||||
|         "53": 'maxwell53', | ||||
|         "60": 'pascal60', | ||||
|         "61": 'pascal61', | ||||
|         "70": 'volta70', | ||||
|         "72": 'volta72', | ||||
|         "75": 'turing75', | ||||
|     } | ||||
|     cuda_arches = spack_cuda_arch_map.values() | ||||
|     conflicts("+cuda", when="cuda_arch=none") | ||||
| 
 | ||||
|     # C++ standard variant | ||||
|     variant('cxxstd', default='none', | ||||
|             values=('c++11', 'c++14', 'c++17', 'c++1y', 'c++1z', 'c++2a'), | ||||
|             multi=False, | ||||
|             description='set cxxstandard Kokkos option') | ||||
|     devices_values = list(devices_variants.keys()) | ||||
|     for dev in devices_variants: | ||||
|         dflt, desc = devices_variants[dev] | ||||
|         variant(dev, default=dflt, description=desc) | ||||
| 
 | ||||
|     # Host architecture variant | ||||
|     variant( | ||||
|         'host_arch', | ||||
|         default='none', | ||||
|         values=host_values, | ||||
|         description='Set the host architecture to use' | ||||
|     ) | ||||
|     options_values = list(options_variants.keys()) | ||||
|     for opt in options_values: | ||||
|         if "cuda" in opt: | ||||
|             conflicts('+%s' % opt, when="~cuda", | ||||
|                       msg="Must enable CUDA to use %s" % opt) | ||||
|         dflt, desc = options_variants[opt] | ||||
|         variant(opt, default=dflt, description=desc) | ||||
| 
 | ||||
|     # GPU architecture variant | ||||
|     variant( | ||||
|         'gpu_arch', | ||||
|         default='none', | ||||
|         values=gpu_values, | ||||
|         description='Set the GPU architecture to use' | ||||
|     ) | ||||
|     tpls_values = list(tpls_variants.keys()) | ||||
|     for tpl in tpls_values: | ||||
|         dflt, desc = tpls_variants[tpl] | ||||
|         variant(tpl, default=dflt, description=desc) | ||||
|         depends_on(tpl, when="+%s" % tpl) | ||||
| 
 | ||||
|     # Checks on Kokkos version and Kokkos options | ||||
|     conflicts('+aggressive_vectorization', when='@:2.0.99',) | ||||
|     conflicts('+disable_profiling', when='@:2.0.99',) | ||||
|     conflicts('+disable_dualview_modify_check', when='@:2.03.04',) | ||||
|     conflicts('+enable_profile_load_print', when='@:2.03.04',) | ||||
|     conflicts('+compiler_warnings', when='@:2.03.14',) | ||||
|     conflicts('+disable_deprecated_code', when='@:2.5.99',) | ||||
|     conflicts('+enable_eti', when='@:2.6.99',) | ||||
|     variant("wrapper", default=False, | ||||
|             description="Use nvcc-wrapper for CUDA build") | ||||
|     depends_on("kokkos-nvcc-wrapper", when="+wrapper") | ||||
|     conflicts("+wrapper", when="~cuda") | ||||
| 
 | ||||
|     # Check that we haven't specified a gpu architecture | ||||
|     # without specifying CUDA | ||||
|     for p in gpu_values: | ||||
|         conflicts('gpu_arch={0}'.format(p), when='~cuda', | ||||
|                   msg='Must specify CUDA backend to use a GPU architecture.') | ||||
|     variant("std", default="11", values=["11", "14", "17", "20"], multi=False) | ||||
|     # nvcc does not currently work with C++17 or C++20 | ||||
|     conflicts("+cuda", when="std=17") | ||||
|     conflicts("+cuda", when="std=20") | ||||
| 
 | ||||
|     # Check that we haven't specified a Kokkos CUDA option | ||||
|     # without specifying CUDA | ||||
|     conflicts('+force_uvm', when='~cuda', | ||||
|               msg='Must enable CUDA to use force_uvm.') | ||||
|     conflicts('+use_ldg', when='~cuda', | ||||
|               msg='Must enable CUDA to use use_ldg.') | ||||
|     conflicts('+rdc', when='~cuda', | ||||
|               msg='Must enable CUDA to use rdc.') | ||||
|     conflicts('+enable_lambda', when='~cuda', | ||||
|               msg='Must enable CUDA to use enable_lambda.') | ||||
|     def append_args(self, cmake_prefix, cmake_options, spack_options): | ||||
|         for opt in cmake_options: | ||||
|             enablestr = "+%s" % opt | ||||
|             optuc = opt.upper() | ||||
|             optname = "Kokkos_%s_%s" % (cmake_prefix, optuc) | ||||
|             option = None | ||||
|             if enablestr in self.spec: | ||||
|                 option = "-D%s=ON" % optname | ||||
|             else: | ||||
|                 # explicitly turn off if not enabled | ||||
|                 # this avoids any confusing implicit defaults | ||||
|                 # that come from the CMake | ||||
|                 option = "-D%s=OFF" % optname | ||||
|             if option not in spack_options: | ||||
|                 spack_options.append(option) | ||||
| 
 | ||||
|     # Check that we haven't asked for a GPU architecture that | ||||
|     # the revision of kokkos does not support | ||||
|     conflicts('gpu_arch=Volta70', when='@:2.5.99') | ||||
|     conflicts('gpu_arch=Volta72', when='@:2.5.99') | ||||
|     def setup_dependent_package(self, module, dependent_spec): | ||||
|         try: | ||||
|             self.spec.kokkos_cxx = self.spec["kokkos-nvcc-wrapper"].kokkos_cxx | ||||
|         except Exception: | ||||
|             self.spec.kokkos_cxx = spack_cxx | ||||
| 
 | ||||
|     # conflicts on kokkos version and cuda enabled | ||||
|     # see kokkos issue #1296 | ||||
|     # https://github.com/kokkos/kokkos/issues/1296 | ||||
|     conflicts('+cuda', when='@2.5.00:2.7.00', | ||||
|               msg='Kokkos build system has issue (#1296) when CUDA enabled' | ||||
|               ' in version 2.5.00 through 2.7.00.') | ||||
|     def cmake_args(self): | ||||
|         spec = self.spec | ||||
|         options = [] | ||||
| 
 | ||||
|     # Specify that v1.x is required as v2.x has API changes | ||||
|     depends_on('hwloc@:1') | ||||
|     depends_on('qthreads', when='+qthreads') | ||||
|     depends_on('cuda', when='+cuda') | ||||
|         isdiy = "+diy" in spec | ||||
|         if isdiy: | ||||
|             options.append("-DSpack_WORKAROUND=On") | ||||
| 
 | ||||
|     # generate_makefile.bash calls cmake | ||||
|     depends_on('cmake@3.10:', type='build') | ||||
|         spack_microarches = [] | ||||
|         if "+cuda" in spec: | ||||
|             # this is a list | ||||
|             for cuda_arch in spec.variants["cuda_arch"].value: | ||||
|                 if not cuda_arch == "none": | ||||
|                     kokkos_arch_name = self.spack_cuda_arch_map[cuda_arch] | ||||
|                     spack_microarches.append(kokkos_arch_name) | ||||
|         kokkos_microarch_name = self.spack_micro_arch_map[spec.target.name] | ||||
|         if kokkos_microarch_name: | ||||
|             spack_microarches.append(kokkos_microarch_name) | ||||
| 
 | ||||
|     def install(self, spec, prefix): | ||||
|         generate = which(join_path(self.stage.source_path, | ||||
|                                    'generate_makefile.bash')) | ||||
|         with working_dir('build', create=True): | ||||
|             g_args = [ | ||||
|                 '--prefix=%s' % prefix, | ||||
|                 '--with-hwloc=%s' % spec['hwloc'].prefix, | ||||
|             ] | ||||
|             arch_args = [] | ||||
|             kokkos_options_args = [] | ||||
|             cuda_options_args = [] | ||||
|         for arch in amd_gpu_arches: | ||||
|             keyval = "amd_gpu_arch=%s" % arch | ||||
|             if keyval in spec: | ||||
|                 spack_microarches.append(arch) | ||||
| 
 | ||||
|             # PIC | ||||
|             if '+pic' in spec: | ||||
|                 g_args.append('--cxxflags=-fPIC') | ||||
|         for arch in spack_microarches: | ||||
|             options.append("-DKokkos_ARCH_%s=ON" % arch.upper()) | ||||
| 
 | ||||
|             # C++ standard | ||||
|             cxxstandard = spec.variants['cxxstd'].value | ||||
|             if cxxstandard != 'none': | ||||
|                 g_args.append('--cxxstandard=%s' % cxxstandard) | ||||
|         self.append_args("ENABLE", self.devices_values, options) | ||||
|         self.append_args("ENABLE", self.options_values, options) | ||||
|         self.append_args("ENABLE", self.tpls_values, options) | ||||
|         self.append_args("ARCH",   self.arch_values, options) | ||||
| 
 | ||||
|             # Build Debug | ||||
|             if '+debug' in spec: | ||||
|                 g_args.append('--debug') | ||||
|         for tpl in self.tpls_values: | ||||
|             var = "+%s" % tpl | ||||
|             if var in self.spec: | ||||
|                 options.append("-D%s_DIR=%s" % (tpl, spec[tpl].prefix)) | ||||
| 
 | ||||
|             # Backends | ||||
|             if '+serial' in spec: | ||||
|                 g_args.append('--with-serial') | ||||
|             if '+openmp' in spec: | ||||
|                 g_args.append('--with-openmp') | ||||
|             if '+pthreads' in spec: | ||||
|                 g_args.append('--with-pthread') | ||||
|             if '+qthreads' in spec: | ||||
|                 g_args.append('--with-qthreads=%s' % spec['qthreads'].prefix) | ||||
|             if '+cuda' in spec: | ||||
|                 g_args.append('--with-cuda=%s' % spec['cuda'].prefix) | ||||
|             # Host architectures | ||||
|             host_arch = spec.variants['host_arch'].value | ||||
|             # GPU architectures | ||||
|             gpu_arch  = spec.variants['gpu_arch'].value | ||||
|             if host_arch != 'none': | ||||
|                 arch_args.append(host_arch) | ||||
|             if gpu_arch != 'none': | ||||
|                 arch_args.append(gpu_arch) | ||||
|             # Combined architecture flags | ||||
|             if arch_args: | ||||
|                 g_args.append('--arch={0}'.format(','.join(arch_args))) | ||||
|         # we do not need the compiler wrapper from Spack | ||||
|         # set the compiler explicitly (may be Spack wrapper or nvcc-wrapper) | ||||
|         try: | ||||
|             options.append("-DCMAKE_CXX_COMPILER=%s" % | ||||
|                            self.spec["kokkos-nvcc-wrapper"].kokkos_cxx) | ||||
|         except Exception: | ||||
|             options.append("-DCMAKE_CXX_COMPILER=%s" % spack_cxx) | ||||
| 
 | ||||
|             # CUDA options | ||||
|             if '+force_uvm' in spec: | ||||
|                 cuda_options_args.append('force_uvm') | ||||
|             if '+use_ldg' in spec: | ||||
|                 cuda_options_args.append('use_ldg') | ||||
|             if '+rdc' in spec: | ||||
|                 cuda_options_args.append('rdc') | ||||
|             if '+enable_lambda' in spec: | ||||
|                 cuda_options_args.append('enable_lambda') | ||||
|             if cuda_options_args: | ||||
|                 g_args.append('--with-cuda-options={0}' | ||||
|                               .format(','.join(cuda_options_args))) | ||||
|         # Set the C++ standard to use | ||||
|         options.append("-DKokkos_CXX_STANDARD=%s" % | ||||
|                        self.spec.variants["std"].value) | ||||
| 
 | ||||
|             # Kokkos options | ||||
|             if '+aggressive_vectorization' in spec: | ||||
|                 kokkos_options_args.append('aggressive_vectorization') | ||||
|             if '+disable_profiling' in spec: | ||||
|                 kokkos_options_args.append('disable_profiling') | ||||
|             if '+disable_dualview_modify_check' in spec: | ||||
|                 kokkos_options_args.append('disable_dualview_modify_check') | ||||
|             if '+enable_profile_load_print' in spec: | ||||
|                 kokkos_options_args.append('enable_profile_load_print') | ||||
|             if '+compiler_warnings' in spec: | ||||
|                 kokkos_options_args.append('compiler_warnings') | ||||
|             if '+disable_deprecated_code' in spec: | ||||
|                 kokkos_options_args.append('disable_deprecated_code') | ||||
|             if '+enable_eti' in spec: | ||||
|                 kokkos_options_args.append('enable_eti') | ||||
|             if kokkos_options_args: | ||||
|                 g_args.append('--with-options={0}' | ||||
|                               .format(','.join(kokkos_options_args))) | ||||
| 
 | ||||
|             generate(*g_args) | ||||
|             make() | ||||
|             make('install') | ||||
|         return options | ||||
|   | ||||
| @@ -106,7 +106,7 @@ def url_for_version(self, version): | ||||
|     depends_on('jpeg', when='+jpeg') | ||||
|     depends_on('libpng', when='+png') | ||||
|     depends_on('ffmpeg', when='+ffmpeg') | ||||
|     depends_on('kokkos', when='+kokkos') | ||||
|     depends_on('kokkos-legacy', when='+kokkos') | ||||
| 
 | ||||
|     conflicts('+cuda', when='+opencl') | ||||
|     conflicts('+body', when='+poems@:20180628') | ||||
|   | ||||
| @@ -19,7 +19,7 @@ class Miniaero(MakefilePackage): | ||||
| 
 | ||||
|     version('2016-11-11', commit='f46d135479a5be19ec5d146ccaf0e581aeff4596') | ||||
| 
 | ||||
|     depends_on('kokkos') | ||||
|     depends_on('kokkos-legacy') | ||||
| 
 | ||||
|     @property | ||||
|     def build_targets(self): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jeremy
					Jeremy