I need to use strings in kernel functions but whenever I use it I get the error that host function cannot be called in device code.
I searched about it and found out that as std::string is not primitive data type in c++ it is not allowed to be processed in kernels.
I need to use strings and their functions.
Can anyone please guide me about it ?
any sample code and suggestion would be appreciated.
I have heard about thrust but could not figure out how to use strings in thrust.
That’s correct, std::string is not usable in CUDA device code.
Typical advice would be to handle things as C-style arrays of char
There are various examples on the internet, here are a few:
The last one gives examples of how you could do strcpy, strcat, and strcmp
With perhaps a bit more time spent on integration, you could investigate use of the custrings library:
Thank you very much @Robert_Crovella. Much appreciated