Hello guys, I’ve been wanting to try CUDA for a while but never got do it. Now that I’m finally here I’ve been trying to get the cross compiling to work but I always met barricades which stopped me from advancing. I work in VISUAL STUDIO 2008 btw.
Alright here is the steps I’ve been doing it:
1: Install Driver (190.xx), 64 bit toolkit and 64bit SDK.
2: I opened up the sample projects from the SDK and compiled succesfully the first try in x64 mode.
3: Now time for 32 bit compiling. I choose win32 and compile. I get errors immidiately.
What I did at this step is to read on the forums about what was causing it. I did those steps below to fix it: step 1: add --machine 32 to extras in properties at the CUDA Build RUle 2.3.0 step 2: I Right click on my computer, got to systemsettings and enviroment variables. I added my own version of them such as CUDA_LIB_PATH32 and CUDA_BIN_PATH32 and kept the regular ones which were pointing to the 64 bit folders. My ones now point to 32 bit folders. I saw this suggested somewhere but I didn’t know how this would help me though. Step 3: I changed the path in the linker so it points to CUDA_LIB_PATH32 instead of CUDA_LIB_PATH. Hence, 32 bit version.
4: Now I tried building it and it told me missing cutil32d.lib. Time to research on the forums again and then people said that I had to rebuild the cutil solution inside the nvidia folder in win32 debug mode. I did it and tadaa, got the lib files in 32bit.
5: Now I build in 32bit again and it compiles and run, but exists with “can’t find cudart.dll”. It also shows in visual studio this error code: 0xc000007b
Now as you guys see I normally research about the errors before posting. I found a thread about this error message at page 2 where people say declare enviroment variables ( which I did already in step 3 part 2 ). But I can’t get it to find the right cudart.dll file. If I copy the 32 bit one from C:\Cuda\bin to the project folder, it all works. But I want it to work without doing that, and I saw some people in the forums that got it to work with those enviroment path variables, but I have no ideas how to use my path variable so it detects the correct dll, in this case the path is declared as CUDA_BIN_PATH32.
I saw in the documentation that cross compiling is possible with version CUDA 2.3 but oh boy I never thought it would take this much time to actually get it to work V_V"
If someone could help me out to get this fixed so it finds the correct DLL, you would have my thanks.
If you mean the one under mycomputer → properties → advanced system settings → enviroment variables, then yes CUDA_BIN_PATH points to C:\CUDA\bin64, I added my own one as I said in the main post which I named CUDA_BIN_PATH32 which points to C:\CUDA\bin, but I don’t know how to use these in visual studio 2008. I tried them in several fields in the properties window and it always gave the same error, that the cudart.dll is missing. I made the regular env path point to C:\CUDA\bin instead of 64 under advanced system settings → env vars but then it gives error because C:\CUDA\bin folder don’t contain the nvcc.exe.
Yeah I know it works by copying it to the project directory. But I want it to work without doing that. May I ask which path variable you are talking about and HOW you add it so it searches in that folder in visual studio??
I want it to compile to 32 bit with 64 bit version and only way is with copying that .dll to project folder right now.
Tried that code and got same error message that it finds wrong version of cudart.dll :( (0xc000007b). Where do I put the enviroment variable in visual studio btw?
This is how my path variables look like right now but I don’t know how to add it to VISUAL STUDIO so it searches there, is it somewhere in properties or somewhere else :(?
OMG LOL! SO THIS WAS MY PROBLEM ALL THE TIME -_-!!! IT WORKS MAN THANKS ALOT <3! Damn I feel completely useless haha. Thanks again m8, I’m in your debt seriously!
If you ever need something in terms of 3D Models just leave me a note I’ll try to pay my debt in that way. I’m a student in Futuregames Academy (3D ART) though I started with 3D when I was around 12. Some work of mine :)