Math functions in emudebug


I noticed that calls to math functions like log/pow are implemented discretely even in emudebug mode. Is there a reason why they are not simply using the <math.h> calls?

I am asking because I have a small testbed for porting algorithms to CUDA and for a quick correctness test I compare the output in emudebug. On some occasions this doesn’t work because of numeric precision differences in the implementations of pow for example.

I see the need for discrete implementations in emurelease and of course in the G80 modes, but it would be great if emudebug could be switched (#define perhaps?) to just use the <math.h> calls.


The goal of -deviceemu is to emulate the device as faithfully as possible. That’s why device code compiled with -deviceemu uses the discrete implementations of the math functions.

If you want the math functions in device code to use the host implementation, you can always modify the CUDA header files to allow for it.

Agreed. And I would indeed expect this for emurelease mode. I was talking about emudebug version and that it would be useful here to have the host-native math calls because this mode is usually used for finding programming errors that are not numerical issues.

For numerics and performance tests you should run on the hardware anyway.