On Thursday, 29 September 2016 02:23:13 UTC+1, jf...@ms4.hinet.net  wrote:
> Paul  Moore at 2016/9/28 11:31:50PM wrote:
> > Taking a step back from the more detailed answers, would I be right to 
> > assume that you want to call this external function multiple times from 
> > Python, and each call could take days to run? Or is it that you have lots 
> > of calls to make and each one takes a small amount of time but the total 
> > time for all the calls is in days?
> > 
> > And furthermore, can I assume that the external function is *not* written 
> > to take advantage of multiple CPUs, so that if you call the function once, 
> > it's only using one of the CPUs you have? Is it fully utilising a single 
> > CPU, or is it actually not CPU-bound for a single call?
> > 
> > To give specific suggestions, we really need to know a bit more about your 
> > issue.
> 
> Forgive me, I didn't notice these detail will infulence the answer:-)
> 
> Python will call it once. The center part of this function was written in 
> assembly for performance. During its execution, this part might be called 
> thousands of million times. The function was written to run in a single CPU, 
> but the problem it want to solve can be easily distributed into multiple CPUs.
> 
> --Jach

OK. So if your Python code only calls the function once, the problem needs to 
be fixed in the external code (the assembly routine). But if you can split up 
the task at the Python level to make multiple calls to the function, each to do 
a part of the task, then you could set up multiple threads in your Python code, 
each of which handles part of the task, then Python merges the results of the 
sub-parts to give you the final answer. Does that make sense to you? Without 
any explicit code, it's hard to be sure I'm explaining myself clearly.

Paul
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to