为什么CUDA编译器内在函数__fadd_rd等不适合我? [英] Why don't the CUDA compiler intrinsics __fadd_rd etc work for me?

查看:305
本文介绍了为什么CUDA编译器内在函数__fadd_rd等不适合我?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么无法使用这些编译器CUDA 5.0中的内在函数?

Why can't I use these compiler intrinsics in CUDA 5.0?

在Visual Studio 2010中,使用CUDA工具包5.0和Nsight安装我可以编译和运行大多数CUDA代码,但 __fadd_ru 等报告为未定义。 是我要编译的代码。

In Visual Studio 2010, with CUDA toolkit 5.0 and Nsight installed I am able to compile and run most CUDA code, but __fadd_ru etc are reported as undefined. This is the code I am trying to compile.

编辑:
当在同一项目中进行以下任一项时,内在函数看起来未定义:

It seems that the intrinsics become undefined when either of the following includes are made in the same project:

#include "cuda_runtime.h"
#include "device_launch_parameters.h"


推荐答案

通过在项目中包含CUDA运行时头文件,会出现问题(不知何故)。

The problem is caused (somehow), by including CUDA runtime headers in the project.

NVCC编译器自动管理cuda运行时,所以你不需要手动包含它来编译。您添加的主要原因

The NVCC compiler manages the includes for the cuda runtime automatically, so you don't need to include it manually to compile. The main reason you would add

#include "cuda_runtime.h"
#include "device_launch_parameters.h"

到您的代码,以便您的IDE不会显示错误的语法错误。由于某些原因,添加 device_launch_parameters.h (其中 cuda_runtime.h 取决于),将导致NVCC的算法出现未定义。

to your code is so that your IDE won't show false syntax errors. For some reason adding device_launch_parameters.h (which cuda_runtime.h depends on), will cause NVCC's intrinsic compiler functions for arithmetic to appear undefined.

所以修复:删除这两个包括从项目当你想编译。

So the fix: remove those two includes from the project when you want to compile.

这篇关于为什么CUDA编译器内在函数__fadd_rd等不适合我?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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