【问题标题】:When I compile my CUDA code,it said:1 error detected in the compilation of "/tmp/tmpxft_00005ff8_00000000-4_lbm.cpp1.ii"当我编译我的CUDA代码时,它说:在“/tmp/tmpxft_00005ff8_00000000-4_lbm.cpp1.ii”的编译中检测到1个错误
【发布时间】:2013-06-21 11:02:37
【问题描述】:

当我通过命令编译我的 CUDA 代码时:

nvcc lbm.cu -I/usr/local/NVIDIA_GPU_Computing_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
/usr/local/NVIDIA_GPU_Computing_SDK/CUDALibraries/common/inc/cutil_inline_runtime.h(329): error: identifier "CURAND_STATUS_DOUBLE_PRECISION_REQUIRED" is undefined

1 error detected in the compilation of "/tmp/tmpxft_00005ff8_00000000-4_lbm.cpp1.ii".

这就是全部内容。 在我编译其他代码的过程中,我从来没有见过它。我能做什么?

【问题讨论】:

  • 我确信“它”的含义远不止于此。您能否编辑您的问题并添加您使用的编译命令和编译器的完整输出。就目前而言,这些信息不足以帮助您。
  • 我已经完成了命令和输出。
  • @WaisFan 可以看看内核的代码吗?
  • kenel 文件的最后三行:" device int ind(int x, int y, int z, int k, int4 dim); device int ind(int x, int y, int dim_x); #endif _LBM_KERNEL_H"

标签: cuda


【解决方案1】:

有一个错误和一个警告。该错误几乎可以肯定是由于您在other question 中列出的情况:

error: identifier "CURAND_STATUS_DOUBLE_PRECISION_REQUIRED" is undefined

如果您想知道为什么会出现该错误,则有必要检查您的代码,尤其是包含该特定标识符 (CURAND_STATUS_DOUBLE_PRECISION_REQUIRED) 的行

这可能是因为您的程序中没有#include "curand.h",它提供了该特定标识符(枚举值)的定义。

警告是由于不寻常的构造引起的:

__device__ int ind(int x, int y, int z, int k, int4 dim);
__device__ int ind(int x, int y, int dim_x);
#endif _LBM_KERNEL_H

最后一行应该是:

#endif // _LBM_KERNEL_H

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多