}
}
-void polly_startTimerByCudaEvent(PollyGPUEvent **Start, PollyGPUEvent **Stop) {
- dump_function();
-
- *Start = malloc(sizeof(PollyGPUEvent));
- if (*Start == 0) {
- fprintf(stdout, "Allocate memory for Polly GPU start timer failed.\n");
- exit(-1);
- }
- CudaEventCreateFcnPtr(&((*Start)->Cuda));
-
- *Stop = malloc(sizeof(PollyGPUEvent));
- if (*Stop == 0) {
- fprintf(stdout, "Allocate memory for Polly GPU stop timer failed.\n");
- exit(-1);
- }
- CudaEventCreateFcnPtr(&((*Stop)->Cuda));
-
- /* Record the start time. */
- CudaEventRecordFcnPtr((*Start)->Cuda, 0);
-}
-
-void polly_stopTimerByCudaEvent(PollyGPUEvent *Start, PollyGPUEvent *Stop,
- float *ElapsedTimes) {
- dump_function();
-
- /* Record the end time. */
- CudaEventRecordFcnPtr(Stop->Cuda, 0);
- CudaEventSynchronizeFcnPtr(Start->Cuda);
- CudaEventSynchronizeFcnPtr(Stop->Cuda);
- CudaEventElapsedTimeFcnPtr(ElapsedTimes, Start->Cuda, Stop->Cuda);
- CudaEventDestroyFcnPtr(Start->Cuda);
- CudaEventDestroyFcnPtr(Stop->Cuda);
- debug_print("Processing time: %f (ms).\n", *ElapsedTimes);
-
- free(Start);
- free(Stop);
-}
-
void polly_copyFromHostToDevice(PollyGPUDevicePtr *DevData, void *HostData,
int MemSize) {
dump_function();
* int *HostData;
* PollyGPUEvent *Start;
* PollyGPUEvent *Stop;
- * float *ElapsedTime;
* int MemSize;
* int BlockWidth = 16;
* int BlockHeight = 16;
* polly_getPTXModule(KernelString, &Module);
* polly_getPTXKernelEntry(Entry, Module, &Kernel);
* polly_setKernelParameters(Kernel, BlockWidth, BlockHeight, DevData);
- * polly_startTimerByCudaEvent(&Start, &Stop);
* polly_launchKernel(Kernel, GridWidth, GridHeight);
* polly_copyFromDeviceToHost(HostData, DevData, MemSize);
- * polly_stopTimerByCudaEvent(Start, Stop, ElapsedTime);
* polly_cleanupGPGPUResources(HostData, DevData, Module, Context, Kernel);
* }
*
void polly_getPTXModule(void *PTXBuffer, PollyGPUModule **Module);
void polly_getPTXKernelEntry(const char *KernelName, PollyGPUModule *Module,
PollyGPUFunction **Kernel);
-void polly_startTimerByCudaEvent(PollyGPUEvent **Start, PollyGPUEvent **Stop);
-void polly_stopTimerByCudaEvent(PollyGPUEvent *Start, PollyGPUEvent *Stop,
- float *ElapsedTimes);
void polly_copyFromHostToDevice(PollyGPUDevicePtr *DevData, void *HostData,
int MemSize);
void polly_copyFromDeviceToHost(void *HostData, PollyGPUDevicePtr *DevData,