I have been trying to use the static CUDA Runtime included in CUDA 5.5, but facing some problems.
Following are the results of linking cudart_static.lib in different IDEs:
Linker fails with the following error:
error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in kernel.cu.obj
Seems like the static CUDA runtime has been compiled using VS2010.
No Error. Links successfully.
Links successfully with the following series of warnings:
cudart_static.lib(cuda_*.obj) : warning LNK4229: invalid directive '/FAILIFMISMATCH:_MSC_VER=1600' encountered; ignored
Also, in all the IDEs, when running in DEBUG configuration the linking fails with following error:
error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in kernel.cu.obj
Regarding your first question:
1.How to link the static CUDA runtime in Visual Studio 2012?
From the release notes:
"The new static version of the cudart library shipped with the CUDA 5.5 Release Candidate (RC) on Windows will not work with Microsoft Visual Studio 2008 (VC9.0) nor with Microsoft Visual Studio 2012 (VC 11.0). Starting with CUDA 5.5, the nvcc compiler will link against the static version of the cudart library by default, so in order for the CUDA 5.5 RC to correctly work with Microsoft Visual Studio 2008 or 2012, please use the --cudart=shared option to nvcc to force linkage against the shared version of the cudart library. If an application is not relying on the nvcc capability to automatically link to the cudart library, and is instead explicitly linking against cudart.lib, then that application will continue to link correctly as well."
Usage of the static library on windows for VS2012 and/or VS2008 is therefore unsupported at this time.
Regarding your second question:
2.How to link the same in DEBUG configuration?
The issue with debug mode has to do with how the cudart static library was built. Normal practice would be to include two static libraries, one for debug mode and one for release mode. As a workaround, you can try something like this (in VS 2010):
Project Pages...Configuration Properties...C,C++...Preprocessor...Preprocessor Definitions
Add "_ITERATOR_DEBUG_LEVEL=0"
Your mileage may vary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With