I have made some experiments, I can’t access structure’s member id device function, even though I have copied them with cudaMalloc.
Are you sure cuda supports?
Can you give an exact example I can check with?
ext api?
Thank you. What you have answered is too general. Expecting your answer.
To (1) and (3): CUDA is an extension of the C language. You can perform any string operations you can write to code to do in C. Similarly, structs are of course supported. If you are having trouble, post a minimal sample code and we’ll help you find the problem.
If you were referring to the standard library string functions, then the GPU cannot call them. They are host functions and don’t exist on the GPU.
Practically every example in the SDK uses variables in the kernel. The reduction example is simple and easy to understand, it is a good place to start. Oh, and 10k is tiny. You can allocate memory up to the memory limits of your device (~600 MiB on an 8800 GTX or more on Tesla).
functions sscanf and strlen, strcmp, all of them don’t work here. So I decide to write them myself.
for example: hostdevice int strlength(char *str)
{
int i;
for(i=0; str[i]!=‘\0’; i++);
return ++i;
}
I use this function to replace strlen. But it doesn’t work. When the program runs, It throws this exception : There are conflicts on accessing i