The statistical mechanics examples (Heisenberg, Ising, Potts) will only call ghostswap() when index % sqrt(nodes(grid)) is zero. This is meant to trigger ghostswap when a boundary cell has changed state, in order to maintain coherency across parallel boundaries. Depending on the number of ranks requested of mpirun, the grids may have uneven sizes, which produces a race condition when one rank has already passed over the conditional (leaving all the rest to wait, forever). This could be addressed by collectively reducing index % sqrt(nodes(grid)) to its minimal value, effectively asking if any rank has changed a boundary cell, instead of checking only the local rank.
The statistical mechanics examples (Heisenberg, Ising, Potts) will only call
ghostswap()whenindex % sqrt(nodes(grid))is zero. This is meant to triggerghostswapwhen a boundary cell has changed state, in order to maintain coherency across parallel boundaries. Depending on the number of ranks requested ofmpirun, the grids may have uneven sizes, which produces a race condition when one rank has already passed over the conditional (leaving all the rest to wait, forever). This could be addressed by collectively reducingindex % sqrt(nodes(grid))to its minimal value, effectively asking if any rank has changed a boundary cell, instead of checking only the local rank.