CUDA Math API:无法使用atan2功能

时间:2016-04-18 21:06:37

标签: c++ cuda

我在Windows 7和VS2013上使用CUDA / C ++。我的GPU有cc 5.2,我用这个cc编译我的代码。 在我的代码中,我在设备内核中使用sin()cos()sqrt函数,一切正常。现在我想使用CUDA documentation中列出的atan2函数。但是,由于错误,我无法构建我的代码:

error : calling a __host__ function("atan2<int, int> ") from a __global__        function("CalcPsi") is not allowed

据我所知,此功能仅在主机上识别。我试图搜索CUDA文档和SO,但没有找到任何有关错误的信息。我想知道我是否遗漏了一些未将我的项目与某些静态库链接起来的标题。我在项目中包含以下标题:

#include <cufft.h>
#include <cuda_runtime.h>
#include <iostream>
#include <cuda.h> 

这是完整的输出。

1>------ Build started: Project: EBeqationSolverdoubleNematic, Configuration:     Debug x64 ------
1>  Compiling CUDA source file GPU.cu...
1>  
1>  C:\programs\misha\cuda\Projects\Edwards-    Berris\EBeqationSolverdoubleNematic\EBeqationSolverdoubleNematic>"C:\Program     Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\bin\nvcc.exe" -    gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env --cl-version     2013 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio     12.0\VC\bin\x86_amd64"  -I"C:\Program Files\MATLAB\R2012a\extern\include" -    I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include" -I"C:\Program     Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include"  -G   --keep-dir x64\Debug     -maxrregcount=0  --machine 64 --compile -cudart static  -g   -DWIN32 -DWIN64 -    D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd  " -o     x64\Debug\GPU.cu.obj "C:\programs\misha\cuda\Projects\Edwards-    Berris\EBeqationSolverdoubleNematic\EBeqationSolverdoubleNematic\GPU.cu" 
1>C:/programs/misha/cuda/Projects/Edwards-    Berris/EBeqationSolverdoubleNematic/EBeqationSolverdoubleNematic/GPU.cu(254):     error : calling a __host__ function("atan2<int, int> ") from a __global__     function("CalcPsi") is not allowed
1>  GPU.cu
1>C:\Program Files     (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\CUDA     6.5.targets(593,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU     Computing Toolkit\CUDA\v6.5\bin\nvcc.exe" -    gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env --cl-version     2013 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio     12.0\VC\bin\x86_amd64"  -I"C:\Program Files\MATLAB\R2012a\extern\include" -    I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include" -I"C:\Program     Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include"  -G   --keep-dir x64\Debug     -maxrregcount=0  --machine 64 --compile -cudart static  -g   -DWIN32 -DWIN64 -    D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd  " -o     x64\Debug\GPU.cu.obj "C:\programs\misha\cuda\Projects\Edwards-    Berris\EBeqationSolverdoubleNematic\EBeqationSolverdoubleNematic\GPU.cu"" exited     with code 2.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

谢谢,

米哈伊尔

0 个答案:

没有答案