The compiler errors out with NVC++-F-0155-Reductions on pointer type must have bounds specified
. Bounds should not be needed when passing a device pointer.
#pragma omp target teams loop is_device_ptr(pbuf), reduction(min:mn), reduction(max:mx)
for (long i = 0; i < n_elem; ++i)
{
mn = pbuf[i] > mn ? mn : pbuf[i];
mx = pbuf[i] < mx ? mx : pbuf[i];
}
the complete error message is:
NVC++-F-0155-Reductions on pointer type must have bounds specified: mn (sensei_adaptor.cpp: 71)
NVC++/x86-64 Linux 23.3-0: compilation aborted
Switching from loop
to distribute parallel for
works.
#pragma omp target teams distribute parallel for is_device_ptr(pbuf), reduction(min:mn), reduction(max:mx)
for (long i = 0; i < n_elem; ++i)
{
mn = pbuf[i] > mn ? mn : pbuf[i];
mx = pbuf[i] < mx ? mx : pbuf[i];
}
I believe that this is a bug in the compiler. Is this the best place to report compiler bugs now?
If its a problem with the NVHPC compilers, then here’s fine. I can add the report directly to on tracker. The caveat being my team’s tracker is not externally accessible.
Alternatively, you can submit an issue to NVBugs via your NVIDIA Developer account page. These then get routed to our team.
Do you have a more complete example or a minimal reproducer? In particular, how are mn, mx, and pbuf declared?
The developer account page was how I did this in the past. I can’t seem to get to the bug tracker now. I’m probably missing something obvious.
Here’s a complete reproducer:
#include <limits>
// computes the min/max of the data.
void GetMinMax(const double *pbuf, long n_elem, double &mn, double &mx)
{
mn = std::numeric_limits<double>::max();
mx = std::numeric_limits<double>::lowest();
#if defined(USE_OMP_LOOP)
#pragma omp target teams loop is_device_ptr(pbuf), reduction(min:mn), reduction(max:mx)
#else
#pragma omp target teams distribute parallel for is_device_ptr(pbuf), reduction(min:mn), reduction(max:mx)
#endif
for (long i = 0; i < n_elem; ++i)
{
mn = pbuf[i] > mn ? mn : pbuf[i];
mx = pbuf[i] < mx ? mx : pbuf[i];
}
}
Throw that in a file called bug_repo.cpp
and compile with:
nvc++ -DUSE_OMP_LOOP -mp=gpu -Minfo=mp -c bug_repo.cpp -o beg_repo.o
Thanks. I’ve filed TPR #333647 and sent it to engineering for investigation.
-Mat