代码之家  ›  专栏  ›  技术社区  ›  mahmood

cuda-7.5的标识符“uu shfl_down”未定义

  •  0
  • mahmood  · 技术社区  · 5 年前

    在ubuntu 14.04上用gcc 4.8.4在cuda 7.5上编译程序时(相当旧的配置),我得到了这个错误

    error: identifier "__shfl_down" is undefined
          detected during instantiation of "T gmx_shfl_down_sync(unsigned int, T, unsigned int, int) [with T=float]" 
    

    指的是

    template <typename T>
    static __forceinline__ __device__
    T gmx_shfl_down_sync(const unsigned int activeMask,
                     const T            var,
                     unsigned int       offset,
                     int                width = warp_size)
    {
    #if GMX_CUDA_VERSION < 9000
        GMX_UNUSED_VALUE(activeMask);
        return __shfl_down(var, offset, width);
    #else
        return __shfl_down_sync(activeMask, var, offset, width);
    #endif
    }
    

    有什么办法解决这个问题吗?我在旧的cuda版本中看到了这个问题,但还没有看到一个明确的答案。

    1 回复  |  直到 5 年前
        1
  •  1
  •   Robert Crovella    5 年前

    Warp shuffle内部函数仅定义(仅支持)计算能力(cc)3.0架构和更高版本。

    在CUDA 8.0之后,这些是 nvcc ,因此即使您为默认体系结构(3.0)编译,它也将正确编译。

    但是为了 CUDA 8.0 and prior ,仍然支持cc 2.x体系结构 无船承运人 仍然是“默认”体系结构(如果在 无船承运人 编译命令行)。

    因此,在CUDA8.0和更早版本(CUDA6中引入了warp shuffle)上,如果指定一个cc 2.x体系结构,或者不指定体系结构,则会看到此错误。

    由于cc 2.x架构不支持warp shuffle,因此解决方案是在 无船承运人 编译命令行 -arch=sm_30 或类似的。