# How to tell Mathematica do parallel computation?

I am using NDSolve on a workstation with 6 kernels. To speed up the simulation I have used LaunchKernels[] to load all the available parallel kernels. I am not sure whether or not this simple command makes the simulation a parallel computation? However, I found that the running time with LaunchKernels[] is the nearly the same order of that without LaunchKernels[].

My questions are:

1. What on earth does LaunchKernels[] do for a particular computation? Or under what circumstances should I use LaunchKernels[]?

2. How do you tell Mathematica to compute parallelly on a workstation or a dual-core laptop? For example, how to parallelize this example:

fsol = NDSolve[{D[u[x, t], t] == D[u[x, t], x, x], u[x, 0] == 1 - Sin[4*Pi*x]/(4*Pi), u[0, t] == 1, u[1, t] + Derivative[1, 0][u][1, t] == 0}, u, {x, 0, 1}, {t, 0, 1}, Method -> {"MethodOfLines", "SpatialDiscretization" -> {"TensorProductGrid", "MinPoints" -> 100}}]; Plot[First[u[1, t] + Derivative[1, 0][u][1, t] /. fsol], {t, 0, 1}, PlotRange -> All]

• no that is not enough: you have to explicitly tell Mathematica to (attempt to) run an evaluation in parallel, through one of the many commands available for this purpose, like Parallelize, ParallelTable and so on – glS Aug 8 '16 at 9:19
• I don't believe NDSolve[] is parallelizable. – J. M. is in limbo Aug 8 '16 at 12:58

If you use the method FiniteElement instead of TensorProductGrid the parallelization is done automatically :

fsol = NDSolveValue[{
D[u[x, t], t] == D[u[x, t], x, x] + NeumannValue[-u[x, t], x == 1],
u[x, 0] == 1 - Sin[4 Pi x]/(4 Pi),
u[0, t] == 1
},
u,
{x, 0, 1}, {t, 0, 3},
MaxStepSize -> 0.0001,
Method -> {"MethodOfLines",
"SpatialDiscretization" -> {"FiniteElement",
"MeshOptions" -> {"MaxCellMeasure" -> {"Length" -> 0.001}}}}
]

Manipulate[
Plot[fsol[x, t], {x, 0, 1}, PlotRange -> {{0, 1}, {0, 1.1}}], {t, 0,
1}] On Windows, The parallelization is visible on the "Windows Task Manager"

MaxStepSize-> 0.0001 and "MeshOptions" -> {"MaxCellMeasure" -> {"Length" -> 0.001}} are used here to increase the computing time.