Skip to content

Move to a 2 array loop in solveMatrix

Right now we use one single enrad array in solveMatrix, and alternate odd and even arrays. Probably not a good idea from a cache perspective and also an isse with respect to setGhost.

The idea would be to have something like:

  reals& prevnrad = energy rad values...
  reals  nextnrad = ...
  
  while (stop criteria based on residual norm) {
    energy rad  async setGhost
    for (i j k) {
      nextnrad[ijk] = fct(prevnrad[ijk]);
    }
    energy rad wait setGhost completion;
    swap(nextnrad, prevnrad);
  }

This way, setGhost is done during the loop while next rad is assigned. We will be one field late on the ghost, but even if it cost one more step, it should be compensated.