Skip to content

Instantly share code, notes, and snippets.

@wence-
Created May 6, 2015 16:54
Show Gist options
  • Select an option

  • Save wence-/b23d5b6690e33693cce4 to your computer and use it in GitHub Desktop.

Select an option

Save wence-/b23d5b6690e33693cce4 to your computer and use it in GitHub Desktop.
maxval = op2.Global(-1, dtype=float)
op2.par_loop(op2.Kernel("""void maxify(double *a, double *b)
{
a[0] = a[0] < fabs(b[0]) ? fabs(b[0]) : a[0];
}""", "maxify"),
oldv.dof_dset.set, maxval(op2.MAX), oldv.dat(op2.READ))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment