|
@@ -77,11 +77,11 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
|
// args
|
|
// args
|
|
char filename[200];
|
|
char filename[200];
|
|
- int quiet=1,timing=0,platform=-1,device=-1;
|
|
|
|
|
|
+ int quiet=1,timing=0,platform=-1,device=-1,use_gpu=-1;
|
|
|
|
|
|
// parse command line
|
|
// parse command line
|
|
if (parseCommandline(argc, argv, filename,
|
|
if (parseCommandline(argc, argv, filename,
|
|
- &quiet, &timing, &platform, &device, &size)) {
|
|
|
|
|
|
+ &quiet, &timing, &platform, &device, &size, &use_gpu)) {
|
|
printUsage();
|
|
printUsage();
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -403,7 +403,7 @@ float eventTime(cl_event event,cl_command_queue command_queue){
|
|
|
|
|
|
// Ke Wang add a function to generate input internally
|
|
// Ke Wang add a function to generate input internally
|
|
int parseCommandline(int argc, char *argv[], char* filename,
|
|
int parseCommandline(int argc, char *argv[], char* filename,
|
|
- int *q, int *t, int *p, int *d, int *size){
|
|
|
|
|
|
+ int *q, int *t, int *p, int *d, int *size, int *use_gpu){
|
|
int i;
|
|
int i;
|
|
if (argc < 2) return 1; // error
|
|
if (argc < 2) return 1; // error
|
|
// strncpy(filename,argv[1],100);
|
|
// strncpy(filename,argv[1],100);
|
|
@@ -440,6 +440,10 @@ int parseCommandline(int argc, char *argv[], char* filename,
|
|
i++;
|
|
i++;
|
|
*d = atoi(argv[i]);
|
|
*d = atoi(argv[i]);
|
|
break;
|
|
break;
|
|
|
|
+ case 'g': // device
|
|
|
|
+ i++;
|
|
|
|
+ *use_gpu = atoi(argv[i]);
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -464,6 +468,7 @@ void printUsage(){
|
|
printf("\n");
|
|
printf("\n");
|
|
printf("-p [int] Choose the platform (must choose both platform and device)\n");
|
|
printf("-p [int] Choose the platform (must choose both platform and device)\n");
|
|
printf("-d [int] Choose the device (must choose both platform and device)\n");
|
|
printf("-d [int] Choose the device (must choose both platform and device)\n");
|
|
|
|
+ printf("-g [int] 1 for gpu and 0 for cpu\n");
|
|
printf("\n");
|
|
printf("\n");
|
|
printf("\n");
|
|
printf("\n");
|
|
printf("Notes: 1. The filename is required as the first parameter.\n");
|
|
printf("Notes: 1. The filename is required as the first parameter.\n");
|