Safecall, Error Checking, and freemem Best Practices

Hello all,

I have read the Best practices guide and it doesnt really say anything about Safe_call and Error checking. As well as there seems to be many different types of error checking like cudaError_t() and HANDLE_ERROR() (which is used through out the Cuda By Example book). Can you please give me some adcive about how to use these, weather i should use them, and if they effect efficency of the program.


If i declare a variable in a kernal as shared do i have to free it when im done using it? If so, how do i do so?


When declearing a variable inside of a kernal without specifying memory location, where is the variable stored?
ie.
device test()
{
int one = 0; // <—in what memory does this variable get stored in?
}

Thanks everyone