#include #include #include #include using namespace std; #include "ini.cxx" #include "pro.cu" dats e=d; // copy of "d" for device dats *ed; // pointer to structure on device unsigned int pmax, pn; photon * pz; float deviceTime=0; cudaDeviceProp prop; int nblk; void checkError(cudaError result){ if(result!=cudaSuccess){ cerr<<"Error: "<>>(ed, num); checkError(cudaGetLastError()); checkError(cudaEventRecord(evt2, NULL)); checkError(cudaEventSynchronize(evt2)); checkError(cudaEventElapsedTime(&dt, evt1, evt2)); deviceTime+=dt; checkError(cudaEventDestroy(evt1)); checkError(cudaEventDestroy(evt2)); checkError(cudaThreadSynchronize()); } { checkError(cudaMemcpy(&e, ed, sizeof(int), cudaMemcpyDeviceToHost)); unsigned int size=e.hidx*sizeof(hit); checkError(cudaMemcpy(d.hits, e.hits, size, cudaMemcpyDeviceToHost)); } cerr<<"photons: "<=e.hnum) cerr<<"Error: data buffer overflow occurred!"<0; i-=pmax){ if(i1) device=atoi(arg_a[1]); checkError(cudaSetDevice(device)); checkError(cudaGetDeviceProperties(&prop, device)); fprintf(stderr, "Processing f2k muons from stdin on device %d\n", device); f2k(); } else{ int str=0, dom=0, device=0; unsigned long long num=1000000ULL; if(arg_c>1) str=atoi(arg_a[1]); if(arg_c>2) dom=atoi(arg_a[2]); if(arg_c>3) num=(unsigned long long) atof(arg_a[3]); if(arg_c>4) device=atoi(arg_a[4]); checkError(cudaSetDevice(device)); checkError(cudaGetDeviceProperties(&prop, device)); fprintf(stderr, "Running flasher simulation on device %d\n", device); flasher(str, dom, num); } fprintf(stderr, "\nDevice time: %2.1f [ms]\n", deviceTime); checkError(cudaThreadExit()); }