Do I need a 64 bit SDK on a 64 bit machine - windows

My lab just received a Tesla C2070 , and the card is installed on a machine running windows server 64 bits. I'm supposed to write some cuda simulations.
Do I need to install the 64 bits version of the SDK and CUDA toolkits ?
The reason I'm asking is because I'd like to use Visual c++ express to compile and they seem to be really really 32 bit oriented. Or is there another compiler which would altogether free me from that restriction ?
Thanks.
Edit 1
Thanks for the answers.
So far I can compile 32 bits cuda / openCL code.
After installing the SDK, changing the target to 64 and linking against 64b lib, well it still won't work.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 4.2.targets(361,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe" -gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env --cl-version -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\include" -G --keep-dir "x64\Debug" -maxrregcount=0 --machine 64 --compile -g -Xcompiler "/EHsc /nologo /Od /Zi /MDd " -o "x64\Debug\test.cu.obj" "c:\Users\A\Documents\Visual Studio 2010\Projects\cudaTest2\cudaTest2\test.cu"" exited with code -1.
Finally, is there a point to compile to a 64bit app when speaking about gpgpu simulation ? What I mean is that the code running on the host is nearly nothing, and the code running on the gpu well it's compiled by nvcc so doesn't really matter what I chose, 32 or 64... Am I wrong (probably) ?

You should download the 64bit SDK for 64Bit OS,In that there are libraries for both the version 32Bit and 64Bit.For visual C++ 32Bit application you should use 32Bit libraries and it will work.
For example in my case: I have 64Bit Windows7 OS,for this I have used 64Bit CUDA SDK and for developing my 32bit c++ application in visual studio 2008 I have used 32Bit libraries of cuda exported with the SDK.

This isn't what you asked, but...
Visual C++ Express will compile 64-bit programs just fine. It so happens that Express is not distributed with the 64-bit compiler, but the compiler is a separate download.
Install the Microsoft Windows SDK 7.1 and you will be able to compile for x64 with Microsoft Visual C++ Express.

Related

How to specify Intel C++ compiler icl as host compiler of a CUDA project in Visual Studio

In the project properties page of CUDA project in visual studio, there seems to be the option to custom the host compiler. But after I selected the intel C++ compiler, the -ccbin option still points to the cl.exe.
selecting intel C++ compiler as the platform toolset
the -ccbin option still points to cl.exe
I do understand that under windows environment, the default host compiler for CUDA project is cl.exe and the following posts confirmed that cl.exe was the only option on windwos. But these were quite some time ago, I'd like to ask again if this is still the case or we use a different host compiler now?
Intel C++ Composer and CUDA
Specify compiler NVCC uses to compile host-code
It's still the case. The only supported environments are listed in the installation guide for windows. The intel compiler is not listed.
By comparison, the corresponding section of the linux installation guide shows that a certain version of the intel compiler (ICC) is supported for the host compiler.
In the future, you should be able to refer to the corresponding documents published with newer CUDA toolkits to determine compiler support.
I often find myself using Intel C++ together with CUDA for fluid simulations, and I may be able to help if you are still interested in an answer.
You have not specified which version of Visual Studio you are referring to, but I imply that you are talking about Visual Studio Professional/Enterprise or any of that line of fully featured IDEs.
While I haven't extensively used any of those, there is a way of using Intel C++ (and by extension, any compiler) with CUDA, in Visual Studio Code. If you decide to go this route, and since you mentioned Windows, here is the procedure:
To make things simple, download the C++ tutorial build from here. If you want to make the build yourself, instructions are found on MSDN here.
After the download, you should have a build.bat file in the project directory. Open the file to edit it.
Replace everything inside the build.bat file as follows:
#echo off
call "Path\to\compilervars.bat" intel64
call "Path\to\vcvarsall.bat" x64
set compilerflags=/Zi /EHsc -I"%MKLROOT%"\include
set linkerflags= mkl_intel_ilp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib
icl.exe /Foobj\helloworld /Fdobj\ -c -I. -I"%CUDA_PATH%"\include %compilerflags% helloworld.cpp /link %linkerflags%
"Path\to\nvcc.exe" -gencode=arch=compute_61,code=\"sm_61,compute_61\" -IPath\to\CUDA\include -G -maxrregcount=0 --machine 64 --compile -cudart static -g -DWIN64 -DNDEBUG -D_CONSOLE -Xcompiler "/EHsc /W3 /nologo /Od /FS /Fdobj\ /Zi /RTC1 /MD /MP" -o obj\hello2.obj "hello.cu"
icl.exe -o bin\hello.exe /Fdobj\ obj\hello2.obj obj\helloworld.obj "%CUDA_PATH%"\lib\x64\cudart.lib %compilerflags% /link %linkerflags%
In other words, we tell the build process to:
Look for the compilervars.bat file (found in Intel C++ compiler /bin folder) and set Intel specific macros and variables for the build process
Look for the vcvarsall.bat file (found in Visual C++ compiler /VC folder) and set Visual C++ specific macros and variables for the build process
Set the Compiler and Linker Flags for the Intel C++ compiler.
IMPORTANT: Call the Intel C++ compiler to generate an Obj file from all the non-CUDA (i.e. .cpp files of the project - In this case, helloworld.cpp) and also include the CUDA headers if you need them. Make sure no CUDA kernel calls (functions with <<< >>>) happen here.
THEN: Call the CUDA compiler to generate an Obj file from all the CUDA files (i.e. the .cu extensions - In this case, hello.cu), in this case, I call the Obj file hello2.obj (I explicitly renamed it to show you how to do that).
FINALLY Call the C++ Compiler to generate the executable file by mentioning both Obj files as well as the cudart library for static linking.
Note that CUDA still needs VC++ so we allow it to access VC++ for only the part where it compiles CUDA files (which is why we had to initialize vcvarsall.bat), and stick to Intel C++ for the rest.

