I am trying to run a script within Blender that utilizes multiprocessing module.
According to documentation it is possible to use it ( see note at the end of "Strange errors using ‘threading’ module" ).
Pythons threads only allow co-currency and won’t speed up your scripts on multi-processor systems, the subprocess and multiprocess modules can be used with Blender and make use of multiple CPU’s too..
So I tried running below script within Blender:
from multiprocessing import Pool
def test( v ):
print(v)
return v
p = Pool(2)
print( p.map(test, range(5) ) )
This however spawns as many new Blender instances (with separate windows) as there are workers in p (in my case 2).
Also it spews in System Console :
Can't read file: "C:\Program Files\Blender Foundation\Blender\-c", Unable to open the file.
Can't read file: "C:\Program Files\Blender Foundation\Blender\from multiprocessing.forking import main; main()", Unable to open the file.
Can't read file: "C:\Program Files\Blender Foundation\Blender\--multiprocessing-fork", Unable to open the file.
Can't read file: "C:\Program Files\Blender Foundation\Blender\2888", Unable to open the file.
I also thought about using os.fork() to do the same thing, but sadly Windows does not support that.
I've been looking all over Internet, but so far I was not able to find even one example proving that documentation is correct.
The only thing I found was thread on blenderartists.org, but it is locked and with no responses.
Update: This is a windows spesific limitation in the multiprocessing module. ~ideasman42.