From 6e720b961f7edac9c3a41affe0ca40dd0ec9fc85 Mon Sep 17 00:00:00 2001 From: Determinant Date: Sun, 7 Jun 2015 11:55:09 +0800 Subject: fix memory leak in profiling; other minor changes --- matrix/cuda_helper.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'matrix/cuda_helper.h') 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 -- cgit v1.2.3