Building Static library with CUDA (Win7 + VS2010 + C++)
Hi, i am a little stuck, maybe someone can help me. I want to make a static library written in c++ + cuda. I have changed Project->properties->Configuration Properties->General->Configuration type to static library as i would if i were building a regular static lib. However, when i add my cuda code, a weird thing happens (everything is ok without cuda). The projects builds succesfully, but no .lib file is generated - the folder that should contain the result is empty. All the .obj files are built as they should be, but the should-be-resulting library is nowhere to be found.
I also tried adding the "-lib" flag to nvcc command line (is it neccesarry or not?), but this results in this error: "nvcc fatal : More than one compilation phase specified". I have consulted this with the table of "compilation phase" flags in the nvcc manual, but there is no other of that flags on the command line except for the -lib that i added, so i dont really understand this error. The commnad is:
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_21,compute_20\" --use-local-env --cl-version 2008 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\x86_amd64" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\\include" --keep-dir "x64\Release\\" -maxrregcount=32 --machine 64 --compile -lib -Xcompiler "/EHsc /nologo /Od /Zi /MD " -o "x64\Release\mykernell.obj" "C:\...(path to my project)..\mykernell.cu"

I am a little lost, could someone who already created some .lib with CUDA share his workflow, please? Or havent you seen some tutorial on this?
Hi, i am a little stuck, maybe someone can help me. I want to make a static library written in c++ + cuda. I have changed Project->properties->Configuration Properties->General->Configuration type to static library as i would if i were building a regular static lib. However, when i add my cuda code, a weird thing happens (everything is ok without cuda). The projects builds succesfully, but no .lib file is generated - the folder that should contain the result is empty. All the .obj files are built as they should be, but the should-be-resulting library is nowhere to be found.

I also tried adding the "-lib" flag to nvcc command line (is it neccesarry or not?), but this results in this error: "nvcc fatal : More than one compilation phase specified". I have consulted this with the table of "compilation phase" flags in the nvcc manual, but there is no other of that flags on the command line except for the -lib that i added, so i dont really understand this error. The commnad is:

"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_21,compute_20\" --use-local-env --cl-version 2008 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\x86_amd64" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\\include" --keep-dir "x64\Release\\" -maxrregcount=32 --machine 64 --compile -lib -Xcompiler "/EHsc /nologo /Od /Zi /MD " -o "x64\Release\mykernell.obj" "C:\...(path to my project)..\mykernell.cu"



I am a little lost, could someone who already created some .lib with CUDA share his workflow, please? Or havent you seen some tutorial on this?

#1
Posted 07/04/2011 04:35 PM   
hmm, so i solved it by using the lib.exe from the command line to merge the .obj files and it works...so it just makes me more confused why it does not work right away from the IDE...nevermind :)
hmm, so i solved it by using the lib.exe from the command line to merge the .obj files and it works...so it just makes me more confused why it does not work right away from the IDE...nevermind :)

#2
Posted 07/14/2011 02:59 PM   
Hi TJ,

Did you manage to find a proper solution to this problem? I have started migrating and got stuck exactly at the same spot and using lib from command line is not an option for me.

Thanks


[quote name='.TJ' date='14 July 2011 - 02:59 PM' timestamp='1310655540' post='1264981']
hmm, so i solved it by using the lib.exe from the command line to merge the .obj files and it works...so it just makes me more confused why it does not work right away from the IDE...nevermind :)
[/quote]
Hi TJ,



Did you manage to find a proper solution to this problem? I have started migrating and got stuck exactly at the same spot and using lib from command line is not an option for me.



Thanks





[quote name='.TJ' date='14 July 2011 - 02:59 PM' timestamp='1310655540' post='1264981']

hmm, so i solved it by using the lib.exe from the command line to merge the .obj files and it works...so it just makes me more confused why it does not work right away from the IDE...nevermind :)

#3
Posted 01/09/2012 04:26 PM   
Scroll To Top