I am executing a ParallelTable but the code fails to finish. This is the setup. f is a function.

uVec[t_] := Table[Subscript[u, i][t], {i, 0, n}](*Functions unknown*) 
f = Simplify[(Total[bVec[x]*uVec[t]]) /. bCoef][[1]];
fxx = D[f, x, x];
fxxx = D[f, x, x, x];

(*The inner product function*)
inner[{f_, j_}] :=
    If[j == 0,
      Integrate[((1/(Pi)) ChebyshevT[j, x]*(f)/(Sqrt[1 - x^(2)])), {x, -1, 1}],
      Integrate[((2/(Pi)) ChebyshevT[j, x]*(f)/(Sqrt[1 - x^(2)])), {x, -1, 1}]]

(* The inner product of f *)

I have used monitor to determine where the code is at in its execution. This ParallelTable executes all values of j and then returns the expected result.

Monitor[z = 0; 
    fExp = ParallelTable[z += 1;
        inner[{Table[ CoefficientList[f, Subscript[u, i][t]][[2]], {i, 0, n}], j}],
    {j, 0, n}], z];

This ParallelTable computes inner for all values of j but for large n greater than about 50, fails to return any result and remains stuck in running mode.

Monitor[z = 0; expr = ParallelTable[z += 1; inner[{fxx, j}], {j, 0, n}], z];

I am hoping for any answers as to why Mathematica is able to complete the computation but fails to return the resulting table.

  • $\begingroup$ After more debugging, I have monitored the bytecount of expr during the unending function. It seems to be growing steadily. I suspect the total computation has been completed on each kernel and now it is compiling the result into the final table. What can I do to speed up this process? expr = ConstantArray[0, n + 1]; SetSharedVariable[expr] Monitor[ParallelDo[expr[[j + 1]] = inner[fxx, j], {j, 0, n}];, ByteCount[expr]] $\endgroup$ – Aaron Crenshaw Jan 24 at 15:21
  • $\begingroup$ Ok with enough patience it seems to compile the results into the full table. Now that I have discovered more information I will post a new question. $\endgroup$ – Aaron Crenshaw Jan 24 at 15:28
  • $\begingroup$ The answer to this problem can be explained here. mathematica.stackexchange.com/questions/181265/… $\endgroup$ – Aaron Crenshaw Jan 24 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.