##// END OF EJS Templates
Initial version of working refactored ipcluster....
Initial version of working refactored ipcluster. This new version uses Twisted's cross platform process management API and provides: * New command line parsing using argparse. This allows for different subcommands (ipcluster local, ipcluster pbs, ipcluster mpirun, etc). * Currently working local and mpirun stating of clusters. * Almost working pbs starting. This has no docs and no tests as of yet and should be considered a tech preview.

File last commit:

r1338:72652d65
r1770:49f63bba
Show More
pwordfreq_skel.py
35 lines | 982 B | text/x-python | PythonLexer
#!/usr/bin/env python
"""Parallel word frequency counter."""
from itertools import repeat
from wordfreq import print_wordfreq, wordfreq
def pwordfreq(rc, text):
"""Parallel word frequency counter.
rc - An IPython RemoteController
text - The name of a string on the engines to do the freq count on.
"""
if __name__ == '__main__':
# Create a MultiEngineClient
from IPython.kernel import client
ipc = client.MultiEngineClient()
# Run the wordfreq script on the engines.
ipc.run('wordfreq.py')
# Run the serial version
print "Serial word frequency count:"
text = open('davinci.txt').read()
freqs = wordfreq(text)
print_wordfreq(freqs, 10)
# The parallel version
print "\nParallel word frequency count:"
files = ['davinci%i.txt' % i for i in range(4)]
ipc.scatter('textfile', files)
ipc.execute('text = open(textfile[0]).read()')
pfreqs = pwordfreq(ipc,'text')
print_wordfreq(freqs)