visual studio 2008 - CUDA not working in 64 bit windows 7 -


i have cuda toolkit 4.0 installed in 64 bit windows 7. try building cuda code,

#include<iostream> #include"cuda_runtime.h" #include"cuda.h" __global__ void kernel(){ }  int main(){ kernel<<<1,1>>>(); int c = 0; cudagetdevicecount(&c); cudadeviceprop prop; cudagetdeviceproperties(&prop, 0); std::cout<<"the name is"<<prop.name; std::cout<<"hello world!"<<c<<std::endl; system("pause"); return 0; } 

but operation fails. below build log:

build log rebuild started: project: god, configuration: debug|win32 command lines creating temporary file "c:\users\t-sudhk\documents\visual studio 2008\projects\god\god\debug\bat0000482007500.bat" contents [ @echo off

echo "c:\program files\nvidia gpu computing toolkit\cuda\v4.0\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\v4.0\include" -maxrregcount=0 --compile -o "debug/sample.cu.obj" sample.cu

"c:\program files\nvidia gpu computing toolkit\cuda\v4.0\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\v4.0\include" -maxrregcount=0 --compile -o "debug/sample.cu.obj" "c:\users\t-sudhk\documents\visual studio 2008\projects\god\god\sample.cu"

if errorlevel 1 goto vcreporterror

goto vcend

:vcreporterror

echo project : error prj0019: tool returned error code "compiling cuda build rule..."

exit 1

:vcend ] creating command line """c:\users\t-sudhk\documents\visual studio 2008\projects\god\god\debug\bat0000482007500.bat""" creating temporary file "c:\users\t-sudhk\documents\visual studio 2008\projects\god\god\debug\rsp0000492007500.rsp" contents [ /out:"c:\users\t-sudhk\documents\visual studio 2008\projects\god\debug\god.exe" /libpath:"c:\program files\nvidia gpu computing toolkit\cuda\v4.0\lib\x64" /manifest /manifestfile:"debug\god.exe.intermediate.manifest" /manifestuac:"level='asinvoker' uiaccess='false'" /debug /pdb:"c:\users\t-sudhk\documents\visual studio 2008\projects\god\debug\god.pdb" /dynamicbase /nxcompat /machine:x86 cudart.lib cuda.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

".\debug\sample.cu.obj" ] creating command line "link.exe @"c:\users\t-sudhk\documents\visual studio 2008\projects\god\god\debug\rsp0000492007500.rsp" /nologo /errorreport:prompt" output window compiling cuda build rule... "c:\program files\nvidia gpu computing toolkit\cuda\v4.0\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\v4.0\include" -maxrregcount=0 --compile -o "debug/sample.cu.obj" sample.cu sample.cu sample.cu.obj : error lnk2019: unresolved external symbol _cudalaunch@4 referenced in function "enum cudaerror cdecl cudalaunch(char *)" (??$cudalaunch@d@@ya?aw4cudaerror@@pad@z) sample.cu.obj : error lnk2019: unresolved external symbol ___cudaregisterfunction@40 referenced in function "void __cdecl _sti_cudaregisterall_52_tmpxft_00001c68_00000000_8_sample_compute_10_cpp1_ii_b81a68a1(void)" (?sti__cudaregisterall_52_tmpxft_00001c68_00000000_8_sample_compute_10_cpp1_ii_b81a68a1@@yaxxz) sample.cu.obj : error lnk2019: unresolved external symbol _cudaregisterfatbinary@4 referenced in function "void __cdecl _sti_cudaregisterall_52_tmpxft_00001c68_00000000_8_sample_compute_10_cpp1_ii_b81a68a1(void)" (?sti__cudaregisterall_52_tmpxft_00001c68_00000000_8_sample_compute_10_cpp1_ii_b81a68a1@@yaxxz) sample.cu.obj : error lnk2019: unresolved external symbol _cudagetdeviceproperties@8 referenced in function _main sample.cu.obj : error lnk2019: unresolved external symbol _cudagetdevicecount@4 referenced in function _main sample.cu.obj : error lnk2019: unresolved external symbol _cudaconfigurecall@32 referenced in function _main c:\users\t-sudhk\documents\visual studio 2008\projects\god\debug\god.exe : fatal error lnk1120: 7 unresolved externals results build log saved @ "file://c:\users\t-sudhk\documents\visual studio 2008\projects\god\god\debug\buildlog.htm" god - 8 error(s), 0 warning(s)

i highly obliged if me. thanks

add cudart.lib additional libraries. see here more info.

to add library, go to

project properties / configuration properties / linker / input / additional dependencies

and add cudart.lib

update: cuda default install native binaries. you're on 64bit system. if must compile 32bit application, need download , install 32bit cuda toolkit 32bit binaries -- thought including them default, i'm away win7 box right -- i'll check later & update.

the other option, which recommend, switch building native, 64bit binaries. so, you'll need edit configuration management , switch win32 x64.

enter image description here

if don't have x64 option, you'll need go third configuration management option , add profile x64.

the basic point since you're trying link 32 bit app, ignores 64bit binaries have installed.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -