##// END OF EJS Templates
Backport PR #5488: Added missing require and jquery from cdn....
Backport PR #5488: Added missing require and jquery from cdn. For some reason (I suppose some changes at the css level) the font size inside the input cells was fixed at 14 px... making the fonts really small in the reveal slideshows. This is really annoying... As a plus, I have also added the missing calls for require and jquery (as the full html template does). I think these fixes belong to 2.0, but I also know we are on the edge... so I hope to get it inside :wink: Cheers.

File last commit:

r16120:24b93a1d
r16230:ba262623
Show More
Parallel Decorator and map.ipynb
119 lines | 2.9 KiB | text/plain | TextLexer
/ examples / Parallel Computing / Parallel Decorator and map.ipynb

Load balanced map and parallel function decorator

In [1]:
from __future__ import print_function
from IPython.parallel import Client
In [2]:
rc = Client()
v = rc.load_balanced_view()
In [3]:
result = v.map(lambda x: 2*x, range(10))
print("Simple, default map: ", list(result))
Simple, default map:  [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
In [4]:
ar = v.map_async(lambda x: 2*x, range(10))
print("Submitted tasks, got ids: ", ar.msg_ids)
result = ar.get()
print("Using a mapper: ", result)
Submitted tasks, got ids:  ['b4d86123-967a-4f21-b9c5-8a77a69a3ced', '97401998-891d-4729-8288-ae1b97c28235', '1586cf7e-32c7-4864-bd0e-6aab16e07a3f', 'f6770223-59c3-4344-a69a-5d555d1dfb7f', '0ebb71da-6e16-44ac-917a-be978fd3787d', '582443c5-937e-45b0-9f13-5607c53cba60', '8d453d87-d70d-4fbd-a2c4-994ab3a8b6c7', '0a680757-1a59-4826-969c-523a45f3d76f', '63a3e983-a205-4f07-b494-ec86b2cdd004', '79b34cbb-aa93-4d11-8746-28969dbdd3ec']
Using a mapper:  [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
In [5]:
@v.parallel(block=True)
def f(x): return 2*x

result = f.map(range(10))
print("Using a parallel function: ", result)
Using a parallel function:  [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
In [ ]: