# How to parallelize this code

Here I obtained one code which should tests some zeros of the poly for various g, but sometimes I have to many cycles because of step and I need to parallelize the running on all cores. Classical ParallelDo instead the Do doesn't work. What to do further

 poly=g*x^3+21*x^2-1.23*x+7.3247*g*I*x^2;

LM = {};
Do[
Lroots = x /. NSolve[(poly /. {g -> G}) == 0, x];

res = 0;
Do[
root = Lroots[[i]];
If[Im[root] >= 0,
L1 = Drop[Lroots, {i}];
res = res + 1/(Times @@ (root - L1));
];
, {i, 1, Length[Lroots]}
];
M = 1/((4*G^2)*res);
AppendTo[LM, M];

, {G, 0.001, 15, 0.01}
];

-
Could you maybe elaborate a bit further on what you try to calculate with the code? Maybe the Do can be avoided or is the parallelization of the Do the main point of the question? Do you perhaps intend to calculate an Integral along the real axis using Jordan's Lemma? (Im[root]>=0 and summing res as in residues makes me think that way) –  Max1 Apr 13 '14 at 21:10
Just to use all cores in computing the M –  Pipe Apr 14 '14 at 17:34