NVIDIA / CUDALibrarySamples

CUDA Library Samples
Other
1.62k stars 348 forks source link

PBA Distance Transform using NPP returns non-exact EDT. #213

Open jeanchristopheruel opened 2 months ago

jeanchristopheruel commented 2 months ago

Related to this topic I followed the examples at https://github.com/NVIDIA/CUDALibrarySamples/tree/master/NPP/distanceTransform In these examples, I set the first row a sites.

// nppiDistanceTransformPBA_8u32f_C1R_Ctx
[0]: 0 0 0 0 0 0 0 0 0 0
[1]: 1 1 1 1 1 1 1 1 1 1
[2]: 1 1 1 1 1 1 1 1 1 1
[3]: 3 3 3 3 3 3 3 3 3 3
[4]: 3 3 3 3 3 3 3 3 3 3
[5]: 4 4 4 4 4 4 4 4 4 4
[6]: 5 5 5 5 5 5 5 5 5 5
[7]: 6 6 6 6 6 6 6 6 6 6
[8]: 7 7 7 7 7 7 7 7 7 7
[9]: 8 8 8 8 8 8 8 8 8 8
[10]: 9 9 9 9 9 9 9 9 9 9
// nppiDistanceTransformAbsPBA_8u16u_C1R_Ctx
[0]: 0 0 0 0 0 0 0 0 0 0
[1]: 1 1 1 1 1 1 1 1 1 1
[2]: 1 1 1 1 1 1 1 1 1 1
[3]: 3 3 3 3 3 3 3 3 3 3
[4]: 3.5 3.5 3.5 3.5 3.5 3.5 3.5 3.5 3.5 3.5
[5]: 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5
[6]: 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5
[7]: 6.5 6.5 6.5 6.5 6.5 6.5 6.5 6.5 6.5 6.5
[8]: 7.5 7.5 7.5 7.5 7.5 7.5 7.5 7.5 7.5 7.5
[9]: 8.5 8.5 8.5 8.5 8.5 8.5 8.5 8.5 8.5 8.5
[10]: 9.5 9.5 9.5 9.5 9.5 9.5 9.5 9.5 9.5 9.5
mkhadatare commented 2 months ago

Hi @jeanchristopheruel,

Thank you for reporting this issue. Could you please provide a small reproducible example along with details of your testing environment, including information about the GPUs, CUDA Toolkit version, and any other relevant configurations?

soooch commented 2 months ago

Hey @mkhadatare I'm seeing the exact same issue on one system, but not on another. I am using nppiDistanceTransformPBA_8u32f_C1R_Ctx.

System with issue: RTX 4070 CUDA/NPP version: 11.8

System without issue: Jetson Orin Nano 4GB CUDA/NPP version: 11.4

The nature of the issue is exactly as demonstrated in @jeanchristopheruel's post. Locations which should have distances of 2 are reported to have distances of 1. This appears to right itself at distance 3. Then at positions which should have distance 4, we see distance 3.5. Then the rate of the distance increments correctly, though the values themselves are incorrect. (3.5, 4.5, 5.5 where it should be 4, 5, 6)

soooch commented 2 months ago

This is internally tracked at 4832970 btw.

jeanchristopheruel commented 2 months ago

Woohoo thanks a lot for the followup!

mkhadatare commented 2 months ago

Hi @soooch Thank you for reporting this. We are currently working on the issue under bug tracker ID 4832970 and will keep you updated on the progress.