Ask Your Question
0

Multithreading of the multi-arg function

asked 13 years ago

bk322 gravatar image

updated 13 years ago

kcrisman gravatar image

So here's an example from the reference:

sage:  def f(N,M=10): return N*M
sage:  inputs = [(tuple([]), {'N':3,'M':5}), (tuple([]), {'N':4,'M':5})]
sage:  for a, val in sage.parallel.reference.parallel_iter(f, inputs):
    :      print a, val
    :      
 ((), {'M': 5, 'N': 4}) 20
 ((), {'M': 5, 'N': 3}) 15

I'd like to call in parallel scipy.misc.derivative - which has lots of args:

for i in range(-2, 2, 0.01):
    scipy.misc.derivative(imagLogPROD00, i, dx = 0.001, args=(opts.myN, 3, DP))

So I'm doing it in the following way:

mesh = arange(-2, 2, 0.01)
inputs = [[(tuple([]), {'func':imagLogPROD00, 'x0':i, 'dx':0.001, 'args':(opts.myN, 3, DP)})] for i in mesh]
for a, val in sage.parallel.reference.parallel_iter(scipy.misc.derivative, inputs):
    print a, val

and I get error at parallel_iter:

ValueError: need more than 1 value to unpack

So ah... what could that be?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 13 years ago

kcrisman gravatar image

Could this patch or the answer at this ask.sagemath.org question give what you are looking for? Feel free to ignore this if you are asking something different.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 13 years ago

Seen: 616 times

Last updated: Feb 13 '12