labelled_sums Subroutine

public subroutine labelled_sums(s, g, label, a, b, c, n_label, n_f, n, n_i, n_groups_pad, n_j)

s(1:3, l) += sums of ga, gb and g*c over the points labelled l, as cuda/kernels/fieldops.f90: each thread accumulates runs of equal labels along its pencil and flushes a run when the label changes, so the atomics scale with the label changes rather than the points. Atomics instead of reduction(+:s), which flang cannot do on the GPU for an array whose shape is only known at run time.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: s(3,n_label)
real(kind=dp), intent(in) :: g(SZ,n_f,n_groups_pad*n_i)
real(kind=dp), intent(in) :: label(SZ,n_f,n_groups_pad*n_i)
real(kind=dp), intent(in) :: a(SZ,n_f,n_groups_pad*n_i)
real(kind=dp), intent(in) :: b(SZ,n_f,n_groups_pad*n_i)
real(kind=dp), intent(in) :: c(SZ,n_f,n_groups_pad*n_i)
integer, intent(in) :: n_label
integer, intent(in) :: n_f
integer, intent(in) :: n
integer, intent(in) :: n_i
integer, intent(in) :: n_groups_pad
integer, intent(in) :: n_j