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

查看:476
本文介绍了标识符“ __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 ,因此即使您针对默认架构(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及更低版本 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,因此解决方案是在 nvcc上明确指定合适的体系结构 -arch = sm_30 或类似的命令行编译。

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天全站免登陆