Skip to content

Commit f134af6

Browse files
authored
Support to set nvcc threads by environment variable NVCC_THREADS (#24)
1 parent 129c488 commit f134af6

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

setup.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ def check_if_cuda_home_none(global_option: str) -> None:
8181
)
8282

8383

84-
def append_nvcc_threads(nvcc_extra_args):
85-
return nvcc_extra_args + ["--threads", "4"]
86-
84+
def append_nvcc_threads():
85+
return ["--threads", os.getenv("NVCC_THREADS") or "4"]
8786

8887
cmdclass = {}
8988
ext_modules = []
@@ -132,7 +131,7 @@ def append_nvcc_threads(nvcc_extra_args):
132131
],
133132
extra_compile_args={
134133
"cxx": ["-O3"],
135-
"nvcc": append_nvcc_threads(
134+
"nvcc":
136135
[
137136
"-O3",
138137
"-U__CUDA_NO_HALF_OPERATORS__",
@@ -147,8 +146,8 @@ def append_nvcc_threads(nvcc_extra_args):
147146
"--ptxas-options=-v",
148147
"-lineinfo",
149148
]
150-
+ cc_flag
151-
),
149+
+ append_nvcc_threads()
150+
+ cc_flag,
152151
},
153152
include_dirs=[this_dir],
154153
)

0 commit comments

Comments
 (0)