我正在使用JOCL库(由JOGAMP提供),我想知道是否有可能测量从主机到设备传输数据所用的时间,内核所用的时间以及分别获取结果所用的时间?
目前我像这样调用我的内核:
queue.putReadBuffer(...).put1DKernel(...).putWriteBuffer(...)
发布于 2013-04-27 21:21:46
为了回答我自己的问题;-)该过程类似于this...first创建一个具有所需容量的CLEventList,因为我只想测量内核执行,所以我将其设置为1。
CLEventList list = new CLEventList(1);现在,当您将内核设置到命令队列中时,您可以将列表作为参数添加:
queue.putReadBuffer(...).put1DKernel(..., list).putWriteBuffer(...).finish();之后,您可以通过调用以下命令来获取时间:
long start = list.getEvent(0).getProfilingInfo(ProfilingCommand.START);
long end = list.getEvent(0).getProfilingInfo(ProfilingCommand.END);
long duration = end - start // time in nanoseconds不要忘记在启用Mode.PROFILING_MODE的情况下初始化命令队列。
https://stackoverflow.com/questions/16192243
复制相似问题