IPython’s Direct interface#

Create a DirectView#

[1]:
import ipyparallel as ipp
rc = ipp.Client()
[2]:
rc = ipp.Client(profile='default')
[3]:
rc.ids
[3]:
[0, 1, 2, 3]

Use all engines:

[4]:
dview = rc[:]

map() function#

Python’s builtin map() function can be applied to a sequence of elements and is usually easy to parallelise.

Please note that the DirectView version of map() does not do automatic load balancing. You may have to use LoadBalancedView for this.

[5]:
serial_result = list(map(lambda x:x**10, range(32)))
[6]:
parallel_result = dview.map_sync(lambda x: x**10, range(32))
[7]:
serial_result == parallel_result
[7]:
True