是否有可能具有数量不同的CUDA内核?

编程入门 行业动态 更新时间:2024-10-12 03:17:06
本文介绍了是否有可能具有数量不同的CUDA内核?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想制作一个内核,它带有许多未设置的参数.这可能吗?

I would like to make a kernel which takes a number of arguments, that is not set. Is this possible?

我猜这行不通吗?但为什么?

I guess this does not work? But why?

推荐答案

如果您要询问典型的C风格变量,则不可以.

if you are asking about typical C style vargs, then no.

但是,因为内核支持C ++链接,所以存在一些模板和名称修饰技巧,可用于实例化具有长度和不同类型的参数列表的内核的不同版本.还请注意,CUDA 7.0引入了C ++ 11可变参数模板支持.

But because kernels support C++ linkage, there are template and name mangling tricks which can be used to instantiate different versions of a kernel with length and different types of argument lists. Note also that CUDA 7.0 introduces C++11 variadic template support.

因此,有很多选择可以做到这一点,但可能不是您问问题时所想到的那些选择.

So there are options to do this, but probably not the ones you were thinking of when you asked the question.

[此答案由评论汇总而成,并作为社区Wiki条目添加,以使问题摆脱未答复的队列]

[This answer assembled from comments and added as a community wiki entry to get the question off the unanswered queue]

更多推荐

是否有可能具有数量不同的CUDA内核?

本文发布于:2023-06-02 00:58:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/430936.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有可能   内核   数量   CUDA

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!