Skip to content

Commit dd2373f

Browse files
author
Dane Springmeyer
committed
remove parallel compilation hack: this is not ready for primetime
1 parent 8f5766f commit dd2373f

1 file changed

Lines changed: 0 additions & 24 deletions

File tree

setup.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,5 @@
11
#! /usr/bin/env python
22

3-
# monkey-patch for parallel compilation
4-
def parallelCCompile(self, sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=None):
5-
# those lines are copied from distutils.ccompiler.CCompiler directly
6-
macros, objects, extra_postargs, pp_opts, build = self._setup_compile(output_dir, macros, include_dirs, sources, depends, extra_postargs)
7-
cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
8-
# parallel code
9-
import multiprocessing
10-
import multiprocessing.pool
11-
N=multiprocessing.cpu_count() # number of parallel compilations
12-
def _single_compile(obj):
13-
try: src, ext = build[obj]
14-
except KeyError: return
15-
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
16-
# convert to list, imap is evaluated on-demand
17-
try:
18-
pool = multiprocessing.pool.ThreadPool(N)
19-
list(pool.imap(_single_compile,objects))
20-
except KeyboardInterrupt as e:
21-
print "Caught KeyboardInterrupt, terminating workers"
22-
pool.terminate()
23-
raise e
24-
return objects
25-
import distutils.ccompiler
26-
distutils.ccompiler.CCompiler.compile=parallelCCompile
273
from distutils import sysconfig
284
from setuptools import setup, Extension
295
import os

0 commit comments

Comments
 (0)