aboutsummaryrefslogtreecommitdiff
path: root/matrix/cuda_helper.h
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-06-07 11:55:09 +0800
committerDeterminant <[email protected]>2015-06-07 11:55:09 +0800
commit6e720b961f7edac9c3a41affe0ca40dd0ec9fc85 (patch)
tree19ba0a682f9b75e70e18b796fbe5315ee5953d3a /matrix/cuda_helper.h
parent5bcd5d79875587b08d598cc08bd5f8b1f5e14a23 (diff)
fix memory leak in profiling; other minor changes
Diffstat (limited to 'matrix/cuda_helper.h')
-rw-r--r--matrix/cuda_helper.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/matrix/cuda_helper.h b/matrix/cuda_helper.h
index d6effdb..fde6f18 100644
--- a/matrix/cuda_helper.h
+++ b/matrix/cuda_helper.h
@@ -62,17 +62,14 @@ static const char *cublasGetErrorString(cublasStatus_t err) {
#define PROFILE_START \
do { \
- cudaEvent_t start, stop; \
- cudaEventCreate(&start); \
- cudaEventCreate(&stop); \
- cudaEventRecord(start, 0);
+ cudaEventRecord(profile_start, 0);
#define PROFILE_STOP \
- cudaEventRecord(stop, 0); \
- cudaEventSynchronize(stop); \
+ cudaEventRecord(profile_stop, 0); \
+ cudaEventSynchronize(profile_stop); \
float milliseconds = 0; \
- cudaEventElapsedTime(&milliseconds, start, stop); \
+ cudaEventElapsedTime(&milliseconds, profile_start, profile_stop); \
accu_profile(__func__, milliseconds / 1000); \
} while (0);
-#define PROFILE_END
+#define PROFILE_END
#endif