0

I have a task to make a simple profiling tool (winOS) for performance/timing/event analysis of OpenCL programs. Can someone give advice how to start?

4

2 回答 2

1

The simplest one and works accurately on all platforms:

  cl_event perfEvent;
  cl_ulong start=0, end=0;
  float t_kernel;

  /* Enqueue kernel */
  clEnqueueNDRangeKernel(commandQueue, kernel, 1, NULL, globalWorkSize, localWorkSize, 0, NULL, &perfEvent);
  clWaitForEvents( 1, &perfEvent );

  /* Get the execution time */
  clGetEventProfilingInfo(perfEvent, CL_PROFILING_COMMAND_START, sizeof(cl_ulong), &start, NULL);
  clGetEventProfilingInfo(perfEvent, CL_PROFILING_COMMAND_END, sizeof(cl_ulong), &end, NULL);
  t_kernel = (end-start)/1000000.0f;
  std::cout << t_kernel << std::endl;
于 2012-06-22T01:29:52.727 回答
0

Take a look at AMD CodeXL. It's free and it might be just what you are looking for. Inside CodeXL, use the Application Timeline Trace mode (Profile -> Application Timeline Trace), which executes a program and generates a visual timeline that displays OpenCL events like kernel dispatch and data transfer operations.

于 2015-05-25T10:45:38.987 回答