VS2008没有编译cuda [英] VS2008 not compiling cuda

查看:899
本文介绍了VS2008没有编译cuda的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

总之,当我尝试在IDE中编译一个 VS2008 项目时,它会失败,但是当我在命令提示符下使用相同的命令行时,它会编译。


$ b Cuda 工具包3.2。还安装了 VS2010
执行以下操作:步骤


  1. 添加了自定义规则文件,位于:
    C:\Program文件)\NVIDIA GPU计算工具包\CUDA\v3.2\extras\visual_studio_integration\rules

  2. 然后添加 C:\ Program Files(x86)\NVIDIA GPU计算工具包\CUDA\v3.2\lib\x64 中的其他库目录;一般在项目的属性和 cudart.lib cuda.lib

请让我知道是否有遗漏。



输出set命令在cmd提示符是:

  CUDA_BIN_PATH = C:\Program Files \ NVIDIA GPU计算工具包\CUDA\v3.2\\bin 
CUDA_INC_PATH = C:\Program Files \ NVIDIA GPU计算工具包\CUDA \v3.2 \\include
CUDA_LIB_PATH = C:\Program Files \NVIDIA GPU计算工具包\CUDA\v3.2\\lib\x64
CUDA_PATH = C:\Program Files \NVIDIA GPU计算工具包\CUDA\v3.2\
CUDA_PATH_V3_2 = C:\Program Files \ NVIDIA GPU计算工具包\CUDA \v3.2 \

糟糕,忘记了错误讯息

 code> 1 GT; t.cu.obj:错误LNK2019:无法解析的外部符号___ cudaUnregisterFatBinary @ 4在功能上引用的无效__cdecl __cudaUnregisterBinaryUtil(无效)
1 GT; t.cu(__ cudaUnregisterBinaryUtil @@ YAXXZ?)。 OBJ:错误LNK2019:解析外部符号_cudaLaunch @ 4在功能上引用的枚举cudaError __cdecl cudaLaunch<焦炭>(字符*)(?$ cudaLaunch @ð@@ YA AW4cudaError @@ PAD @ Z?)
1> ; t.cu.obj:错误LNK2019:解析外部符号_cudaSetupArgument @ 12函数引用无效__cdecl __device_stub__Z12compute_sum4P6float4S0_S0_i(结构* float4变量,结构* float4变量,结构* float4变量,INT)(__ device_stub__Z12compute_sum4P6float4S0_S0_i @@ YAXPAUfloat4 @@ 00H @ Z? )
1> t.cu.obj:错误LNK2019:无法解析的外部符号___ cudaRegisterFunction @ 40函数引用无效__cdecl __sti ____ cudaRegisterAll_47_tmpxft_00000ea8_00000000_8_t_compute_10_cpp1_ii_65ce9b46(无效)(__ STI ____ cudaRegisterAll_47_tmpxft_00000ea8_00000000_8_t_compute_10_cpp1_ii_65ce9b46 @@ YAXXZ)
1> t.cu? OBJ:错误LNK2019:无法解析的外部符号___ cudaRegisterFatBinary @函数引用4无效__cdecl __sti ____ cudaRegisterAll_47_tmpxft_00000ea8_00000000_8_t_compute_10_cpp1_ii_65ce9b46(无效)
1> t.cu.obj(__ STI ____ cudaRegisterAll_47_tmpxft_00000ea8_00000000_8_t_compute_10_cpp1_ii_65ce9b46 @@ YAXXZ?):错误LNK2019:解析外部符号_cudaEventDestroy @ 4在函数_main
1 GT引用; t.cu.obj:错误LNK2019:解析外部符号_cudaEventElapsedTime @ 12在功能上_main
1 GT引用; t.cu.obj:错误LNK2019:解析外部符号_cudaEventSynchronize @ 4引用在函数_main
1> t.cu.obj:error LNK2019:未解析的外部符号_cudaConfigureCall @ 32引用在函数_main
1> t.cu.obj:error LNK2019:未解析的外部符号_cudaEventRecord @ 8在函数_main中引用
1> t.cu.obj:error LNK2019:未解析的外部符号_cudaThreadSynchronize @ 0在函数_main中引用
1> t.cu.obj:error LNK2019:未解析的外部符号_cudaEventCreate @ 4在函数_main中引用
1> t.cu.obj:error LNK2019:未解析的外部符号_cudaMemcpy @ 16在函数_main中引用
1> t.cu.obj:error LNK2019:未解析的外部符号_cudaMalloc @ 8引用在函数_main
1> D:\projects\cup1\Debug\cup1.exe:致命错误LNK1120:14未解决的外部

这是命令行

  C:\ Program Files \ NVIDIA GPU计算工具包\CUDA \v3.2\\bin\\\
