Splitting Cuda Project

Hey there ,
as im working on my final project for my Bs.c degree im trying to split my code into classes…
im trying to implement the STRATEGY design pattern but im getting these wired errors that threadIdx
and many other CUDA members are unknown to compiler.

during my project scope , i can define my cuda code on 1 file , and 1 file only?

thanks igal.

I had to re-read that a few times to get what that last sentence means. So if I may, instead of “during my project scope”, you are asking “within my project scope”. So you ultimately need to know whether all the Cuda code needs to be in one file? I don’t know the answer myself, just trying to help get you one.

Yes, all related CUDA code needs to be within the same compilation unit, as there is no linker on the device side. If you want to separate code into different files, you can / have to #include them into one .cu file that is passed to nvcc.