1

This is a question which is a spin-off from another posted question which can be found at the following link:

CUDA - linking errors with convolution example

VS2008 not compiling cuda

In the above link and in several other posts about the same topic they state that if you compile 32 bit cuda this will solve your Build/Compile problems ...

Can anyone please help direct me to an article which would show how to link to 32 bit CUDA. This does not make sense. when you download CUDA toolkit, you have choice of downloading 64 or 32 bit. Both don't download. So are these people just downloading the 32 bit version of CUDA? This seems ridiculous and I know this cannot be what they mean. Any helpl would be greatly appreciated.

Any help as to what they are talking about when they say 'link to 32 bit CUDA' would be greatly appreciated.


ERROR MESSAGES (same as in previous posts)

1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>TestForCuda.cu.obj : error LNK2019: unresolved external symbol _cudaSetupArgument@12 referenced in function "void __cdecl __device_stub__Z10kernelTestPi(int *)" (?__device_stub__Z10kernelTestPi@@YAXPAH@Z)
1>TestForCuda.cu.obj : error LNK2019: unresolved external symbol ___cudaRegisterFunction@40 referenced in function "void __cdecl __sti____cudaRegisterAll_46_tmpxft_000022ac_00000000_3_TestForCuda_cpp1_ii_da17b9e9(void)" (?__sti____cudaRegisterAll_46_tmpxft_000022ac_00000000_3_TestForCuda_cpp1_ii_da17b9e9@@YAXXZ)
1>TestForCuda.cu.obj : error LNK2019: unresolved external symbol ___cudaRegisterFatBinary@4 referenced in function "void __cdecl __sti____cudaRegisterAll_46_tmpxft_000022ac_00000000_3_TestForCuda_cpp1_ii_da17b9e9(void)" (?__sti____cudaRegisterAll_46_tmpxft_000022ac_00000000_3_TestForCuda_cpp1_ii_da17b9e9@@YAXXZ)
1>TestForCuda.cu.obj : error LNK2019: unresolved external symbol ___cudaUnregisterFatBinary@4 referenced in function "void __cdecl __cudaUnregisterBinaryUtil(void)" (?__cudaUnregisterBinaryUtil@@YAXXZ)
1>TestForCuda.cu.obj : error LNK2019: unresolved external symbol _cudaLaunch@4 referenced in function "enum cudaError __cdecl cudaLaunch(char *)" (??$cudaLaunch@D@@YA?AW4cudaError@@PAD@Z)
1>C:\Users\misc\Documents\Visual Studio 2010\Projects\TestForCuda\Test_Configuration\TestForCuda.exe : fatal error LNK1120: 5 unresolved externals
1>
1>Build FAILED.
Community
  • 1
  • 1
