Home > coreit

coreit

Coreit is a project mainly written in Python, it's free.

Python helper to throw code on cores that can run in parallel

coreit

Helper function to throw code on cores that can be run in parallel.

If you have code like

for i in xrange(start, stop): ... slow_function(i)

You can speed it up on a 4-core machine by running it like so:

functions = [slow_function for i in xrange(start, stop)] args = [(i,) for i in xrange(start, stop)] coreit(functions, args, 4)

Note that

p = multiprocessing.Pool(4) p.map(slow_function, xrange(start, stop))

is built in and does the equivalent.

As such, this code is somewhat obsolete, but has a distinction: if you have different functions that you want to run concurrently, coreit will do it. Pool.map won't.

Requirements

  • multiprocessing (python 2.6 or http://code.google.com/p/python-multiprocessing/)

Todo

  • ?

Licensed under PSF license Copyright (c) 2010 Matt Harrison ([email protected])