ffmpeg versioning mods from Andrew
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / nbodycuda / nbodycuda.cu
1 #include <cuda_runtime.h>
2 #include <cuda_gl_interop.h>
3 #include "helper_cuda.h"
4 #include "helper_gl.h"
5
6 #include "nbodycuda.h"
7
8 void N_BodyCuda::init()
9 {
10         checkCudaErrors(cudaEventCreate(&startEvent));
11         checkCudaErrors(cudaEventCreate(&stopEvent));
12         checkCudaErrors(cudaEventCreate(&hostMemSyncEvent));
13 }
14
15 void N_BodyCuda::init_dev()
16 {
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;
26 }
27
28
29 void N_BodyCuda::finish()
30 {
31         checkCudaErrors(cudaEventDestroy(startEvent));
32         checkCudaErrors(cudaEventDestroy(stopEvent));
33         checkCudaErrors(cudaEventDestroy(hostMemSyncEvent));
34 }
35