mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-06-19 04:02:17 +00:00
[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:
parent
5a79cffdfd
commit
d96567bb5d
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user