Unverified Commit 95797c8d authored by Jeff Daily's avatar Jeff Daily Committed by GitHub
Browse files

Merge pull request #50 from ROCmSoftwarePlatform/numeric_torch_version_check

Make torch version check numeric
parents 107f1ff5 799785ab
...@@ -20,9 +20,13 @@ def get_cuda_bare_metal_version(cuda_dir): ...@@ -20,9 +20,13 @@ def get_cuda_bare_metal_version(cuda_dir):
return raw_output, bare_metal_major, bare_metal_minor return raw_output, bare_metal_major, bare_metal_minor
print("\n\ntorch.__version__ = {}\n\n".format(torch.__version__))
TORCH_MAJOR = int(torch.__version__.split('.')[0])
TORCH_MINOR = int(torch.__version__.split('.')[1])
def check_if_rocm_pytorch(): def check_if_rocm_pytorch():
is_rocm_pytorch = False is_rocm_pytorch = False
if torch.__version__ >= '1.5': if TORCH_MAJOR > 1 or (TORCH_MAJOR == 1 and TORCH_MINOR >= 5):
from torch.utils.cpp_extension import ROCM_HOME from torch.utils.cpp_extension import ROCM_HOME
is_rocm_pytorch = True if ((torch.version.hip is not None) and (ROCM_HOME is not None)) else False is_rocm_pytorch = True if ((torch.version.hip is not None) and (ROCM_HOME is not None)) else False
...@@ -53,10 +57,6 @@ elif not torch.cuda.is_available() and IS_ROCM_PYTORCH: ...@@ -53,10 +57,6 @@ elif not torch.cuda.is_available() and IS_ROCM_PYTORCH:
'By default, Apex will cross-compile for the same gfx targets\n' 'By default, Apex will cross-compile for the same gfx targets\n'
'used by default in ROCm PyTorch\n') 'used by default in ROCm PyTorch\n')
print("\n\ntorch.__version__ = {}\n\n".format(torch.__version__))
TORCH_MAJOR = int(torch.__version__.split('.')[0])
TORCH_MINOR = int(torch.__version__.split('.')[1])
if TORCH_MAJOR == 0 and TORCH_MINOR < 4: if TORCH_MAJOR == 0 and TORCH_MINOR < 4:
raise RuntimeError("Apex requires Pytorch 0.4 or newer.\n" + raise RuntimeError("Apex requires Pytorch 0.4 or newer.\n" +
"The latest stable release can be obtained from https://pytorch.org/") "The latest stable release can be obtained from https://pytorch.org/")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment