class - Running a program in parallel while using another python script -



class - Running a program in parallel while using another python script -

i trying toy problem work in parallel can apply more complex. importing different file has class defined in it, , wish run programme on 4 engines.

here utility file named testing_script

import scipy class classy(object): def __init__(self, x): self.x = x def a(self, y): homecoming scipy.arange(y*self.x) def callclassy(x,y): c = classy(x) homecoming c.a(y)

the file i'd run in parallel:

import testing_script import ipython.parallel pc = ipython.parallel.client() lv = pc.load_balanced_view() @ipython.parallel.require('testing_script') def func(x): homecoming testing_script.callclassy(x[0],x[1]) r = lv.map(func, [[1,2],[3,2],[4,3],[5,2]])

this runs without error, r returns asyncmapresult: func , r.get(5) times out. i'm missing simple.

python class parallel-processing

Comments

Popular posts from this blog

javascript - THREE.js reposition vertices for RingGeometry -

javascript - I need to update the text of a paragraph by inline edit -

assembly - What is the addressing mode for ld, add, and rjmp instructions? -