       Followup question: Problem with parallel evaluation of integrals depending on a parameter

• To: mathgroup at smc.vnet.net
• Subject: [mg99878] Followup question: Problem with parallel evaluation of integrals depending on a parameter
• From: Alan Barhorst <alan.barhorst at ttu.edu>
• Date: Mon, 18 May 2009 02:30:49 -0400 (EDT)

```Hello, I have done more experimentation and the problem is pronounced
when I try to feed parallel kernels the things I need evaluated.  Here
is a session that shows how the order of when the grid point iterates
for NIntegrate are applied to an interior integral.  The help menu
shows how to do what I want in the main kernel, but something about
using ParallelEvaluate releases the hold on the NIntegrate before the
place holder symbol is assigned a numerical value.

Any help is appreciated.

AB
________________________________________________________
Alan A. Barhorst, PhD, PE	        | alan.barhorst at ttu.edu
Professor					| http://www.me.ttu.edu/
Mechanical Engineering		| Phone: 806-742-3563, ext 241
Texas Tech University
Lubbock, TX 79409-1021

When leaders disregard the law and human dignity, kooks
are emboldened; innocence lost.

Human potential cannot be developed or measured from a
floating moral reference frame.
________________________________________________________

ParallelEvaluate[\$ProcessID]

testfunc6[FF_, GG_] := Module[{xxx, yyy, ff, gg},
SetSharedFunction[ff, gg];
ParallelEvaluate[ff[x_] := FF[x]];
ParallelEvaluate[gg[x_] := GG[x]];

Print["ff[x]=", ff[x]];
Print["gg[x]=", gg[x]];

SetSharedFunction[xxx];
ParallelEvaluate[xxx[S_] := Integrate[Sin[ff[x]], {x, 0, S}] // N];
Print["xxx[.1]=", ParallelEvaluate[xxx[.1]]];
Print["xxx[.1]=", xxx[.1]];
Print["Int(xxx[S])=", ParallelEvaluate[Integrate[xxx[S], {S, 0,
1}] // N]];

(*here since the function is subscripted it must be defined in the
base kernel as well*)

SetSharedFunction[yyy];
yyy[S_] := Integrate[Cos[gg[x]], {x, 0, S}] // N;
ParallelEvaluate[yyy[S_] := Integrate[Cos[gg[x]], {x, 0, S}] // N];
Print["yyy[.1]=", ParallelEvaluate[yyy[.1]]];
Print["yyy[.1]=", yyy[.1]];
Print["Int(yyy[S])=", ParallelEvaluate[Integrate[yyy[S], {S,
0, 1}] // N]];

UnsetShared["*"];

]

f1 = Interpolation[Table[{i, i}, {i, 0, 1, 1/2}]]
f2 = 3 f1

testfunc6[f1, f2]

```

• Prev by Date: Re: creating Graphics using ParallelTable[]
• Next by Date: Re: creating Graphics using ParallelTable[]
• Previous by thread: Interesting Mersenne identities and a prime based graph sequence
• Next by thread: Solve a couple mode equation with Mathematica.