Compiler 'cl.exe' in PATH different than the one specified with -ccbin

This is on Windows 7 Pro 64 bit with CUDA 6.5 and Intel Composer 2015, in Visual Studio 2013.
I have a project that contains a mix of native c++ and CUDA. I'm trying to switch from the Microsoft compiler to the Intel compiler, for better vectorization and performance. However, I can't get the project to build after installing Intel Composer and changing the project setting to use the Intel compiler.
Whenever I try to build, I get the error:
nvcc fatal : Compiler 'cl.exe' in PATH different than the one specified with -ccbin
I tried changing the compiler to the Intel compiler located in C:\Program Files (x86)\Intel\Composer XE 2015\bin\intel64, by adding
-ccbin C:\Program Files (x86)\Intel\Composer XE 2015\bin\intel64\icl.exe
but that errors with
nvcc fatal : redefinition of argument 'compiler-bindir'
How can I configure CUDA to use the Intel compiler instead of the Microsoft one?
Only the microsoft cl.exe compiler is supported on Windows. The supported platforms are indicated in the windows getting started document.
The intel compiler is supported as the host compiler on linux however.

CUDA 4.2. toolbox & VS2010

I am trying to compile Cuda SDK examples but I am getting "MSB3721 error" since "nvcc" is "exited with code 1". Complete output:
"C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA
4.2.targets(361,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe"
-gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_30,code=\"sm_30,compute_30\" --use-local-env --cl-version 2010 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64" -I"./" -I"../../common/inc"
-I"../../../shared/inc" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\include" -G --keep-dir "x64\Debug" -maxrregcount=0
--machine 64 --compile -g -Xcompiler "/EHsc /nologo /Od /Zi /MTd " -o "x64/Debug/bandwidthTest.cu.obj" "C:\ProgramData\NVIDIA
Corporation\NVIDIA GPU Computing SDK
4.2\C\src\bandwidthTest\bandwidthTest.cu"" exited with code 1."
Cuda toolkit 4.2 is used on Win7 x64 Ultimate system with VS2010 Ultimate.
The error remains when the "win32" option in "Configuration management" is used.
Are there any suggestions?
!!!!! Finally after reading all available NVIDIA manuals about "Getting started with CUDA" after reinstalling Win7+VS2010+CUDA drivers more than 10 times after building a new computer (Z77 mobo + i7 + GTX550Ti) and after waiting for months the NVIDIA forum resurrection I found out that the problem with the nvcc build error "exited with code 1" was disappeared when the "Run as administrator" option was selected on the VS2010 shortcut on my desktop!!!!!!
Although I was using an administrator account (the only account on the PC) it was impossible to build any of the CUDA Examples. The executables were running without any problem but I couldn't build the source code using VS2010!
!!!!!Thank you all for your support!!!!!
I would try to start from scratch. Remove CUDA, Nsight, and Visual Studio. Reboot. Manually remove any program folders that might be left. I can't guarantee that it's safe to remove these, but if any other NVIDIA or Microsoft products break because of this, I'd just fix those after having fixed CUDA:
C:\Program Files (x86)\Microsoft Visual Studio 10.0
C:\Program Files (x86)\Microsoft Visual Studio 9.0
C:\Program Files (x86)\NVIDIA Parallel Nsight 2.1
C:\Program Files (x86)\NVIDIA Parallel Nsight Monitor 2.1
C:\Program Files\Microsoft Visual Studio 10.0
C:\Program Files\NVIDIA GPU Computing Toolkit
Manually remove any left over app data folders:
C:\Users\<your user folder>\AppData\Roaming\NVIDIA
C:\Users\<your user folder>\AppData\Roaming\NVIDIA Corporation
You might want to look for registry keys as well.
Then reinstall everything. Nsight comes with CUDA, so I'd first install VS then Nsight. That should be all that is required. Then, create a CUDA project from scratch.
You might want to look at this thread, maybe it helps you with your problem:
How to Compile CUDA App is Visual Studio 2010?

'X86' conflicts with target machine type 'x64'

I'm getting the following error:
LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
I'm working on a 64 bit machine (VS2008) and I have the x64 compiler. I checked that the build is on x64.
Why isn't it compiling? Here's the build log:
echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.1\bin\nvcc.exe" -gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --machine 32 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin" -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.1\include" -maxrregcount=0 --compile -o "x64\Debug/lowWrappers.cu.obj" lowWrappers.cu
In the top of the properties dialogue, there's a Platform dropdown. That should say "Active(x64)". If it says "Active(Win32)", that's your problem. Click "Configuration Manager..." in the top right, select the platform for your project, select "" and find x64. You can then delete the Win32 platform if you like.
(this might be a bit out of date...but I found a fix, since I just ran into this problem).
The short answer, in your Project Properties->Configuration Properties->CUDA RuntimeAPI->Host
set the "Target Machine Platform" to x64. (mine was at x86 despite having the platform at x64).
Make sure that any libraries you are using have also been compiled on 64 bit.

Cuda 4.0 with Visual Studio 2010 cl compiler error

As I did not get any help in the Nvidia forums (see my post at the bottom of the thread), and it seems I am not the only one struggeling with similar problems, I will give it a try here.
I tried to compile the Cuda SDK 4.0 examples as well as following the very nice tutorial by Ade Miller. But compiling the ".cu" file won't work.
This is the (exemplary) command the compiler invokes:
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe"
-gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env
--cl-version 2010 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC bin\x86_amd64"
-I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include" -G0
--keep-dir "x64\Debug" -maxrregcount=0 --machine 64 --compile -D_NEXUS_DEBUG
-g -Xcompiler "/EHsc /nologo /Od /Zi /MDd " -o "x64\Debug\Hello.cu.obj"
"D:\Code\CUDA\Test_Cuda_4_0\Test_Cuda_4_0\Hello.cu"
And this is the strange error message I always get.
nvcc fatal : Compiler 'cl' in PATH different than the one specified with -ccbin
EDIT: To be a bit more precise: Visual Studio just tells me the command did not succeed ("exit code -1") -> to see this error message I have to invoke the command by myself in the command line.
1) Why should nvcc care about the path in the environment variable differing from the one specified with the command line option? If it would care, wouldn't this make the command line option completely useless?
2) How to fix ;) ?
I use Win7 64Bit, VS2010 Prof SP1, and the following nvidia versions:
cudatoolkit_4.0.17_win_64
devdriver_4.0_winvista-win7_64_270.81_general
gpucomputingsdk_4.0.19_win_64
Many thanks for your help!
try using the conventional method to start writing a CUDA program, as given in Getting Started guide(Copy the sample). To solve the above problem you have to add it as an environment variable. But since the SDK samples are already linked, they don't give problems.
I had a similar problem. previously i copied cl.exe in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\bin for test several parameters with nvcc.exe and forget delete this file from this directory. i removed this file and everything is OK. purpose of PATH for my problem in really was for this path: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\bin and wasn't PATH in Environment variables.

Resources