问题描述
我正在尝试使用 dpct 迁移我的 cuda 应用程序。调用dpct时;我看到它处理 CUDA 文件并生成一些良性警告,但最后它退出而不写出任何 DPC++ 等效文件。我可以清楚地看到这些应用程序中调用的 CUDA 函数,删除 CUDA 路径将使编译过程失败。这是命令我用过
$ dpct --report-type=all --cuda-include-path=/usr/local/cuda-10.2/include -p compile_commands.json"
我已经消除了文件的实际物理路径以避免混淆:
Processing: ....../ComputeThermogPU.cu
Processing: ....../CommunicatorGPU.cu
Processing: ....../ParticleData.cu
Processing: ....../Integrator.cu
------------------APIS report--------------------
API name Frequency
-------------------------------------------------
----------Stats report---------------
File name,LOC migrated to DPC++,LOC migrated to helper functions,LOC not needed to migrate,LOC not able to migrate
....../Integrator.cu,1,168,0
....../ParticleData.cu,402,0
....../ComputeThermogPU.cu,686,0
....../ParticleGroup.cu,6,111,0
Total migration time: 17207.371000 ms
-------------------------------------
dpct exited with code: 1 (Migration not necessary)```
解决方法
我可以找到我自己问题的解决方案
采用
dpct -p compile_commands.json --in-root=src --out-root=dpct_out --process-all
我认为原因可能是,由于缺少驱动程序代码(包含主函数),DPCT 认为由于这些帮助程序 .cu 文件无论如何都没有被使用,因此不需要对这些文件执行迁移。这就是您看到“不需要迁移”警告的原因。