Carthesian Product error with nvc++

Hi, I think I found a bug with the cartesian product header from this tutorial and parallel STL algorithms with nvc++.

When I use the par_unseq policy on for_each to iterate on a virtual (1D vector) 3D tensor with the cartesian product, it seems that I encounter data corruption. I don’t encounter this error with a sequential policy using nvc++ or with the par_unseq policy using gcc and tbb.

I made the following reproducer.

Let me know if you need more details about this potential bug.

edit :
Configuration :

  • HPC SDK 24.1, 24.3, 24.5
  • CUDA 12.3, 12.4
  • Linux x86_64

Hi - I have a colleague who is going to look at this and get back to you on it. It will probably be next week before he’s able to do so, but I just wanted to give you a quick update that we’re going to check out the issue and investigate! Thank you for making us aware. We’ll update you when we know more.

Perfect, thanks for your help.

We’ve confirmed that this is an error in cartesian product where it can return an off-by-one value when offloading. In this case the “y” values returned are 2, 2, 3, 3, 4, 4 when they should be 2, 2, 2, 3, 3, 3.

We’ve added an issue report, NVBugs #4656068, and will have engineering investigate.

Thanks for the report!

Hi, I just applied the latest bug fix from the tutorial, and it works now.

I updated the reproducer.

Thanks for your help.