是否有适用于Mac OS X 10.8的opencl分析器? [英] Is there an opencl profiler for mac os X 10.8?
问题描述
我正在尝试在OpenCL内核中找到瓶颈,是否可以在Mac OS X上分析OpenCL程序?我在 http://www.gremedy.com/上找到了gDebugger,但是它需要10.5或10.6才能运行. AMD SDK仅支持Linux和Windows.
I am trying to find the bottleneck in my OpenCL kernel, is it possible to profile OpenCL programms on mac os X? I found gDebugger on http://www.gremedy.com/, but it requires 10.5 or 10.6 to run. AMD SDK supports only Linux and Windows.
山狮有探查器吗?
推荐答案
分析信息必须有多详细?
可以使用内置的内部事件探查器吗?
可以使用CL_QUEUE_PROFILING_ENABLE标志创建OpenCL队列.
How detailed must your profiling information be?
Is it okay to use the built-in internal profiler?
OpenCL queues can be created with the CL_QUEUE_PROFILING_ENABLE flag.
这样,您可以看到每个执行的内核:
什么时候来了
This way you can see for each kernel you executed:
When it has been
- 已入队
- 提交给您的OCL设备
- 开始
- 已结束
使用 C ++绑定,队列的创建如下所示:
With C++-Bindings, the creation of the queue can look like this:
_queue = new cl::CommandQueue(_context, _device, CL_QUEUE_PROFILING_ENABLE );
分析信息的提取看起来像这样:
The extration of the profiling information looks like this:
1)保存要分析的已排队内核提供的事件对象(在数组中).
1) Save the event object (in an array) delivered by the enqueued kernel you want to profile.
cl::Event evt;
_queue->enqueueNDRangeKernel( _kernel, cl::NullRange, _range, cl::NullRange, NULL, &evt);
2)执行队列后,提取性能分析信息
2) After execution of the queue, extract the profiling information
std::vector<cl::Event> evts;
//add all events to this vector here
//cl::Event evt;
//_queue->enqueueNDRangeKernel( _kernel, cl::NullRange, _range, cl::NullRange, NULL, &evt);
//evts.push_back(evt);
uint64_t param;
for (unsigned int i=0; i<evts.size(); i++)
{
evts[i].getProfilingInfo(CL_PROFILING_COMMAND_QUEUED, ¶m);
printf("%u: %llu", i, param);
evts[i].getProfilingInfo(CL_PROFILING_COMMAND_SUBMIT, ¶m);
printf(" %llu", param);
evts[i].getProfilingInfo(CL_PROFILING_COMMAND_START, ¶m);
printf(" %llu", param);
evts[i].getProfilingInfo(CL_PROFILING_COMMAND_END, ¶m);
printf(" %llu\n", param);
}
这篇关于是否有适用于Mac OS X 10.8的opencl分析器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!