rocalution: add spack build test (#31415)

- rocprim is a header-only library; its amdgpu_target variant is only
  meaningful for its client executables, not the library itself
- comgr and llvm-amdgpu are merely indirect dependencies (via hip)
This commit is contained in:
Cory Bloor 2022-07-05 02:02:46 -06:00 committed by GitHub
parent 08fa0c9d46
commit a183b343b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,16 +53,13 @@ class Rocalution(CMakePackage):
'4.2.0', '4.3.0', '4.3.1', '4.5.0', '4.5.2', '5.0.0', '4.2.0', '4.3.0', '4.3.1', '4.5.0', '4.5.2', '5.0.0',
'5.0.2', '5.1.0', '5.1.3']: '5.0.2', '5.1.0', '5.1.3']:
depends_on('hip@' + ver, when='@' + ver) depends_on('hip@' + ver, when='@' + ver)
depends_on('rocprim@' + ver, when='@' + ver)
for tgt in itertools.chain(['auto'], amdgpu_targets): for tgt in itertools.chain(['auto'], amdgpu_targets):
rocblas_tgt = tgt if tgt != 'gfx900:xnack-' else 'gfx900' rocblas_tgt = tgt if tgt != 'gfx900:xnack-' else 'gfx900'
depends_on('rocblas@{0} amdgpu_target={1}'.format(ver, rocblas_tgt), depends_on('rocblas@{0} amdgpu_target={1}'.format(ver, rocblas_tgt),
when='@{0} amdgpu_target={1}'.format(ver, tgt)) when='@{0} amdgpu_target={1}'.format(ver, tgt))
depends_on('rocprim@{0} amdgpu_target={1}'.format(ver, tgt),
when='@{0} amdgpu_target={1}'.format(ver, tgt))
depends_on('rocsparse@{0} amdgpu_target={1}'.format(ver, tgt), depends_on('rocsparse@{0} amdgpu_target={1}'.format(ver, tgt),
when='@{0} amdgpu_target={1}'.format(ver, tgt)) when='@{0} amdgpu_target={1}'.format(ver, tgt))
depends_on('comgr@' + ver, when='@' + ver)
depends_on('llvm-amdgpu@' + ver, type='build', when='@' + ver)
depends_on('rocm-cmake@%s:' % ver, type='build', when='@' + ver) depends_on('rocm-cmake@%s:' % ver, type='build', when='@' + ver)
for ver in ['3.9.0', '3.10.0', '4.0.0', '4.1.0', '4.2.0', for ver in ['3.9.0', '3.10.0', '4.0.0', '4.1.0', '4.2.0',
@ -72,6 +69,12 @@ class Rocalution(CMakePackage):
depends_on('rocrand@{0} amdgpu_target={1}'.format(ver, tgt), depends_on('rocrand@{0} amdgpu_target={1}'.format(ver, tgt),
when='@{0} amdgpu_target={1}'.format(ver, tgt)) when='@{0} amdgpu_target={1}'.format(ver, tgt))
depends_on('googletest@1.10.0:', type='test')
def check(self):
exe = join_path(self.build_directory, 'clients', 'staging', 'rocalution-test')
self.run_test(exe)
def setup_build_environment(self, env): def setup_build_environment(self, env):
env.set('CXX', self.spec['hip'].hipcc) env.set('CXX', self.spec['hip'].hipcc)
@ -102,7 +105,8 @@ def cmake_args(self):
self.define('CMAKE_MODULE_PATH', self.spec['hip'].prefix.cmake), self.define('CMAKE_MODULE_PATH', self.spec['hip'].prefix.cmake),
self.define('SUPPORT_HIP', 'ON'), self.define('SUPPORT_HIP', 'ON'),
self.define('SUPPORT_MPI', 'OFF'), self.define('SUPPORT_MPI', 'OFF'),
self.define('BUILD_CLIENTS_SAMPLES', 'OFF') self.define('BUILD_CLIENTS_SAMPLES', 'OFF'),
self.define('BUILD_CLIENTS_TESTS', self.run_tests),
] ]
if 'auto' not in self.spec.variants['amdgpu_target']: if 'auto' not in self.spec.variants['amdgpu_target']: