File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -76,8 +76,12 @@ def build_cmake(self, ext: CMakeExtension):
7676 cmake_args += ["-DRUNTIME_ENVIRONMENT=maca" ]
7777 cmake_args += ["-DBUILD_UCM_SPARSE=OFF" ]
7878 case _:
79- # default ascend
80- cmake_args += ["-DRUNTIME_ENVIRONMENT=ascend" ]
79+ import torch
80+
81+ if hasattr (torch , "cuda" ) and torch .cuda .is_available ():
82+ cmake_args += ["-DRUNTIME_ENVIRONMENT=cuda" ]
83+ else :
84+ cmake_args += ["-DRUNTIME_ENVIRONMENT=ascend" ]
8185
8286 subprocess .check_call (
8387 ["cmake" , * cmake_args , ext .cmake_file_path ], cwd = build_dir
@@ -103,4 +107,5 @@ def build_cmake(self, ext: CMakeExtension):
103107 ext_modules = [CMakeExtension (name = "ucm" , source_dir = ROOT_DIR )],
104108 cmdclass = {"build_ext" : CMakeBuild },
105109 zip_safe = False ,
110+ include_package_data = False ,
106111)
You can’t perform that action at this time.
0 commit comments