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?

Answers


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.


Need Your Help

form fields; jquery validation

jquery validation text input

i am trying to validate my form fields calling the input text ids, but jquery is not validating it. here is what i have:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.