vcc.exe-gencode = arch = compute_10,code = \sm_10,compute_10 \ - gencode = arch = compute_20,code = \sm_20,compute_20 \--machine 32 -ccbinC:\Program Files(x86)\Microsoft Visual Studio 9.0 \VC\bin-Xcompiler/ EHsc / W3 / nologo / O2 / Zi / MT-IC:\Program Files \ NVIDIA GPU计算工具包\CUDA \v3.2 \\include-maxrregcount = 32 --compile -o Debug / t.cu.objt.cu


解决方案

您正在使用nvcc编译32位( - 机器32 ),但您的链接的cuda库是64位( [..] \lib \ x64 )。


In short, when I try to compile a VS2008 project inside the IDE, it fails, but when I use the same command line on command prompt, it compiles. Can anybody help?

Details

Using VS2008 with Cuda toolkit 3.2. Also have VS2010 installed. Did the following: steps before starting the procedure.

  1. Added a custom rule file, which was in: C:\Program Files (x86)\NVIDIA GPU Computing Toolkit\CUDA\v3.2\extras\visual_studio_integration\rules
  2. Then added C:\Program Files (x86)\NVIDIA GPU Computing Toolkit\CUDA\v3.2\lib\x64 to additional library directories in linker->general in project's properties and cudart.lib and cuda.lib to additional dependencies.

Please let me know if I'm missing something.

The output of set command on cmd prompt is:

CUDA_BIN_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\\bin
CUDA_INC_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\\include
CUDA_LIB_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\\lib\x64
CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\
CUDA_PATH_V3_2=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\

Oops, forgot the error messages.

1>t.cu.obj : error LNK2019: unresolved external symbol ___cudaUnregisterFatBinary@4 referenced in function "void __cdecl __cudaUnregisterBinaryUtil(void)" (?__cudaUnregisterBinaryUtil@@YAXXZ)
1>t.cu.obj : error LNK2019: unresolved external symbol _cudaLaunch@4 referenced in function "enum cudaError __cdecl cudaLaunch<char>(char *)" (??$cudaLaunch@D@@YA?AW4cudaError@@PAD@Z)
1>t.cu.obj : error LNK2019: unresolved external symbol _cudaSetupArgument@12 referenced in function "void __cdecl __device_stub__Z12compute_sum4P6float4S0_S0_i(struct float4 *,struct float4 *,struct float4 *,int)" (?__device_stub__Z12compute_sum4P6float4S0_S0_i@@YAXPAUfloat4@@00H@Z)
1>t.cu.obj : error LNK2019: unresolved external symbol ___cudaRegisterFunction@40 referenced in function "void __cdecl __sti____cudaRegisterAll_47_tmpxft_00000ea8_00000000_8_t_compute_10_cpp1_ii_65ce9b46(void)" (?__sti____cudaRegisterAll_47_tmpxft_00000ea8_00000000_8_t_compute_10_cpp1_ii_65ce9b46@@YAXXZ)
1>t.cu.obj : error LNK2019: unresolved external symbol ___cudaRegisterFatBinary@4 referenced in function "void __cdecl __sti____cudaRegisterAll_47_tmpxft_00000ea8_00000000_8_t_compute_10_cpp1_ii_65ce9b46(void)" (?__sti____cudaRegisterAll_47_tmpxft_00000ea8_00000000_8_t_compute_10_cpp1_ii_65ce9b46@@YAXXZ)
1>t.cu.obj : error LNK2019: unresolved external symbol _cudaEventDestroy@4 referenced in function _main
1>t.cu.obj : error LNK2019: unresolved external symbol _cudaEventElapsedTime@12 referenced in function _main
1>t.cu.obj : error LNK2019: unresolved external symbol _cudaEventSynchronize@4 referenced in function _main
1>t.cu.obj : error LNK2019: unresolved external symbol _cudaConfigureCall@32 referenced in function _main
1>t.cu.obj : error LNK2019: unresolved external symbol _cudaEventRecord@8 referenced in function _main
1>t.cu.obj : error LNK2019: unresolved external symbol _cudaThreadSynchronize@0 referenced in function _main
1>t.cu.obj : error LNK2019: unresolved external symbol _cudaEventCreate@4 referenced in function _main
1>t.cu.obj : error LNK2019: unresolved external symbol _cudaMemcpy@16 referenced in function _main
1>t.cu.obj : error LNK2019: unresolved external symbol _cudaMalloc@8 referenced in function _main
1>D:\projects\cup1\Debug\cup1.exe : fatal error LNK1120: 14 unresolved externals

This is the command line:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\\bin\nvcc.exe"    -gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_20,code=\"sm_20,compute_20\"  --machine 32 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin"    -Xcompiler "/EHsc /W3 /nologo /O2 /Zi   /MT  "  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\\include" -maxrregcount=32  --compile -o "Debug/t.cu.obj" t.cu 

解决方案

You are compiling with nvcc for 32bit (--machine 32) but your linked cuda libs are 64bit ([..]\lib\x64).

这篇关于VS2008没有编译cuda的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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