hip: setup run environments (#19637)

* hip: rocminfo is a runtime requirement

* hip: +setup_run_environment, +setup_dependent_run_environment

* hip: run environment: get lib dir using libs.directories[0], not prefix.lib

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
This commit is contained in:
eugeneswalker 2020-11-01 19:52:06 -08:00 committed by GitHub
parent a80d221bfa
commit b2d6c63421
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,7 @@ class Hip(CMakePackage):
depends_on('comgr@' + ver, type=('build', 'link', 'run'), when='@' + ver)
depends_on('llvm-amdgpu@' + ver, type='build', when='@' + ver)
depends_on('rocm-device-libs@' + ver, type=('build', 'link', 'run'), when='@' + ver)
depends_on('rocminfo@' + ver, type='build', when='@' + ver)
depends_on('rocminfo@' + ver, type=('build', 'run'), when='@' + ver)
# Notice: most likely this will only be a hard dependency on 3.7.0
depends_on('numactl', when='@3.7.0:')
@ -48,6 +48,19 @@ class Hip(CMakePackage):
# See https://github.com/ROCm-Developer-Tools/HIP/pull/2141
patch('0002-Fix-detection-of-HIP_CLANG_ROOT.patch', when='@3.5.0:')
def setup_run_environment(self, env):
env.set('ROCM_PATH', '')
env.set('HIP_COMPILER', 'clang')
env.set('HIP_PLATFORM', 'hcc')
env.set('HIP_CLANG_PATH', self.spec['llvm-amdgpu'].prefix.bin)
env.set('HSA_PATH', self.spec['hsa-rocr-dev'].prefix)
env.set('ROCMINFO_PATH', self.spec['rocminfo'].prefix)
env.set('DEVICE_LIB_PATH',
self.spec['rocm-device-libs'].libs.directories[0])
def setup_dependent_run_environment(self, env, dependent_spec):
self.setup_run_environment(env)
def get_rocm_prefix_info(self):
# External packages in Spack do not currently contain dependency
# information. External installations of hip therefore must compute