Add torch.version.hip from cmake (#29815)

Summary:
This adds the HIP_VERSION cmake variable as hip_version.
This should help detecting ROCm, e.g. in https://github.com/pytorch/pytorch/issues/22091.

To parallel CUDA, hip_version is a string.
An alternative variant might be to split by '.' and only take the first two parts.
The method suffers a bit from ROCm not being as monolithic as CUDA.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29815

Differential Revision: D18532267

Pulled By: bddppq

fbshipit-source-id: 1bde4ad0cfacc47bfd1c0945e130921d8575a5bf
This commit is contained in:
Thomas Viehmann 2019-11-15 12:01:21 -08:00 committed by Facebook Github Bot
parent 69e343f2cc
commit 7889e1e3f9

View File

@ -325,6 +325,7 @@ def build_deps():
cmake_cache_vars = defaultdict(lambda: None, cmake.get_cmake_cache_variables())
f.write("cuda = {}\n".format(repr(cmake_cache_vars['CUDA_VERSION'])))
f.write("git_version = {}\n".format(repr(sha)))
f.write("hip = {}\n".format(repr(cmake_cache_vars['HIP_VERSION'])))
if CMAKE_ONLY:
report('Finished running cmake. Run "ccmake build" or '