Can I use C++ header files in kernel part of a CUDA code?
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?
精彩评论