Chris
  • 83
  • 1
  • 9
  • What do you mean with, "both don't download"? I've had no problems compiling 64-bit projects that use 64-bit CUDA with Visual Studio 2010. I suspect I'm not the only one :) Try starting again from scratch. http://stackoverflow.com/questions/11332488/cuda-4-2-toolbox-vs2010/11347002#11347002 – Roger Dahl Jan 25 '13 at 01:29
  • After re-installing everything, also create a new project using the New Project wizard (`File | New | Project`), select a project template under `NVIDIA | CUDA`, create a 64-bit configuration with `Configuration Manager`, compile and run. If that works, move your existing files into the new project. If that doesn't work, something very strange is going on. – Roger Dahl Jan 25 '13 at 01:35
  • thanks Roger, I will try re-installing. In visual studio I have no x64 option for platform (in configuraion manager) in my project. All articles i read pertaining to this VS error message state the VS project platform needs to be the same (32/64) as the version of CUDA you have. I have read microsoft articles stating how to change platform from 32 to 64 but I don't seem to have that option. I will try re-installing the VS2010. Thanks again – Chris Jan 25 '13 at 03:50
  • 1
    I'm not sure if the 64-bit build tools are included by default in the Visual Studio install. When you install Visual Studio, make sure the box for the 64-bit tools is checked. If that's the only problem, you may not have to reinstall. Just run the Visual Studio setup again to adjust. – Roger Dahl Jan 25 '13 at 04:03
  • okay, that makes sense. I'll try that and post back if it works. thanks! – Chris Jan 25 '13 at 04:05
  • 2
    Re-installing is almost never the answer so please don't. There is insufficient information in either question to help. Can you please provide the following information: (1) Did you import a VS2005 project into VS2010 similar to the other question? If not how did you create your project. (2) Are you trying to build a 32 or 64 bit platform (Win32 or x64)? (3) What is the command line for the compilation step? (4) What is the linker command line? – Greg Smith Jan 25 '13 at 04:25
  • The project I was attempting to compile was a VS2010 project I had created from scratch. The code was test code I downloaded from the internet. I actually had two problems … – Chris Jan 31 '13 at 04:16
  • 1st problem: Under ‘build customization’ you need to select the CUDA version to build with. I had selected the highest version shown which was ‘CUDA 4.2(.targets,.props)’. The problem was that I linked to CUDA version 5.0. When I say ‘linked’ I am referring to the linked option which you can find in the VS2010 menu bar at “Project => Properties =>Configuration properties => Linker”. When you get to this menu you have the option to add ‘Additional Library Directories’. I had linked to CUDA version 5.0. – Chris Jan 31 '13 at 04:17
  • I have not figured out yet why I do not have a CUDA v5.0 under ‘build customization’ … but that is another question for another day. – Chris Jan 31 '13 at 04:18
  • 2nd problem: I am running on Windows 7 (64 bit), Processor is 64 bit (Intel quad core), the CUDA sdk/toolkit I downloaded was 64 bit, but I was attempting to debug with a Win32 platform. Yes, I knew I needed to compile/build using the proper bit platform, but ignorantly, I could not figure out how to change the ‘Platform’ to x64. The how-tos on the web already showed this option available in the ‘Platform’ dropdown. I read later articles that stated that VS can only debug in Win32 but can compile in Win32 or x64 (not true) which freaked me out even more. – Chris Jan 31 '13 at 04:19
  • 2nd problem continued: If it is your first time to use x64 Platform, the x64 option will NOT be in the Platform dropdown. You must create a ‘new’ platform. When you do this, you need to select x64 for the ‘Copy settings from:’ dropdown. I want to say I tried this before and there was not x64 option in the ‘Copy settings form:’ dropdown. I either overlooked the x64 ‘Copy setting from:’ option previously … or this option was added after I conducted the custom install suggested by Roger (I wish I could remember/ was more observant about this). – Chris Jan 31 '13 at 04:19
  • Anyway, after doing both of these things (not just one … but both), the CUDA code did successfully compile. I just wanted to thank everyone again for all the help! Got me moving in the correct direction! – Chris Jan 31 '13 at 04:20

1 Answers1

2

The project I was attempting to compile was a VS2010 project I had created from scratch. The code was test code I downloaded from the internet. I actually had two problems …

1st problem:

Under ‘build customization’ you need to select the CUDA version to build with. I had selected the highest version shown which was ‘CUDA 4.2(.targets,.props)’. The problem was that I linked to CUDA version 5.0. When I say ‘linked’ I am referring to the linked option which you can find in the VS2010 menu bar at “Project => Properties =>Configuration properties => Linker”. When you get to this menu you have the option to add ‘Additional Library Directories’. I had linked to CUDA version 5.0. I have not figured out yet why I do not have a CUDA v5.0 under ‘build customization’ … but that is another question for another day.
Lesson: whatever version of cude you link to (in Linker menu), is the version you should select in the 'build customation' menu.

2nd problem:

I am running on Windows 7 (64 bit), Processor is 64 bit (Intel quad core), the CUDA sdk/toolkit I downloaded was 64 bit, but I was attempting to debug with a Win32 platform. Yes, I knew I needed to compile/build using the proper bit platform, but ignorantly, I could not figure out how to change the ‘Platform’ (located in the 'configuration manager' menu for your VS project) to x64. The how-tos on the web showed the x64 option as already being available in the ‘Platform’ dropdown. I read later articles that stated that VS can only debug in Win32 but can compile in Win32 or x64 (not true) which freaked me out even more. In Reality, If it is your first time to use x64 Platform, the x64 option will NOT be in the Platform dropdown. You must create a ‘new’ platform. When you do this, you need to select x64 for the ‘Copy settings from:’ dropdown. I want to say I tried this before and there was not x64 option in the ‘Copy settings form:’ dropdown. I either overlooked the x64 ‘Copy setting from:’ option previously … or this option was added after I conducted the custom install suggested by Roger (I wish I could remember/ was more observant about this). Lesson: may need to 'create new' platform in the 'configuration manager' menu if it is your first time to use x64 option (believe VS debug may default to Win32 ... but is easily changed to x64 if needed).

Anyway, after fixing both of these things (not just one … but both), the CUDA code did successfully compile. I just wanted to thank everyone again for all the help! Got me moving in the correct direction!

PS: Nice tutorial (not mine but I used to help me) to help you compile your first CUDA code http://www.youtube.com/watch?v=1HMVg40fsg0

Chris
  • 83
  • 1
  • 9