Thomas,
I have strings & numpy.ndarray as arguments. The wrapper function works great for strings.
Here's what I'm trying to do...
**************************
I have a serial python fn of the form
def bar(**kwargs):
a=kwargs.get("name")
print a
self.a1d=ma.asanyarray(kwargs.get('a1d'), dtype=float)
(****more calculations--takes a long time to compute
returns an object)
I am trying to run this function in parallel.
Here's my Main program
import numpy as np
import
numpy.ma as ma
from delegate import parallelize
from hashlib import sha1
a1d=np.zeros((32))
b1d=np.zeros((32))
p=open("/tmp/pdata","rb")
pdata=np.load(p)
for i in range(0,10):
a1d=pdata['t1d']
b1d=pdata['gz1d']
print a1d,b1d
kwargs={'name':'special','a':a1d,'b':b1d}
val=parallelize(bar,kwargs)
***************************************
Error:
line 30, in <module>
val=parallelize(bar,kwargs)
delegate.py", line 311, in process
item, items = items[0], items[1:]
KeyError: 0
**************************************
Error: (with the wrapper function)
val=parallelize(bar_wrapper,kwargs.items())
TypeError: unhashable type: 'numpy.ndarray'
***************************************
How do I pass the string & numpy.ndarray to the function bar(**kwargs)?
Thank you for suggestions & help,
a1d=np.zeros((32))
b1d=np.zeros((32))
p=open("/tmp/pdata","rb")
pdata=np.load(p)
for i in range(0,100):
a1d=pdata['t1d']
b1d=pdata['gz1d']
print a1d,b1d
kwargs={'name':'special','a':a1d,'b':b1d}
val=parallelize(bar,kwargs)