-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.cuh
33 lines (27 loc) · 1.38 KB
/
utils.cuh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once
#include <assert.h>
#include <omp.h>
#include <stdio.h>
// #define OLD_DISP
// #define OLD_JULIA
#define REAL double
// #define USE_CONST_MEM
// For the CUDA runtime routines (prefixed with "cuda_")
#include "helper_cuda.h"
#include <cuda_runtime.h>
#define HANDLE_ERROR checkCudaErrors
#define START_GPU \
{ \
cudaEvent_t start, stop; \
float elapsedTime; \
checkCudaErrors(cudaEventCreate(&start)); \
checkCudaErrors(cudaEventCreate(&stop)); \
checkCudaErrors(cudaEventRecord(start, 0));
#define END_GPU(name) \
checkCudaErrors(cudaEventRecord(stop, 0)); \
checkCudaErrors(cudaEventSynchronize(stop)); \
checkCudaErrors(cudaEventElapsedTime(&elapsedTime, start, stop)); \
printf("%s Time used: %3.1f ms\n", name, elapsedTime); \
checkCudaErrors(cudaEventDestroy(start)); \
checkCudaErrors(cudaEventDestroy(stop)); \
}