51 ms·
Parallel looping is one of those things I wish was easier to use. Countless times I've stared at my python code weighing the cost of using the available primiti
by techdragon 12y ago
Parallel looping is one of those things I wish was easier to use. Countless times I've stared at my python code weighing the cost of using the available primitives to optimise the loop. I just wish it was as simple as
parallel_for x in range(10):
myFunc(x)
But we can't have everything.
- DominoDataLab 12y agoThe joblib packages gets you pretty close: num_cores = multiprocessing.cpu_count() Parallel(n_jobs=num_cores)( delayed(myFunc)(x) for x in range(10))