是否可以即时(jit)编译CUDA内核? [英] Is just-in-time (jit) compilation of a CUDA kernel possible?

查看:140
本文介绍了是否可以即时(jit)编译CUDA内核?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CUDA是否支持CUDA内核的JIT编译?

Does CUDA support JIT compilation of a CUDA kernel?

我知道OpenCL提供了此功能。

I know that OpenCL offers this feature.

我有一些在运行时不会更改的变量(即仅取决于输入文件),因此我想在内核编译时(即在运行时)使用宏定义这些值。

I have some variables which are not changed during runtime (i.e. only depend on the input file), therefore I would like to define these values with a macro at kernel compile time (i.e at runtime).

如果在编译时手动定义这些值,我的寄存器使用率将从53下降到46,这将大大提高性能。

If I define these values manually at compile time my register usage drops from 53 to 46, what greatly improves performance.

推荐答案

在cuda 7.0的nvrtc库中可用。通过该库,您可以在运行时编译cuda代码。

It became available with nvrtc library of cuda 7.0. By this library you can compile your cuda codes during runtime.

http://devblogs.nvidia.com/parallelforall/cuda-7-release-candidate-feature-overview/

Bu您可以获得什么样的优势?我认为动态编译没有这么多戏剧性的优势。

Bu what kind of advantages you can gain? In my view, i couldn't find so much dramatic advantages of dynamic compilation.

这篇关于是否可以即时(jit)编译CUDA内核?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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