opencl中的clock() [英] clock() in opencl

查看:159
本文介绍了opencl中的clock()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道CUDA中有一个函数clock(),您可以在其中放入内核代码并查询GPU时间.但是我想知道OpenCL中是否存在这样的事情?有什么方法可以在OpenCL中查询GPU时间? (我正在使用NVIDIA的工具包).

I know that there is function clock() in CUDA where you can put in kernel code and query the GPU time. But I wonder if such a thing exists in OpenCL? Is there any way to query the GPU time in OpenCL? (I'm using NVIDIA's tool kit).

推荐答案

NVIDIA OpenCL SDK有一个示例 PTX:并行线程中介绍了%clock执行ISA 手册.您应该可以将%% laneid替换为%% clock.

The NVIDIA OpenCL SDK has an example Using Inline PTX with OpenCL. The clock register is accessible through inline PTX as the special register %clock. %clock is described in PTX: Parallel Thread Execution ISA manual. You should be able to replace the %%laneid with %%clock.

我从未在OpenCL中测试过它,而是在CUDA中使用它.

I have never tested this with OpenCL but use it in CUDA.

请注意编译器可能会重新排序或删除读取的寄存器.

Please be warned that the compiler may reorder or remove the register read.

这篇关于opencl中的clock()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