Unverified Commit ca9ab120 authored by Jeff Rasley's avatar Jeff Rasley Committed by GitHub
Browse files

ds_report bug fix on cpu and guard torch import in setup.py (#524)

* on cpu box error gracefully if cuda home doesn't exist

* gaurd against torch import issue

* fix sytax error

* fix import
parent 31f46fee
...@@ -62,6 +62,8 @@ def ninja_installed(): ...@@ -62,6 +62,8 @@ def ninja_installed():
def nvcc_version(): def nvcc_version():
import torch.utils.cpp_extension import torch.utils.cpp_extension
cuda_home = torch.utils.cpp_extension.CUDA_HOME cuda_home = torch.utils.cpp_extension.CUDA_HOME
if cuda_home is None:
return f"{RED} [FAIL] cannot find CUDA_HOME via torch.utils.cpp_extension.CUDA_HOME={torch.utils.cpp_extension.CUDA_HOME} {END}"
try: try:
output = subprocess.check_output([cuda_home + "/bin/nvcc", output = subprocess.check_output([cuda_home + "/bin/nvcc",
"-V"], "-V"],
......
...@@ -9,12 +9,17 @@ The wheel will be located at: dist/*.whl ...@@ -9,12 +9,17 @@ The wheel will be located at: dist/*.whl
""" """
import os import os
import torch
import shutil import shutil
import subprocess import subprocess
import warnings import warnings
from setuptools import setup, find_packages from setuptools import setup, find_packages
from torch.utils.cpp_extension import CUDAExtension, BuildExtension, CppExtension
try:
import torch
from torch.utils.cpp_extension import BuildExtension
except ImportError:
raise ImportError('Unable to import torch, please visit https://pytorch.org/ '
'to see how to properly install torch on your system.')
import op_builder import op_builder
......
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