How can I execute more than one input cell simultaneously using different processor. For example consider this two cells
Grid[ParallelTable[ContourPlot[Sin[m x] Sin[n y] - Cos[n x] Cos[m y],
{x, 0, 2 Pi}, {y, 0, 2 Pi},MaxRecursion -> 5], {m, 2}, {n, 2}]]//TimeUsed
T1end=DateString[]
and
T2begin=DateString[]
Grid[ParallelTable[ContourPlot[Sin[m x] Cos[n y] - Cos[m x] Sin[n y],
{x, 0, 2 Pi}, {y, 0, 2 Pi},MaxRecursion -> 5], {m, 2}, {n, 2}]]//TimeUsed
I hit the shift+enter for the second cell after 3 second of the first one but the execution starts after finishing the first cell and I always get T2begin=T1end.
where; T2begin = Starting time of second job (given by DateString[]
) and T1end = Finishing time of first job.
What I want is to use half of the processors for the first job and use the aother half for the second job simultaneously (starting from the moment I hit the shift+enter) which will give T2begin < T1end, i.e. the second job will start before the completion of first job.
(I am working with 8 processors.)
Answer
One way (other than using one ParallelTable
) to do this with ParallelSubmit
`:
Pause[1]; Pause[1]; // AbsoluteTiming
(* {2.000000, Null}*)
ParallelSubmit[Pause[1]]; ParallelSubmit[Pause[1]];
WaitAll[%] // AbsoluteTiming
(* {1.006000, Null}*)
Comments
Post a Comment