You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add configuration for setting the degree of compilation parallelism. #51
Maybe the first question is how many cppimport will use by default. Since I'm running it on a machine with a small memory, sometimes I can see the compilation goes out of memory.
This would be quite easy to modify. I have two proposals for how we could do this:
Change the parallelism flag to instead take a parameter indicating the number of threads to use. Ideally, this would be done in a way that maintains backward compatibility with the current True/False behavior. So, perhaps, True == multiprocessing.cpu_count, False = 1, and then any integer uses that number of threads.
A slightly different, but similar proposal would be to just add another configuration field that contains the number of threads to use.
Some locations in the code that would be useful for this:
changed the title [-]Is there any option to limit the threads cppimport uses for compilation[/-][+]Add configuration for setting the degree of compilation parallelism.[/+]on Jan 7, 2021
Activity
tbenthompson commentedon Dec 18, 2020
Currently, parallelism is off by default. If you turn parallelism on, the number of cores is equal to
multiprocessing.cpu_count().This would be quite easy to modify. I have two proposals for how we could do this:
Some locations in the code that would be useful for this:
cppimport/cppimport/templating.py
Line 46 in 00c40d9
cppimport/cppimport/build_module.py
Line 57 in 00c40d9
cppimport/cppimport/build_module.py
Line 150 in 00c40d9
I would be excited to accept a pull request if you have the time to implement this!
[-]Is there any option to limit the threads cppimport uses for compilation[/-][+]Add configuration for setting the degree of compilation parallelism.[/+]tbenthompson commentedon Jan 7, 2021
Reopened because this is something I want to do eventually.