natural logarithm: device and standard functions deviate

Hi,

I am writing a kernel that generates a logarithmic histogram over equally distibuted test data. I observe deviations when comparing the histograms generated on the CPU using the STL function and on the GPU usgin the device functions.



[197]:[1841]:[1841]
[198]:[1878]:[1878]
[199]:[1880]:[1880]
[200]:[1935]:[1935]
[201]:[1884]:[1889]
…/…/…/examples/toneMappingTest.cpp(115): error in “LogHistogramTest”: check (unsigned int) hist_cpu.bin(i) == hist_gpu[i] failed
[202]:[1941]:[1936]
…/…/…/examples/toneMappingTest.cpp(115): error in “LogHistogramTest”: check (unsigned int) hist_cpu.bin(i) == hist_gpu[i] failed
[203]:[2016]:[2016]
[204]:[2055]:[2055]
[205]:[1975]:[1984]
…/…/…/examples/toneMappingTest.cpp(115): error in “LogHistogramTest”: check (unsigned int) hist_cpu.bin(i) == hist_gpu[i] failed
[206]:[2015]:[2006]
…/…/…/examples/toneMappingTest.cpp(115): error in “LogHistogramTest”: check (unsigned int) hist_cpu.bin(i) == hist_gpu[i] failed
[207]:[2001]:[2001]
[208]:[2080]:[2080]
[209]:[2126]:[2126]

Hasd anyone ever observed such deviations?

Thanks in advance,

Kwyjibo

Small rounding errors in device functions are normal. Your final errors are less than 1%, so I wouldn’t be too worried. Appendix C in the CUDA programming guide describes the maximum error for the device functions.

[sub]
PS. you might be interested in the paper presentation “High Performance Predictable Histogramming on GPUs: Exploring and Evaluating Algorithm Trade‐off”, this Saturday at GPGPU. It is about histogramming gray-scale images in 256 bins (not logarithmic). If you like a copy of the paper please give me a note.
[/sub]

Thank you for your answer, I dont need absolute precision, I was just wondering. Yes, I am interested in your paper since I also have been dealing with GPU histogram generation for a while.