开发者

Can I use C++ header files in kernel part of a CUDA code?

开发者 https://www.devze.com 2022-12-25 00:14 出处:网络
I want to compare two strings in a kernel function. Can I use strcomp infile? Generally, ca开发者_如何学运维n I use C++ libraries in my CUDA code? It would surprising if the CUDA libraries include a k

I want to compare two strings in a kernel function. Can I use strcomp in file? Generally, ca开发者_如何学运维n I use C++ libraries in my CUDA code?


It would surprising if the CUDA libraries include a kernel-side version of the C++ standard library, which you would need in order for this to work, since (as Paul R noted in a comment), this and many other standard functions are not particularly appropriate for GPU acceleration.

According to the CUDA language rules, only __device__ functions are callable from the Device. Functions such as strcmp are not declared as __device__ in the C++ standard library, so if the CUDA language does not include them as extensions -- and it does not, since the CUDA Programming Guide does not include any documentation of them -- then they cannot be used in kernels.

What happened when you tried it?

0

精彩评论

暂无评论...
验证码 换一张
取 消