[SciPy-User] Parallelizing a for loop
Thu Dec 24 11:02:11 CST 2009
Also, where might I find guidance for how to get rid of for loops/
----- Original Message ----
From: Scott Askey <firstname.lastname@example.org>
Sent: Thu, December 24, 2009 9:50:13 AM
Subject: Re: Parallelizing a for loop
A pointer to the tools in numpy to apply array operation to my function would be appreciated.
I found found the scipy.vectorize but it did not seem applicable to my 42 input
As best I could tell I seemed that the time required to calculate two elements (2 x dof in residual 500 times) was the same as calculating 1 x dof residual 1000 times in a for loop.
It is a time marching structural dynamics 1-d beam problem. The 100 or so parameters are the initial conditions, geometric and material properties. The 42 dof are the configuration of the element at the end of the time step. Given the array of (42 * elements) initial conditions the residuals for each element may be independently calculated.
Currently I calculate the 42*elements residual by running "for i in range(element)" and getting 42 residuals in each iteration.
My element residual function is at most at worst cubic polynomials.
The element wise residual and fprime functions are lambdafiedsympy functions.
More information about the SciPy-User