I was wondering if it was possible to use the following CUDA function to initialize for example with FLT_MAX, or 52.34f, instead of juste an int value (0,1 etc…)
I don’t understand the memset functions well enough, but I suspect that you can reinterpret-cast the float to an int. Might be enough to get her going.
Is that what you mean when you say “reinterpret-cast” ?
Unfortunately, with or even without a cast, I always get the same result (in device emulation of course… otherwise I couldn’t see much of what’s going on within the GPU).
And the value that I read, from d_idata is
-0.0013270393 float
(Copy-Paste from the VS2005 debugger)
As if it hadn’t been at all intialized… This is surely inappropriate since int and float don’t have the same length…
Anyway even with int values. The only intialization that I get is with zeroes, even though I tried to initialize with 5 :
Can’t you use cudaMemset2D() with your floating point value encoded in an integer? Traditionally, memset() takes char values and does byte level initialization, but the driver API includes half word and word sized versions of Memset2D, so you might imagine it would work.