diff options
author | Umar Arshad <umar@arrayfire.com> | 2022-04-13 12:31:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-13 09:31:40 -0700 |
commit | 586df30f9ab017e906e55570704bf14f7ceec9ba (patch) | |
tree | 429317af97c188e33fc0c5d3ede7ebfb2f68683a | |
parent | 803900ddc5bb0f7773328147d7312f5baed4f912 (diff) | |
download | spack-586df30f9ab017e906e55570704bf14f7ceec9ba.tar.gz spack-586df30f9ab017e906e55570704bf14f7ceec9ba.tar.bz2 spack-586df30f9ab017e906e55570704bf14f7ceec9ba.tar.xz spack-586df30f9ab017e906e55570704bf14f7ceec9ba.zip |
ArrayFire: new version and update CUDA usage (#29988)
* Set CUDA architectures in ArrayFire based on cuda_arch
The cuda_arch flag was not recognized by the ArrayFire package and
therefore any setting was not respected. This commit adds the appropriate
cmake flags if cuda_arch is specified. If no cuda_arch is specified,
then the flag is set to "Auto" which checks the installed compute
architectures on the build system.
* ArrayFire only requires boost headers to build. Update version to 1.75
ArrayFire only requires boost headers at build time. This commit also
updates the version to 1.75 to avoid some errors in Boost Compute
* Disable tests in ArrayFire by default
* Add support for ArrayFire v3.8.1
* Add maintainer for ArrayFire package
* Remove test variant from ArrayFire. Use comprehensions
* Reduce boost requirement in ArrayFire
* Address cuda_arch suggestions
* Add commit hashes to Release versions of ArrayFire
* Fix style issues in ArrayFire package
-rw-r--r-- | var/spack/repos/builtin/packages/arrayfire/package.py | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/var/spack/repos/builtin/packages/arrayfire/package.py b/var/spack/repos/builtin/packages/arrayfire/package.py index 5d1a65428b..8827aa371d 100644 --- a/var/spack/repos/builtin/packages/arrayfire/package.py +++ b/var/spack/repos/builtin/packages/arrayfire/package.py @@ -4,7 +4,6 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * -from spack.pkg.builtin.boost import Boost class Arrayfire(CMakePackage, CudaPackage): @@ -14,22 +13,18 @@ class Arrayfire(CMakePackage, CudaPackage): homepage = "https://arrayfire.org/docs/index.htm" git = "https://github.com/arrayfire/arrayfire.git" + maintainers = ['umar456'] - version('master', submodules=True) - version('3.7.3', submodules=True, tag='v3.7.3') - version('3.7.2', submodules=True, tag='v3.7.2') - version('3.7.0', submodules=True, tag='v3.7.0') + version('master') + version('3.8.1', commit='823e8e399fe8c120c6ec7ec75f09e6106b3074ca', tag='v3.8.1') + version('3.7.3', commit='59ac7b980d1ae124aae914fb29cbf086c948954d', submodules=True, tag='v3.7.3') + version('3.7.2', commit='218dd2c99300e77496239ade76e94b0def65d032', submodules=True, tag='v3.7.2') + version('3.7.0', commit='fbea2aeb6f7f2d277dcb0ab425a77bb18ed22291', submodules=True, tag='v3.7.0') - variant('cuda', default=False, description='Enable Cuda backend') - variant('forge', default=False, description='Enable graphics library') + variant('forge', default=False, description='Enable graphics library') variant('opencl', default=False, description='Enable OpenCL backend') - depends_on('boost@1.65:') - - # TODO: replace this with an explicit list of components of Boost, - # for instance depends_on('boost +filesystem') - # See https://github.com/spack/spack/pull/22303 for reference - depends_on(Boost.with_default_variants) + depends_on('boost@1.70:') depends_on('fftw-api@3:') depends_on('blas') depends_on('cuda@7.5:', when='+cuda') @@ -42,6 +37,9 @@ class Arrayfire(CMakePackage, CudaPackage): depends_on('fontconfig', when='+forge') depends_on('glfw@3.1.4:', when='+forge') + conflicts('cuda_arch=none', when='+cuda', + msg='CUDA architecture is required') + @property def libs(self): query_parameters = self.spec.last_query.extra_parameters @@ -64,10 +62,28 @@ class Arrayfire(CMakePackage, CudaPackage): self.define_from_variant('AF_BUILD_CUDA', 'cuda'), self.define_from_variant('AF_BUILD_FORGE', 'forge'), self.define_from_variant('AF_BUILD_OPENCL', 'opencl'), + self.define('BUILD_TESTING', self.run_tests), ]) + + if '+cuda' in self.spec: + arch_list = ['{}.{}'.format(arch[:-1], arch[-1]) + for arch in self.spec.variants['cuda_arch'].value] + args.append(self.define('CUDA_architecture_build_targets', + arch_list)) + if '^mkl' in self.spec: - args.append('-DUSE_CPU_MKL=ON') + if self.version >= Version('3.8.0'): + args.append(self.define('AF_COMPUTE_LIBRARY', 'Intel-MKL')) + else: + args.append(self.define('USE_CPU_MKL', True)) + args.append(self.define('USE_OPENCL_MKL', True)) if '%intel' not in self.spec: - args.append('-DMKL_THREAD_LAYER=GNU OpenMP') + args.append(self.define('MKL_THREAD_LAYER', 'GNU OpenMP')) + else: + if self.version >= Version('3.8.0'): + args.append(self.define('AF_COMPUTE_LIBRARY', 'FFTW/LAPACK/BLAS')) + else: + args.append(self.define('USE_CPU_MKL', False)) + args.append(self.define('USE_OPENCL_MKL', False)) return args |