1
$\begingroup$

My code contains the structure

Table[....,Table[....,{m1,1,N}],{m2,1,M}]

and I would like to use ParallelTable to improve timing. Empirically, I know that ParallelTable[...ParallelTable[...,{}],{}] does not work, so I use

ParallelTable[....,Table[....,{m1,1,N}],{m2,1,M}]

However, these two codes give different results and I do not know why.

$\endgroup$
2
$\begingroup$
i = 1;
Table[i++, {j, 1, 4}]

{1, 2, 3, 4}

h = 1;
ParallelTable[h++, {j, 1, 4}]

{1, 1, 1, 1}

| improve this answer | |
$\endgroup$
  • $\begingroup$ SetSharedVariable[h], thx $\endgroup$ – Artem Alexandrov May 12 at 9:54

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.