Why don't the CUDA compiler intrinsics __fadd_rd etc work for me?

喜你入骨 提交于 2019-12-08 05:06:26

问题


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

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.

Edit: 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"

回答1:


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

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"

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.



来源:https://stackoverflow.com/questions/13966469/why-dont-the-cuda-compiler-intrinsics-fadd-rd-etc-work-for-me

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!