[misc] op_builder/builder.py (#3593)

Optimization Code
The source code has not been modified, only a few spelling errors in the comments have been changed
This commit is contained in:
digger-yu 2023-04-18 19:14:59 +08:00 committed by GitHub
parent 5a79cffdfd
commit d96567bb5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,7 +78,7 @@ class Builder(ABC):
@abstractmethod @abstractmethod
def include_dirs(self) -> List[str]: def include_dirs(self) -> List[str]:
""" """
This function should return a list of inlcude files for extensions. This function should return a list of include files for extensions.
""" """
pass pass
@ -127,13 +127,13 @@ class Builder(ABC):
if CUDA_HOME is None: if CUDA_HOME is None:
raise RuntimeError( raise RuntimeError(
"CUDA_HOME is not found. You need to export CUDA_HOME environment vairable or install CUDA Toolkit first in order to build CUDA extensions" "CUDA_HOME is not found. You need to export CUDA_HOME environment variable or install CUDA Toolkit first in order to build CUDA extensions"
) )
# make sure CUDA is available for compilation during # make sure CUDA is available for compilation during
cuda_available = check_cuda_availability() cuda_available = check_cuda_availability()
if not cuda_available: if not cuda_available:
raise RuntimeError("CUDA is not available on your system as torch.cuda.is_avaible() returns False.") raise RuntimeError("CUDA is not available on your system as torch.cuda.is_available() returns False.")
# make sure system CUDA and pytorch CUDA match, an error will raised inside the function if not # make sure system CUDA and pytorch CUDA match, an error will raised inside the function if not
check_system_pytorch_cuda_match(CUDA_HOME) check_system_pytorch_cuda_match(CUDA_HOME)
@ -161,7 +161,7 @@ class Builder(ABC):
op_module = self.import_op() op_module = self.import_op()
if verbose: if verbose:
print_rank_0( print_rank_0(
f"[extension] OP {self.prebuilt_import_path} has been compileed ahead of time, skip building.") f"[extension] OP {self.prebuilt_import_path} has been compiled ahead of time, skip building.")
except ImportError: except ImportError:
# check environment # check environment
self.check_runtime_build_environment() self.check_runtime_build_environment()