[SciPy-User] Parallelizing a for loop
Charles R Harris
Thu Dec 24 14:10:45 CST 2009
On Thu, Dec 24, 2009 at 10:02 AM, Scott Askey <firstname.lastname@example.org> wrote:
> Also, where might I find guidance for how to get rid of for loops/
> ----- Original Message ----
> From: Scott Askey <email@example.com>
> To: 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
> 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
The reason I asked is that there are a couple of finite element packages
available for python. Two of them are SfePy <http://sfepy.org/> and
I don't know if either is directly applicable to your problem. As to fsolve,
are you directly computing the Jacobian or do you let the routine compute it
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User