neka-nat/cupoch

[QST] How to compile a cpp file including a class containing device vector members

SpriteLin-ZJU opened this issue · 4 comments

Hello,
I am a rookie of gpu programming.
According to NVIDIA/thrust#526,
the device vector should not be included in the cpp file. But I see that the cpp file in your example folder calls a lot of classes containing device vector members. I want to know how this is compiled?
@neka-nat

Hi,
Thank you for the question!
Instead of using thrust directly in the cpp file, it is compiled by nvcc and then called in the cpp file.

Dcn303 commented

hi @neka-nat by saying "it is compiled by nvcc and then called in the cpp file" did you meant that you have created that thrust program as a shared library file and then link that library file with the cpp file

hi @neka-nat by saying "it is compiled by nvcc and then called in the cpp file" did you meant that you have created that thrust program as a shared library file and then link that library file with the cpp file

You are correct!

Dcn303 commented