When debugging developing and debugging, I would like to run my code with double precision. However, once I know it's working, I'd like the option to run my code using single precision (i.e. float
s) only. So I'd like to be able to easily switch between these precisions without a large rewrite of code. I was thinking of some #define
flag like
#define PRECISION double
...
thrust::device_vector<PRECISION> myVec;
but the compiler doesn't seem to like that. Any ideas on how to implement this?
I know this question is very similar in that it solves the problem with compiler flags. But I was hoping to be able to directly set a flag directly from within my source code.