diff --git a/samples/nvopencl/nvopencl.cpp b/samples/nvopencl/nvopencl.cpp index f995d2b474..f9b8b0493f 100644 --- a/samples/nvopencl/nvopencl.cpp +++ b/samples/nvopencl/nvopencl.cpp @@ -421,16 +421,18 @@ char * convert_to_string(const char *fileName) { char c; int i=0; - FILE *infile=fopen(fileName,"r"); //look for nvopencl_kernels.cl in - //current directory which is in boinc\win_build - if (!infile) { //not found - infile = fopen(KERNELS_FILEPATH,"r"); //look for nvopencl_kernels.cl in - //boinc\sample\nvopencl - if (!infile) { - printf("File open Error!"); - exit(0); - } - } + // look for "nvopencl_kernels.cl" in "boinc/samples/nvopencl/debug" or + // in "boinc/samples/nvopencl/release". Note that "nvopencl_kernels.cl" + // is automatically copied to these directories along the building process. + FILE *infile=fopen(fileName,"r"); + if (!infile) { //not found. This typically happens on Linux or Mac. + //look for "nvopencl_kernels.cl" in "boinc/sample/nvopencl/" instead. + infile = fopen(KERNELS_FILEPATH,"r"); + if (!infile) { + printf("File open Error!"); + exit(0); + } + } fseek(infile,0,SEEK_SET); while (fgetc(infile)!=EOF) count++; s=(char *) malloc(sizeof(char)*(count+1)); //add 1 for string terminator. @@ -1077,7 +1079,7 @@ void invertge(cl_float * AI_d, int lda, int n) { /* inverts nxn matrix input and stores the result in output */ void invert(cl_float * input, cl_float *output, int n) { fprintf(stderr,"starting inversion n = %d ", n); - volatile clock_t gputime, gputime0; + volatile clock_t gputime; gputime=clock(); int lda = ((n+15)&~15|16); diff --git a/samples/nvopencl/nvopencl.hpp b/samples/nvopencl/nvopencl.hpp index 1118b74065..985c321b6a 100644 --- a/samples/nvopencl/nvopencl.hpp +++ b/samples/nvopencl/nvopencl.hpp @@ -33,7 +33,7 @@ #define INPUT_FILENAME "input" #define OUTPUT_FILENAME "output" #define KERNELS_FILENAME "nvopencl_kernels.cl" -#define KERNELS_FILEPATH "../samples/nvopencl/nvopencl_kernels.cl" +#define KERNELS_FILEPATH "../../nvopencl_kernels.cl" // for Linux and Mac #define CHECKPOINT_FILE "matrix_inversion_state" #define MATRIX_SIZE 10 #define NUM_ITERATIONS 501 // execute the kernel NUM_ITERATIONS times