From f86a38d332273550341ab9c7030f94339902b5a3 Mon Sep 17 00:00:00 2001 From: Jiaming Guo Date: Mon, 5 Dec 2016 13:29:53 -0600 Subject: [PATCH] add device choice and cpu implementation --- main.cu | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/main.cu b/main.cu index cd00c21..a3a7e87 100644 --- a/main.cu +++ b/main.cu @@ -14,6 +14,11 @@ #include #include +#ifdef __CUDACC__ +//CUDA includes +#include +#endif + //ANN includes //#include @@ -29,9 +34,9 @@ stim::gl_network GT; //ground truth network stim::gl_network T; //test network //hard-coded parameters -float resample_rate = 0.5; //sample rate for the network (fraction of sigma used as the maximum sample rate) -float camera_factor = 1.2; //start point of the camera as a function of X and Y size -float orbit_factor = 0.01; //degrees per pixel used to orbit the camera +float resample_rate = 0.5f; //sample rate for the network (fraction of sigma used as the maximum sample rate) +float camera_factor = 1.2f; //start point of the camera as a function of X and Y size +float orbit_factor = 0.01f; //degrees per pixel used to orbit the camera //mouse position tracking int mouse_x; @@ -195,11 +200,26 @@ void glut_initialize(){ cam.LookAt(c[0], c[1], c[2]); //look at the center of the network } +#ifdef __CUDACC__ +void setdevice(int &device){ + int count; + cudaGetDeviceCount(&count); // numbers of device that are available + if(count < device + 1){ + std::cout<<"No such device available, please set another device"<