简体   繁体   中英

python joblib.Parallel vs Parallel-Python: parallelise over multiple cores of a single CPU?

I want to parallelize the execution of a for loop written in python-2.7 on the quadcore processor of my computer's CPU.

Shall I implement this with joblib.Parallel or with Parallel-Python?

I've seen joblib.Parallel being used more, but the first line of this part of its documentation worried me: it sets forked processes to work on "separate CPUs". Does that mean it can't do it on separate cores of the same CPU?

joblib versus Parallel-Python is primarily opinion-based which is defined as Off-Topic for Stackoverflow. But as for the other part of your question:

By CPU, I think they are referring to core.

import joblib
print joblib.cpu_count()

Gives 8 on my computer, which is exactly the number of cores I have, and I only have one CPU.

They are also based on top of multiprocessing which states:

... the multiprocessing module allows the programmer to fully leverage multiple processors on a given machine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM