Sorry if the question is very basic, that's because I am newbie in the Mathematica.
Assume I have a module that is supposed to do a very very long calculation
result = Table[0, {i, 100000000}]; f[x0_] := Module[{x = x0},
For[i =0, i < 100000000, i++, result[[i]] = i^2; ]; ]
Now I want to take the advantage of my multicore CPU. I there any way to break the work into pieces and assign every piece to a core to do that in parallel?
Possibly it is not a simple ParallelEvaluate command. Let me be more specific:
Assume this module is taking a very long For loop like For[i=0,i<100000000,.... . My question is if I have 8 cores on my CPU, can I break the 100 million loop job into 8x12.5 million cycles and assign each one of these 12.5 million cycles to one core?
ParallelDo
orParallelTable
, or other parallel commands. But notParallelEvaluate
. Which is more appropriate is hard to say without a clearer formulation of your question. Right now details are missing that leave the question a little vague. $\endgroup$