Finally able to compile CUDPP in VS2010 using CUDA 5.0 and 64-bit. Many problems when trying to compile using Visual Studio's native 64-bit compiler (..\VC\bin\amd64\..) vs their cross compiler (..\VC\bin\x86_amd64\..). I believe if the cross compiler was used it would avoid most of the problems below but there are some tradeoffs (
http://stackoverflow.com/questions/3508173/when-compiling-x64-code-whats-the-difference-between-x86-amd64-and-amd64) using the cross-compiler.
Began by following MS instructions (
http://msdn.microsoft.com/en-us/library/9yb4317s(v=vs.100).aspx) to target 64-bit CUDA and point everything to CUDA 5.0 *.dll and *.libs. Unfortunately it was not that easy. Below are are bunch of problems encountered and how to fix. A detailed build config list has been included as well. Note that I'm using some non-default directories for some files.
VS2010 Compile errors
===========================
237 error: identifier "IUnknown" is undefined reported in C:\Program Files(x86)\Microsoft SDKs\Windows\v7.0A\ObjBase.h. It can be resolved by making the following modifications:
extern "C++"
{
/* Add the following includes to resolve */
#include <wtypes.h>
#include <unknwn.h>
template<typename T> void** IID_PPV_ARGS_Helper(T** pp)
{
static_cast<IUnknown*>(*pp); // make sure everyone derives from IUnknown
return reinterpret_cast<void**>(pp);
}
}
VS2010 Linker errors
=====================
msvcprtd.lib(MSVCP100D.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
Ensure there is no mix of x86 (32-bit) and x64 (64-bit) object code. It is likely there is some 32-bit *.lib or *.dll being used. The dumpbin.exe utility included with VS can confirm. Enabling the Project properties->Linker /VERBOSE option will also list the libraries being used.
dumpbin /headers cudpp_generated_compact_app.cu.obj
Dump of file cudpp_generated_compact_app.cu.obj
File Type: COFF OBJECT
FILE HEADER VALUES
14C machine (x86) /*32-bit, it would show x64 for 64-bit */
For some unknown reason the cmake files in the CUDPP source directory (..\src\cudpp\CMakeFiles\cudpp.dir\app\cudpp_generated_compact_app.cu.obj.make) generate 32-bit even though in the VS Project properties 64-bit is being explicitly specified.
I'm not familar with Cmake. Modifying all the cmake config files I could find but this did not help. This was worked around by manually editing each of the cudpp_generated_*cu.obj.make files. VS seems to call cmake for each rebuild and thus overwites the *cu.obj.make files.
VS Project Build Config
===================
CUDA 5.0 is installed in d:\devel\cuda\v5.0
VC++ Directories
Executable Directories
$(VCInstallDir)bin\amd64
$(WindowsSdkDir)bin\NETFX 4.0 Tools\x64
$(WindowsSdkDir)bin\x64
$(VSInstallDir)Common7\tools
$(VSInstallDir)Common7\ide
$(FrameworkSDKDir)\bin\x64
$(FrameworkSDKDir)\lib\x64
c:\windows\Microsoft.NET\Framework64
c:\windows\Microsoft.NET\Framework64\v4.0.30319
Include Directories
$(VCInstallDir)include
$(VCInstallDir)atlmfc\include
$(WindowsSdkDir)include
$(FrameworkSDKDir)\include
d:\devel\cuda\cudpp_src_2.0\include
d:\devel\cuda\v5.0\include
d:\devel\cuda\cudpp_src_2.0\src\cudpp_hash
Reference Directories
$(WindowsSdkDir)include
$(VCInstallDir)atlmfc\lib\amd64
$(VCInstallDir)lib\amd64
Library Directories
$(FrameworkSDKDir)\lib\x64
$(VCInstallDir)lib\amd64
$(VCInstallDir)atlmfc\lib\amd64
$(WindowsSdkDir)lib\x64
d:\devel\cuda\v5.0\lib\x64
Source Directories
$(VCInstallDir)atlmfc\src\mfc
$(VCInstallDir)atlmfc\src\mfcm
$(VCInstallDir)atlmfc\src\atl
$(VCInstallDir)crt\src\AMD64
Exclude Directories (defaults)
$(VCInstallDir)include
$(VCInstallDir)atlmfc\include
$(WindowsSdkDir)include
$(FrameworkSDKDir)\include
$(MSBuildToolsPath)
$(MSBuildToolsPath32)
$(VCInstallDir)atlmfc\lib\amd64
$(VCInstallDir)lib\amd64
General
Target Extension: .dll
Configuration Type: Dynamic Library (.dll)
C/C++ -> Preprocessor Definitions: Add "cudpp_EXPORTS"
CUDA C/C++ -> Target Machine Platform: 64-bit (--machine 64)
Linker
Show Progress->Display all messages (/VERBOSE)
Input
Additional Dependencies: cudart.lib cuda.lib
Additional Library Directories
$(FrameworkSDKDir)\lib\x64
$(VCInstallDir)lib\amd64
$(WindowsSdkDir)lib\x64
d:\devel\cuda\v5.0\lib\x64
Advanced
Import Library: $(TargetDir)$(TargetName).lib
System
Stack Reserve Size: 3
Enable Large Address Aware: Yes
Advanced
Randomized Base ADdress: /DYNAMICBASE:NO
Target Machine /MACHINE:X64
CUDA Linker
Additional Library Directories
$(FrameworkSDKDir)\lib\x64
$(VCInstallDir)lib\amd64
$(WindowsSdkDir)lib\x64
d:\devel\cuda\v5.0\lib\x64
Manifest Tool
Input and Output
Embed Manifest: No