src/test/mpi-reduce.c

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    #include "utils.h"
    
    int main ()
    {
      init_grid (64);
    
      scalar s[];
      foreach()
        s[] = x + y;
      boundary ({s});
    
      // statsf() uses MPI reduction operations
      stats stat = statsf (s);
      fprintf (qerr, "%g %g %g\n", stat.min, stat.sum, stat.max);
    }