Hello!
I really need help, I’ve been at a loss trying to get things working on my computer for days. I’ve been trying to get started with CUDA development and I think I am almost there but I’m tripping at the finish line.
I have a Windows 7 64 Bit Computer with a Geforce 750 TI card installed. All I am trying to do is compile a sample .cu file and the compiler fails. I’ve installed Visual Studio 2013 Professional Edition and even compiling in the nvcc CLI, it fails.
Please see my imgur image for my issue which shows Visual Studio and the Command Line:
<a target='_blank' rel='noopener noreferrer' href='http://imgur.com/a/KJcvw'>http://imgur.com/a/KJcvw</a>
if that fails for some reason, the error message from the command prompt is:
C:\projects\cuda\vs-cuda-test\vs-cuda-test>nvcc --cuda --gpu-architecture=compute_52 kernel.cu
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
tmpxft_0000225c_00000000-1.cpp
nvcc fatal : Host compiler targets unsupported OS.
C:\projects\cuda\vs-cuda-test\vs-cuda-test>
For a beginner, compiling from the command line is not the right way to get started. You shouldn’t be using a 32-bit compiler for current versions of CUDA.
My recommendation would be to follow the instructions carefully in the windows install guide. Do not skip steps and go all the way thru the verification process, before trying to do your own work.
[url]Installation Guide Windows :: CUDA Toolkit Documentation
You don’t mention which version of CUDA you use. I think (not completely sure) that development for 32-bit targets is no longer supported by the most recent version of CUDA. Since you use 64-bit Windows, I would suggest building with the matching 64-bit compiler, e.g.:
Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64
Note the “x64” target designation instead of the “80x86” target designation.
njuffa, the version I have is
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Mon_Jan__9_17:32:33_CST_2017
Cuda compilation tools, release 8.0, V8.0.60
txbob, thank you I will attempt to go through that document. One thing I am confused about is how to upgrade or configure my compiler for 64 bits?
Since you have the Professional version of the Microsoft compiler, it includes both 32-bit and 64-bit compilers. Some free versions of the Microsoft compiler used to only provide the 32-bit version.
For command line use with CUDA, I call the appropriate batch file for setting environment variables as follows:
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat amd64
Note the “amd64” argument passed to the batch file; this specifies use of the 64-bit compiler. Note that this example is for MSVC 2010 (the oldest version able to work with CUDA 8.0), and locations, batch file name, and command-line arguments passed to the batch file may all have changed in subsequent versions of MSVC.
njuffa, I bet you are right, but I get this error when I try to run that command
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC>vcvarsall.bat amd64
'file]' is not recognized as an internal or external command,
operable program or batch file.
'file]' is not recognized as an internal or external command,
operable program or batch file.
'file]' is not recognized as an internal or external command,
operable program or batch file.
'file]' is not recognized as an internal or external command,
operable program or batch file.
'file]' is not recognized as an internal or external command,
operable program or batch file.
'file]' is not recognized as an internal or external command,
operable program or batch file.
'file]' is not recognized as an internal or external command,
operable program or batch file.
The only thing I can suggest is to look into the details of the batch file. In MSVS 2010 it simply calls a version-specific batch file based on the command-line argument. “amd64” causes it to invoke amd64\vcvars64.bat, which is the setup batch file for the x64 compiler.
njuffa, it turns out it was an issue with my PATH variable. Now that I got that squared away visual studio still doesn’t work
I still get the same error in Visual Studio and When I go to compile in the command line I get…
C:\projects\cuda\vs-cuda-test\vs-cuda-test>nvcc --cuda --gpu-architecture=compute_52 kernel.cu
kernel.cu
c1xx : fatal error C1083: Cannot open source file: 'kernel.cu': No such file or directory
Is the result any different if you simplify to nvcc -o kernel.exe kernel.cu
? If the current directory contains a file kernel.cu, the compiler should be able to open the file. Not sure what could prevent this. Maybe some weird environment settings?
I have never had any trouble getting CUDA to work with MSVC, over more than a decade of CUDA use and four different versions of MSVS. That makes it hard for me to imagine for what reasons other people might encounter unusual problems.
Did you follow the installation instructions exactly, as suggested by txbob? If the answer is “Yes, except for …” there may be the source of the problem.
Negative. Same result. And the device query passed. Although I did notice that the directory in the instructions were wrong (programs were in Debug instead of Release) and I was missing at least the bandwidth test)
My current directory looks like this…
C:\projects\cuda\vs-cuda-test\vs-cuda-test>dir
Volume in drive C is Windows
Volume Serial Number is 8CC9-A2A8
Directory of C:\projects\cuda\vs-cuda-test\vs-cuda-test
05/19/2017 03:04 PM <DIR> .
05/19/2017 03:04 PM <DIR> ..
05/19/2017 02:16 PM <DIR> Debug
05/18/2017 05:36 PM 4,149 kernel.cu
05/19/2017 03:06 PM 8,632 vs-cuda-test.vcxproj
2 File(s) 12,781 bytes
3 Dir(s) 779,529,379,840 bytes free
Maybe I should try a different version. I just found NDVIDIA’s archive and will try to uninstall what I have and install the second latest