User defined reduction OpenACC example

I am trying to achieve something similar to this post

for (int i=0; i < n; ++i){
   // some operation
   // some computation results in cost and route.
  if(cost < minCost) {
     minCost = cost;
     minRoute = route;
  }
}

I assume if we have user-defined reduction we can achieve the above. Do we have it in nvc++ 22.7?
I remember seeing it in one of David Olsen’s GTC Talk GTC S9770 page 24. Can you give me or point me to a small example where I can play+understand the same?
Thanks.

No, sorry. We have an open enhancement request for “declare reduction” and user defined reduction in target offload, but this work has not been started. Not sure when engineering will work on this given it’s particularly hard to implement and other features may have higher priority.

Notice in slide 25 that David used g++ to compile this code and only used it on the CPU.

For now, my best suggestion if to stick with the dual pass solution I presented earlier.

-Mat

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.