In the above piece of code, the error occurs at line number 5. If it is really about “;”, then it should show errors in lines 2, 3 and 4 also. But, the error is shown in line 5 only. I hope this explains my problem.
Yea bad indentation is not an error, but its very bad practice, it makes the program hard to read and hard to identify obvious errors. That piece of code compiles fine here. Could you show more code?
I haven’t tried float4 yet, but the whole point of trying uchar4 is because of memory limitations in my code. For something that can be handled by uchar4, I didn’t want to waste the memory by using float4 which occupies more memory (almost 4 times).
I am attaching the completely compilable and perfectly runnable code which uses uchar3. This code is an experimental sobel edge detection using texture and shared memories. It compiles and runs absolutely fine when I use uchar3, but it doesn’t do the same for uchar4. If anyone can use uchar4 in the same code and let me know about the performance, that will be very helpful. sobel_tex_shared.cu (7.4 KB)
Hi everyone, the problem is solved. A constant ‘w’ has been defined at the top of the code, which is conflicting with the fourth vector of the uchar4 data type. I know that declaring constants can conflict with any other variables in the code with the same name. But, I didn’t realize that they can conflict with one of the vectors of a built-in vector type. So, the ground rule is don’t define any constants with names ‘x’, ‘y’, ‘z’ or ‘w’ in a code which uses built-in vector types. I appreciate the help of all the people here. And, I hope my experience will help others on this issue.