Skip to content

Commit

Permalink
clean it up
Browse files Browse the repository at this point in the history
  • Loading branch information
icfaust committed Jan 13, 2025
1 parent 5066140 commit fd8a83d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,20 @@ def get_onedal_py_libs():


class parallel_build_ext(_build_ext):
def finalize_options(self):
# override setuptools.build finalize_options
# to set parallel execution to n_threads
super().finalize_options()
if self.parallel is None:
self.parallel = n_threads

def build_extension(self, ext):
# monkeypatch a mulitprocess pool to multithread daal4py compilation
if self.parallel is None or self.parallel == 1:
return super().build_extension(ext)

try:
p = Pool(n_threads)
p = Pool(self.parallel)
base_compile = self.compiler.compile

def parallel_compile(sources, **kwargs):
Expand Down

0 comments on commit fd8a83d

Please sign in to comment.