numenta / htmresearch

Experimental algorithms. Unsupported.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create parallel job runner for capacity test

chetan51 opened this issue · comments

To make it easy to run many experiments in parallel.

Example runner:

from multiprocessing import Pool
import time
import sys

def f(x):
  sys.stdout = open("{0}.out".format(x), "w", buffering=0)
  sys.stderr = open("{0}.error.out".format(x), "w", buffering=0)

  for _ in range(x*10):
    print "x: {0}".format(x)
    time.sleep(1.0)
  return x*x

if __name__ == '__main__':
  pool = Pool(processes=4)              # start 4 worker processes
  print pool.map(f, range(10))          # prints "[0, 1, 4,..., 81]"