It looks like the examples in one of the CUDA books (CUDA for example: an introduction to general-purpose programming GPUs) never reset pointers when they are initialized.
Two questions:
Does the GPU use 0x0 (or the integer 0) as a NULL pointer? Should we follow the C / C ++ pointer practice with device pointers (e.g. reset them when initializing)
Do I need to check if the pointer is NULL before cudaFree? if (devPtr) HANDLE_ERROR (cudaFree (devPtr));
Someone said that for the Fermi architecture 0x0 is used for shared memory on the chip, it seems that everything is still in order to suggest that 0x0 should not be indicated by the pointer used.
http://forums.thedailywtf.com/forums/p/25369/273567.aspx
What about Kepler architecture? What does the GPU do with address 0x0?
Thank!
source
share