1 #include <cuda_runtime.h>
2 #include <cuda_gl_interop.h>
3 #include "helper_cuda.h"
8 void N_BodyCuda::init()
10 checkCudaErrors(cudaEventCreate(&startEvent));
11 checkCudaErrors(cudaEventCreate(&stopEvent));
12 checkCudaErrors(cudaEventCreate(&hostMemSyncEvent));
15 void N_BodyCuda::init_dev()
17 // int dev_id = findCudaDevice(argc, (const char **)argv);
18 int dev_id = gpuGetMaxGflopsDeviceId();
19 checkCudaErrors(cudaSetDevice(dev_id));
20 cudaDeviceProp deviceProp;
21 checkCudaErrors(cudaGetDeviceProperties(&deviceProp, dev_id));
22 printf("GPU Device %d: \"%s\" with compute capability %d.%d\n",
23 dev_id, deviceProp.name, deviceProp.major, deviceProp.minor);
24 version = deviceProp.major * 10 + deviceProp.minor;
25 numSMs = deviceProp.multiProcessorCount;
29 void N_BodyCuda::finish()
31 checkCudaErrors(cudaEventDestroy(startEvent));
32 checkCudaErrors(cudaEventDestroy(stopEvent));
33 checkCudaErrors(cudaEventDestroy(hostMemSyncEvent));