File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 1
1
import os
2
2
3
+ from pathlib import Path
3
4
import re
4
5
from setuptools import setup
5
6
from pkg_resources import parse_version
8
9
import sys
9
10
import torch
10
11
from glob import glob
11
- from torch .utils .cpp_extension import BuildExtension , CUDAExtension
12
+ from torch .utils .cpp_extension import BuildExtension , CUDAExtension , CUDA_HOME
12
13
13
14
SCRIPT_DIR = os .path .dirname (os .path .realpath (__file__ ))
14
15
ROOT_DIR = os .path .dirname (os .path .dirname (SCRIPT_DIR ))
@@ -80,9 +81,14 @@ def find_cl_path():
80
81
cpp_standard = 14
81
82
82
83
# Get CUDA version and make sure the targeted compute capability is compatible
83
- if os .system ("nvcc --version" ) == 0 :
84
- nvcc_out = subprocess .check_output (["nvcc" , "--version" ]).decode ()
85
- cuda_version = re .search (r"release (\S+)," , nvcc_out )
84
+ nvcc_version_result = subprocess .run (
85
+ [str (Path (CUDA_HOME ) / "bin" / "nvcc" ), "--version" ],
86
+ text = True ,
87
+ check = False ,
88
+ stdout = subprocess .PIPE ,
89
+ )
90
+ if nvcc_version_result .returncode == 0 :
91
+ cuda_version = re .search (r"release (\S+)," , nvcc_version_result .stdout )
86
92
87
93
if cuda_version :
88
94
cuda_version = parse_version (cuda_version .group (1 ))
You can’t perform that action at this time.
0 commit comments