tags:

views:

335

answers:

2

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?

+1  A: 

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?

Brooks Moses
I am gathering information right now. I am writing the code in C++ and want to change it to CUDA after that.
Pooya
A: 

Im having the same problem....i wanna compare string in the kernel code....how can i do this? If i use the following line: if(a==b)//a and b are wstrings { foo; } i get the following error: Error: External calls are not supported (found non-inlined call to _ZSteqIwSt11char_traitsIwESaIwEEbRKSbIT_T0_T1_ES8_) make: *** [cu_ScoreHolder.o] Error 2

Help plzzz...

ananth