"docker/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "ada3786c5761136415915066e3de9c7207b58159"
Unverified Commit d81cb26d authored by Seunghwan Hong's avatar Seunghwan Hong Committed by GitHub
Browse files

Fix setup.py for cpu-only environment installation (#538)



* Add guard to not using `torch.version.cuda` above no-CUDA environment.
* Fix several typos on setup.py.
Signed-off-by: default avatarSeunghwan Hong <seunghwan@scatterlab.co.kr>
Co-authored-by: default avatarJeff Rasley <jerasley@microsoft.com>
parent dce054db
...@@ -58,9 +58,9 @@ TORCH_MAJOR = torch.__version__.split('.')[0] ...@@ -58,9 +58,9 @@ TORCH_MAJOR = torch.__version__.split('.')[0]
TORCH_MINOR = torch.__version__.split('.')[1] TORCH_MINOR = torch.__version__.split('.')[1]
if not torch.cuda.is_available(): if not torch.cuda.is_available():
# Fix to allow docker buils, similar to https://github.com/NVIDIA/apex/issues/486 # Fix to allow docker builds, similar to https://github.com/NVIDIA/apex/issues/486
print( print(
"[WARNING] Torch did not find cuda available, if cross-compling or running with cpu only " "[WARNING] Torch did not find cuda available, if cross-compiling or running with cpu only "
"you can ignore this message. Adding compute capability for Pascal, Volta, and Turing " "you can ignore this message. Adding compute capability for Pascal, Volta, and Turing "
"(compute capabilities 6.0, 6.1, 6.2)") "(compute capabilities 6.0, 6.1, 6.2)")
if os.environ.get("TORCH_CUDA_ARCH_LIST", None) is None: if os.environ.get("TORCH_CUDA_ARCH_LIST", None) is None:
...@@ -144,7 +144,10 @@ else: ...@@ -144,7 +144,10 @@ else:
version_str += f'+{git_hash}' version_str += f'+{git_hash}'
torch_version = ".".join([TORCH_MAJOR, TORCH_MINOR]) torch_version = ".".join([TORCH_MAJOR, TORCH_MINOR])
cuda_version = ".".join(torch.version.cuda.split('.')[:2]) # Set cuda_version to 0.0 if cpu-only
cuda_version = "0.0"
if torch.version.cuda is not None:
cuda_version = ".".join(torch.version.cuda.split('.')[:2])
torch_info = {"version": torch_version, "cuda_version": cuda_version} torch_info = {"version": torch_version, "cuda_version": cuda_version}
print(f"version={version_str}, git_hash={git_hash}, git_branch={git_branch}") print(f"version={version_str}, git_hash={git_hash}, git_branch={git_branch}")
......
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