cudaDeviceReset v. cudaFree
There are various questions regarding the proper use of cudaDeviceReset(), but I haven't been able to find an answer to the following question.
The doc on cudaDeviceReset() says that it explicitly destroys and cleans up all resources associated with the current device in the current process.
Suppose I have a program with many arrays, all allocated with cudaMalloc. Could I use cudaDeviceReset instead of many cudaFree statements at the end of my program to quickly free all the memory on the device? Are there any disadvantages to doing so?
You can call cudaDeviceReset() at the end of your application if you choose. In fact, this is recommended for proper usage of the visual profiler.
If you are in fact finished with the GPU and ready to exit your application, there should be no downside to using cudaDeviceReset() if you choose. Note that probably niether of these methods (cudaDeviceReset vs. many cudaFree statements) are really necessary in this scenario, since application exit will also free the resources (due to destruction of the cuda context at application exit). But note the statement above about profiler usage.