Skip to content

Commit

Permalink
[Feats]: Add ROCm info when collecting env (open-mmlab#633)
Browse files Browse the repository at this point in the history
* Add ROCm info when collecting env

* minor fix
  • Loading branch information
zhouzaida authored and C1rN09 committed Nov 1, 2022
1 parent 6aa1f9c commit 7ecf40c
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions mmengine/utils/dl_utils/collect_env.py
Expand Up @@ -67,15 +67,27 @@ def collect_env():
env_info['CUDA_HOME'] = CUDA_HOME

if CUDA_HOME is not None and osp.isdir(CUDA_HOME):
try:
nvcc = osp.join(CUDA_HOME, 'bin/nvcc')
nvcc = subprocess.check_output(f'"{nvcc}" -V', shell=True)
nvcc = nvcc.decode('utf-8').strip()
release = nvcc.rfind('Cuda compilation tools')
build = nvcc.rfind('Build ')
nvcc = nvcc[release:build].strip()
except subprocess.SubprocessError:
nvcc = 'Not Available'
if CUDA_HOME == '/opt/rocm':
try:
nvcc = osp.join(CUDA_HOME, 'hip/bin/hipcc')
nvcc = subprocess.check_output(
f'"{nvcc}" --version', shell=True)
nvcc = nvcc.decode('utf-8').strip()
release = nvcc.rfind('HIP version:')
build = nvcc.rfind('')
nvcc = nvcc[release:build].strip()
except subprocess.SubprocessError:
nvcc = 'Not Available'
else:
try:
nvcc = osp.join(CUDA_HOME, 'bin/nvcc')
nvcc = subprocess.check_output(f'"{nvcc}" -V', shell=True)
nvcc = nvcc.decode('utf-8').strip()
release = nvcc.rfind('Cuda compilation tools')
build = nvcc.rfind('Build ')
nvcc = nvcc[release:build].strip()
except subprocess.SubprocessError:
nvcc = 'Not Available'
env_info['NVCC'] = nvcc

try:
Expand Down

0 comments on commit 7ecf40c

Please sign in to comment.