标识符“__shfl_down"对于 cuda-7.5 未定义 [英] identifier "__shfl_down" is undefined for cuda-7.5

查看:33
本文介绍了标识符“__shfl_down"对于 cuda-7.5 未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 ubuntu 14.04(相当旧的配置)上使用 gcc 4.8.4 在 cuda 7.5 上编译程序时,我收到此错误

While compiling a program on cuda 7.5 with gcc 4.8.4 on ubuntu 14.04 (pretty old config), I get this error

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 版本的这个问题,但还没有看到明确的答案.

Is there any way to fix that? I see this issue for old cuda versions, but haven't seen a clear answer for that.

推荐答案

Warp shuffle 内部函数仅在计算能力 (cc) 3.0 及更高版本中定义(仅支持).

Warp shuffle intrinsics are only defined (only supported on) compute capability (cc) 3.0 architectures and higher.

在 CUDA 8.0 之后,这些是 nvcc 支持的唯一 GPU,因此即使您针对默认架构 (3.0) 进行编译,它也会正确编译.

After CUDA 8.0, those were the only GPUs supported by nvcc, so even if you compile for default architecture (3.0) it will compile correctly.

但是对于 CUDA 8.0 及之前的,cc 2.x 架构是nvcc 仍然支持并且仍然是默认"架构(如果您没有在 nvcc 编译命令行上指定任何架构开关,您会得到什么).

However for CUDA 8.0 and prior, cc 2.x architectures were still supported by nvcc and were still the "default" architecture (what you would get if you didn't specify any architecture switches on the nvcc compile command line).

因此,在 CUDA 8.0 和更早版本(CUDA 6 中引入了warp shuffle)上,如果您指定 cc 2.x 架构或不指定架构,您将看到此错误.

Therefore, on CUDA 8.0 and prior (warp shuffle was introduced in CUDA 6), if you either specify a cc 2.x architecture, or specify no architecture, you will see this error.

由于 cc 2.x 架构不支持 warp shuffle,解决方案是使用 -arch=sm_30 在您的 nvcc 编译命令行上明确指定合适的架构或类似的.

Since warp shuffle is not supported on cc 2.x architectures, the solution is to explicitly specify a suitable architecture on your nvcc compile command line with -arch=sm_30 or similar.

这篇关于标识符“__shfl_down"对于 cuda-7.5 未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