我正在尝试使用pp package在python中运行并行编程,但它正在运行一些迭代,然后抛出一个错误:
请帮忙
ppservers = ()
if len(sys.argv) > 1:
ncpus = int(sys.argv[1])
# Creates jobserver with ncpus workers
job_server = pp.Server(ncpus, ppservers=ppservers)
else:
# Creates jobserver with automatically detected number of workers
job_server = pp.Server(ppservers=ppservers)
print "Starting pp with", job_server.get_ncpus(), "workers"
start_time = ti.time()
jobs = []
for new_data_set in many_isotopomer_data:
jobs.append(job_server.submit(optimzation(ob.objective, input_dict, method ='SLSQP', args=(system_ode, params_val_dict, initial_cond, time, new_data_set, id_name, input_dict), constraints=None, niter=1, bound=bnds)))
print "Time elapsed: ", ti.time() - start_time, "s"
job_server.print_stats()
因此,它正在运行初始迭代,但是,它会引发以下错误:
[Error Message, after some iteration are done][1]
chi square error - 1.4150205992
chi square error - 1.4150206112
chi square error - 1.41502057127
chi square error - 1.41502059919
Traceback (most recent call last):
File "carlos_test.py", line 218, in <module>
new_data_set, id_name, input_dict), constraints=None, niter=1, bound=bnds)))
File "/Users/bhavyabhushan/virtualenvs/elf/lib/python2.7/site-packages/pp.py", line 460, in submit
sfunc = self.__dumpsfunc((func, ) + depfuncs, modules)
File "/Users/bhavyabhushan/virtualenvs/elf/lib/python2.7/site packages/pp.py", line 636, in __dumpsfunc
hashs = hash(funcs + modules)
TypeError: unhashable type: 'OptimizeResult'