From a691e75af30a0b7d9a300c9fb70b12231a85f6d0 Mon Sep 17 00:00:00 2001 From: tcojean Date: Sun, 11 Oct 2020 04:08:58 +0200 Subject: Ginkgo: new version and HIP support (#18842) * Bump the Ginkgo version and add HIP support. * Add the HIP variant to Ginkgo. * Make HIP support work, check C++ compatibility. --- var/spack/repos/builtin/packages/ginkgo/package.py | 44 ++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/ginkgo/package.py b/var/spack/repos/builtin/packages/ginkgo/package.py index d0ee354256..f72fed7319 100644 --- a/var/spack/repos/builtin/packages/ginkgo/package.py +++ b/var/spack/repos/builtin/packages/ginkgo/package.py @@ -18,6 +18,7 @@ class Ginkgo(CMakePackage, CudaPackage): version('develop', branch='develop') version('master', branch='master') + version('1.3.0', commit='4678668c66f634169def81620a85c9a20b7cec78') # v1.3.0 version('1.2.0', commit='b4be2be961fd5db45c3d02b5e004d73550722e31') # v1.2.0 version('1.1.1', commit='08d2c5200d3c78015ac8a4fd488bafe1e4240cf5') # v1.1.1 version('1.1.0', commit='b9bec8225442b3eb2a85a870efa112ab767a17fb') # v1.1.0 @@ -30,15 +31,42 @@ class Ginkgo(CMakePackage, CudaPackage): variant('build_type', default='Release', description='The build type to build', values=('Debug', 'Release')) + variant('hip', default=False, description='Compile Ginkgo with HIP support') depends_on('cmake@3.9:', type='build') depends_on('cuda@9:', when='+cuda') + depends_on('hip', when='+hip') + depends_on('hipsparse', type="link", when='+hip') + depends_on('hipblas', type="link", when='+hip') + depends_on('rocrand', type="link", when='@develop+hip') + depends_on('rocthrust', type="build", when='+hip') + + # Somehow, these dependencies not propagated by the HIP stack? + depends_on('rocm-device-libs', type="link", when='+hip') + depends_on('comgr', type="link", when='+hip') + conflicts('%gcc@:5.2.9') + conflicts("+hip", when="@:1.1.1") + # The HIP packages from spack doen't seem to work well with CUDA + # backend for now, so disable HIP with CUDA backend. + conflicts("+cuda", when="+hip") def cmake_args(self): + # Check that the have the correct C++ standard is available + if self.spec.satisfies('@:1.2.0'): + try: + self.compiler.cxx11_flag + except UnsupportedCompilerFlag: + InstallError('Ginkgo requires a C++11-compliant C++ compiler') + else: + try: + self.compiler.cxx14_flag + except UnsupportedCompilerFlag: + InstallError('Ginkgo requires a C++14-compliant C++ compiler') + spec = self.spec - return [ + args = [ '-DGINKGO_BUILD_CUDA=%s' % ('ON' if '+cuda' in spec else 'OFF'), '-DGINKGO_BUILD_OMP=%s' % ('ON' if '+openmp' in spec else 'OFF'), '-DBUILD_SHARED_LIBS=%s' % ('ON' if '+shared' in spec else 'OFF'), @@ -46,8 +74,7 @@ class Ginkgo(CMakePackage, CudaPackage): 'ON' if '+full_optimizations' in spec else 'OFF'), '-DGINKGO_DEVEL_TOOLS=%s' % ( 'ON' if '+develtools' in spec else 'OFF'), - # Drop HIP support for now - '-DGINKGO_BUILD_HIP=OFF', + '-DGINKGO_BUILD_HIP=%s' % ('ON' if '+hip' in spec else 'OFF'), # As we are not exposing benchmarks, examples, tests nor doc # as part of the installation, disable building them altogether. '-DGINKGO_BUILD_BENCHMARKS=OFF', @@ -55,3 +82,14 @@ class Ginkgo(CMakePackage, CudaPackage): '-DGINKGO_BUILD_EXAMPLES=OFF', '-DGINKGO_BUILD_TESTS=OFF' ] + if '+hip' in spec: + args.append('-DHIP_PATH={0}'. format(spec['hip'].prefix)) + args.append('-DHIP_CLANG_PATH={0}/bin'. + format(spec['llvm-amdgpu'].prefix)) + args.append('-DHIP_CLANG_INCLUDE_PATH={0}/include'. + format(spec['llvm-amdgpu'].prefix)) + args.append('-DHIPSPARSE_PATH={0}'. + format(spec['hipsparse'].prefix)) + args.append('-DHIPBLAS_PATH={0}'. + format(spec['hipblas'].prefix)) + return args -- cgit v1.2.3-70-g09d2