Skip to content

Commit 6834001

Browse files
committed
make cuda.core also support CUDA_PYTHON_PARALLEL_LEVEL
1 parent c4e806d commit 6834001

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

.github/workflows/build-wheel.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ jobs:
7878
CIBW_BUILD_VERBOSITY: 1
7979
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
8080
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair --namespace-pkg cuda -w {dest_dir} {wheel}"
81+
CIBW_ENVIRONMENT: >
82+
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
8183
with:
8284
package-dir: ./cuda_core/
8385
output-dir: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}

cuda_core/setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
from setuptools import Extension, setup
1010
from setuptools.command.build_ext import build_ext as _build_ext
1111

12+
13+
nthreads = int(os.environ.get("CUDA_PYTHON_PARALLEL_LEVEL", os.cpu_count() // 2))
14+
15+
1216
# It seems setuptools' wildcard support has problems for namespace packages,
1317
# so we explicitly spell out all Extension instances.
1418
root_module = "cuda.core.experimental"
@@ -33,7 +37,7 @@ def strip_prefix_suffix(filename):
3337

3438
class build_ext(_build_ext):
3539
def build_extensions(self):
36-
self.parallel = os.cpu_count() // 2
40+
self.parallel = nthreads
3741
super().build_extensions()
3842

3943

0 commit comments

Comments
 (0)