DEAP / deap

Distributed Evolutionary Algorithms in Python
http://deap.readthedocs.org/
GNU Lesser General Public License v3.0
5.85k stars 1.13k forks source link

How can i enable multiprocessing? #514

Open nickhuangxinyu opened 4 years ago

nickhuangxinyu commented 4 years ago

Hi,

Deap is a masterpiece! I am using it to do some gp.

but i dont know how to use multiprocessing, in the tutorial, i only see the register function to register the pool map. no start pool or other things start the multiprocessing function. And, i check my cpu when running the python code, it only use one cpu. So i think multiprocessing not work.

I saw for scoop, the running command is: python -m scoop xxx.py

is there anything i need to do after registering the pool map function?

And one more question: where does the multiprocessing happening? i think gp is path-dependent (the next generation is generate from the last, only this generation finished , the next can proceed, how does it multiprocessing?)

Thanks, I am new in GP.

fmder commented 4 years ago

When you create the multiprocessing pool it gets started automatically. Inside the algorithms it uses toolbox.map which by default (not registered to something else) is the standard map. Registering pool.map will use the pool to do evaluation.

nickhuangxinyu commented 4 years ago

thanks fmder!

One more thing i want to ask, where did the multiprocessing happend? does it only work when evaluate? or, mate, mutate can multiprocess?

fmder commented 4 years ago

When you use the algorithms it is only when evaluating.