I want to compare two strings in a kernel function. Can I use strcomp in file? Generally, can 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?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.