On Tuesday, April 10, 2012 10:31:57 AM UTC+4, David Bailey wrote:
> I think this illustrates the pitfalls of parallel computing
I suspect it rather illustrates a bug in a SetSharedVariable realization.
> why I have never used this feature for serous code!
Actually, I wrote a modified Lanczos method for the exact diagonalization study of many-electron system in a quantum dot. I do not know, whether it is serious enough, but it successfully runs in parallel, which saves me a lot of time (literally, days). The only step that fails to parallelize is the last step of the calculation of Fourier components of the density. This is what I essentially describe here.
> You probably thought your update was atomic, but I doubt if
>
> c[[a[[l, k]]]] += 1
>
> qualifies as an atomic update!
It is indeed crucial for SetSharedVariable, however, AtomQ[c[[a[[l, k]]]] += 1] gives True.
Best,
Yasha Gindikin.