Commit 11b86e0d authored by Peter Eastman's avatar Peter Eastman
Browse files

Call cudaProfilerStop() when destroying a context so profiling will work correctly

parent a106d7d1
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <typeinfo> #include <typeinfo>
#include <cudaProfiler.h>
#define CHECK_RESULT(result) CHECK_RESULT2(result, errorMessage); #define CHECK_RESULT(result) CHECK_RESULT2(result, errorMessage);
...@@ -253,8 +254,10 @@ CudaContext::~CudaContext() { ...@@ -253,8 +254,10 @@ CudaContext::~CudaContext() {
if (thread != NULL) if (thread != NULL)
delete thread; delete thread;
string errorMessage = "Error deleting Context"; string errorMessage = "Error deleting Context";
if (contextIsValid) if (contextIsValid) {
cuProfilerStop();
CHECK_RESULT(cuCtxDestroy(context)); CHECK_RESULT(cuCtxDestroy(context));
}
contextIsValid = false; contextIsValid = false;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment