该代码是从 Windows 系统开发的,当我在 Linux 系统中通过命令编译我的 CUDA 代码时:
nvcc lbm.cu -I/usr/local/cuda_sdk/CUDALibraries/common/inc -lm
编译器输出为:
In file included from lbm.cu:15:
lbm_kernel.h:52:8: warning: extra tokens at end of #endif directive
In file included from lbm.cu:15:
lbm_kernel.h:52:8: warning: extra tokens at end of #endif directive
/tmp/tmpxft_00001fda_00000000-13_lbm.o: In function "main":
tmpxft_00001fda_00000000-1_lbm.cudafe1.cpp:(.text+0xce7): undefined reference to "cutCheckCmdLineFlag"
tmpxft_00001fda_00000000-1_lbm.cudafe1.cpp:(.text+0x2103): undefined reference to "diff_wz_w(dim3, int, double*, double*, double*)"
tmpxft_00001fda_00000000-1_lbm.cudafe1.cpp:(.text+0x2143): undefined reference to "double gpu_sum<double>(int, int, int, int, int, double*, double*, double*)"
tmpxft_00001fda_00000000-1_lbm.cudafe1.cpp:(.text+0x21ca): undefined reference to "fabs_wz(dim3, int, double*, double*)"
tmpxft_00001fda_00000000-1_lbm.cudafe1.cpp:(.text+0x220a): undefined reference to "double gpu_sum<double>(int, int, int, int, int, double*, double*, double*)"
tmpxft_00001fda_00000000-1_lbm.cudafe1.cpp:(.text+0x22a3): undefined reference to "cpy(dim3, int, double*, double*)"
tmpxft_00001fda_00000000-1_lbm.cudafe1.cpp:(.text+0x2320): undefined reference to "lbm_step(dim3, int, int, double*)"
tmpxft_00001fda_00000000-1_lbm.cudafe1.cpp:(.text+0x23b5): undefined reference to "lbm_bounce_back_exit_inlet(dim3, int, int, float, float, double*, double*)"
tmpxft_00001fda_00000000-1_lbm.cudafe1.cpp:(.text+0x248f): undefined reference to "lbm_bounce_back_hole_wall_1(dim3, int, int, float, float, int, int, int, int, int, int, double*, double*)"
tmpxft_00001fda_00000000-1_lbm.cudafe1.cpp:(.text+0x2501): undefined reference to "lbm_bounce_back_wall_2(dim3, int, int, double*)"
tmpxft_00001fda_00000000-1_lbm.cudafe1.cpp:(.text+0x25a2): undefined reference to "lbm_stream(dim3, int, int, double*, double*)"
tmpxft_00001fda_00000000-1_lbm.cudafe1.cpp:(.text+0x2643): undefined reference to "lbm_den_vel(dim3, int, int, double*, double*, double*, double*, double*)"
/tmp/tmpxft_00001fda_00000000-13_lbm.o: In function "__cutilExit(int, char**)":
tmpxft_00001fda_00000000-1_lbm.cudafe1.cpp:(.text._Z11__cutilExitiPPc[__cutilExit(int, char**)]+0x21): undefined reference to "cutCheckCmdLineFlag"
/tmp/tmpxft_00001fda_00000000-13_lbm.o: In function "cutilDeviceInit(int, char**)':
tmpxft_00001fda_00000000-1_lbm.cudafe1.cpp:(.text._Z15cutilDeviceInitiPPc[cutilDeviceInit(int, char**)]+0x8b): undefined reference to "cutGetCmdLineArgumenti"
collect2: ld returned 1 exit status
我可以为我的代码做什么?