Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
3492859b
Unverified
Commit
3492859b
authored
Mar 27, 2024
by
youkaichao
Committed by
GitHub
Mar 28, 2024
Browse files
[CI/Build] update default number of jobs and nvcc threads to avoid overloading the system (#3675)
parent
098e1776
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
setup.py
setup.py
+15
-5
No files found.
setup.py
View file @
3492859b
...
@@ -56,6 +56,8 @@ class cmake_build_ext(build_ext):
...
@@ -56,6 +56,8 @@ class cmake_build_ext(build_ext):
# Determine number of compilation jobs and optionally nvcc compile threads.
# Determine number of compilation jobs and optionally nvcc compile threads.
#
#
def
compute_num_jobs
(
self
):
def
compute_num_jobs
(
self
):
# `num_jobs` is either the value of the MAX_JOBS environment variable
# (if defined) or the number of CPUs available.
num_jobs
=
os
.
environ
.
get
(
"MAX_JOBS"
,
None
)
num_jobs
=
os
.
environ
.
get
(
"MAX_JOBS"
,
None
)
if
num_jobs
is
not
None
:
if
num_jobs
is
not
None
:
num_jobs
=
int
(
num_jobs
)
num_jobs
=
int
(
num_jobs
)
...
@@ -69,11 +71,19 @@ class cmake_build_ext(build_ext):
...
@@ -69,11 +71,19 @@ class cmake_build_ext(build_ext):
num_jobs
=
os
.
cpu_count
()
num_jobs
=
os
.
cpu_count
()
nvcc_threads
=
None
nvcc_threads
=
None
if
_is_cuda
():
if
_is_cuda
()
and
get_nvcc_cuda_version
()
>=
Version
(
"11.2"
):
nvcc_cuda_version
=
get_nvcc_cuda_version
()
# `nvcc_threads` is either the value of the NVCC_THREADS
if
nvcc_cuda_version
>=
Version
(
"11.2"
):
# environment variable (if defined) or 1.
nvcc_threads
=
int
(
os
.
getenv
(
"NVCC_THREADS"
,
8
))
# when it is set, we reduce `num_jobs` to avoid
num_jobs
=
max
(
1
,
round
(
num_jobs
/
(
nvcc_threads
/
4
)))
# overloading the system.
nvcc_threads
=
os
.
getenv
(
"NVCC_THREADS"
,
None
)
if
nvcc_threads
is
not
None
:
nvcc_threads
=
int
(
nvcc_threads
)
logger
.
info
(
f
"Using NVCC_THREADS=
{
nvcc_threads
}
as the number"
" of nvcc threads."
)
else
:
nvcc_threads
=
1
num_jobs
=
max
(
1
,
num_jobs
//
nvcc_threads
)
return
num_jobs
,
nvcc_threads
return
num_jobs
,
nvcc_threads
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment