3 ms·
Easy parallel loops in Python, R, Matlab and Octave
- earino 12y agoIncludes sample code for Python using joblib, in R using the Parallel language, and in Matlab/Octave using the parfor construct!
- techdragon 12y agoParallel 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))