+ // extract a --device option
+ std::vector<char*> argVec;
+ int cudaDevice = -1;
+ for(int ii = 0; ii < argc; ii++) {
+ if(cudaDevice < 0 && strcmp(argv[ii], "--device") == 0 && ii + 1 < argc)
+ cudaDevice = atoi(argv[++ii]);
+ else
+ argVec.push_back(argv[ii]);
+ }
+ argc = (int)argVec.size();
+ argv = &argVec[0];
+ if(!(cudaDevice < 0))
+ // set the cuda device
+ if(rcuda::SetCudaDevice(cudaDevice) != 0)
+ {
+ //XXX this call doesn't work on linux
+ // fixed in upstream source 2010-09-16
+ // http://bolt.berkeley.edu/trac/changeset/22382
+ #ifdef _WIN32
+ boinc_temporary_exit(60);
+ #endif
+ }