how to use my existing .cpp code with cuda

后端 未结 3 410
情书的邮戳
情书的邮戳 2020-12-10 10:09

I hv code in c++ and wanted to use it along with cuda.Can anyone please help me? Should I provide my code?? Actually I tried doing so but I need some starting code to procee

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-10 10:34

    You can have multiple .cpp and .cu files in your project. Unless you want your .cu files to contain only device code, it should be fairly easy.

    For your .cu files you specify a header file, containing host functions in it. Then, include that header file in other .cu or .cpp files. The linker will do the rest. It is nothing different than having multiple plain C++ .cpp files in your project.

    I assume you already have CUDA rule files for your Visual Studio.

提交回复
热议问题