Hi,
I have a loop reduction and want to store its result in a device variable, I found a solution that works, however I was wondering if there is a better way to get it done.
int themax = 0;
#pragma acc parallel loop reduction(max:themax) present(arr)
for(int i = 0; i < size; ++i)
{
if( arr[i] > themax )
themax = arr[i];
}
#pragma acc serial
{
max_ = themax;
}
(max_ is a member variable and is already allocated on the device)
Kind regards,
Rob