PUGHReduce/ReductionMin.c, PUGH_ReductionMinVal(), line 275

The source code was:

     case CCTK_VARIABLE_REAL:
             ITERATE_ARRAY (CCTK_REAL, num_dims, inarrays[i], from, to, iterator, points_per_dim,CCTK_REAL, outvals, num_outvals, total_outvals);

I replaced it with the preprocessed  code for ITERATE_ARRAY, and added openmp pragmas for the inner loop:

  case CCTK_VARIABLE_REAL:
     { int _i, _j, _dim, _vindex; double *typed_vdata = (double *) (inarrays[i]); double typed_outval; for (_j = 0; _j < num_outvals; _j++, typed_vdata++) { _vindex = from[0]; for (_i = 1; _i < num_dims; _i++) _vindex += from [_i] * points_per_dim [_i]; typed_outval = ((typed_vdata + _vindex)[0]); memcpy (iterator, from, num_dims * sizeof (int)); _dim = 1; while (1) { _vindex = 0; for (_i = 1; _i < num_dims; _i++) _vindex += iterator [_i] * points_per_dim [_i];
#pragma omp parallel for num_threads(6)
for (_i = from [0]; _i < to [0]; _i++)
{
  #pragma omp critical 
  if (typed_outval > typed_vdata [_i + _vindex])
         typed_outval = typed_vdata [_i + _vindex];
}
if (num_dims > 1) { if (++iterator [_dim] >= to [_dim]) { for (_dim++; _dim < num_dims; _dim++) { if (++iterator [_dim] < to [_dim]) break; } if (_dim >= num_dims) break; for (_dim--; _dim >= 0; _dim--) iterator [_dim] = from [_dim]; _dim = 1; } } else { break; } } outvals [total_outvals++] = (double) typed_outval; } }