Parallel Python module using other server
-
01-07-2022 - |
سؤال
I'm using parallel python to do some number crunching on several computers. Everything was working fine till I thought it would be nice to include some classes.
Here is the code for submitting the jobs:
for i in xrange(n_cpus):
jobs.append(job_server.submit(self.fcalc_rs_rp, (ch_lambdas[i], thetas, ch_n_arr[i]), (), ("import numpy as np", "from SimulationOO import *")))
It works perfectly fine on a single computer (also uses all cores, so fine), but if I try to use another server the calculations never stop.
The problem is that the server has no cpu load, because it can't load from SimulationOO import *
since the file doesn't exist on the server.
One workaround would be to put the method .fcalc_rs_rp()
out of the class and make it a function but actually I want to have the function inside a class and maybe you have a good idea?
If I try to not use the from SimulationOO import *
part and instead define all functions needed as depfuncs, it gives the error AttributeError: 'module' object has no attribute 'Layer'
where Layer
is one of the classes I'm using.
Do you have any advice, how I could get this working?
Thank you
لا يوجد حل صحيح