7

I want to use nvcc -ptx from windows command line, but I always get this error message: nvcc : fatal error : Microsoft Visual Studio configuration file 'vcvars64.bat' could not be found for installation at 'C:\Program Files (x86)\Microsoft Visual S tudio 11.0\VC\bin/../..'

I'm using vs 2012 express edition. What can be the solution?

talonmies
  • 70,661
  • 34
  • 192
  • 269
Belabalta
  • 71
  • 1
  • 1
  • 2

4 Answers4

15

I have managed to solve the issue and make work with MS Visual Studio Express 2012, here what I did:

  1. Installed MS Visual Studio 2012 Express
  2. Installed cuda_5.5.20_winvista_win7_win8_general_64, the latest version as of 2014-01-16
  3. From this directory: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin, I have copied x86_amd64 to amd64
  4. In the new directory: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64, I have created a file vcvars64.bat
  5. In the file vcvars64.bat, just added: CALL setenv /x64

The compilation worked great:

C:\CUDA>nvcc -o square square.cu
    Creating library square.lib and object square.exp

C:\CUDA>square.exe
0.000000        1.000000        4.000000        9.000000
16.000000       25.000000       36.000000       49.000000
64.000000       81.000000       100.000000      121.000000
144.000000      169.000000      196.000000      225.000000
talonmies
  • 70,661
  • 34
  • 192
  • 269
Govand Sinjari
  • 309
  • 3
  • 6
  • 1
    The (seemingly pointless) step of creating a copy of the `x86_amd64` directory and calling this copy `amd64` did it for me. I would never have found that out (the NVCC error message is not telling anything about this - instead, it suggests that it's looking for the `vcvars64.bat` in the Visual Studio base directory...) – Marco13 Apr 10 '15 at 19:06
  • This also worked for me, except for VS2010 I did not have to add an amd64 folder - it was already there so I just created the batch file in there and presto. – Alex Court Dec 02 '15 at 22:10
  • Worked for me too, first I was testing it by 'nvcc ?' which doesn't work, but the compile process worked for cuda. – p8me Apr 23 '16 at 20:56
2

From NVIDIA CUDA Compiler Driver document

1.2. Supported Host Compilers nvcc uses the following compilers for host code compilation:

On Linux platforms

The GNU compiler, gcc, and arm-linux-gnueabihf-g++ for cross compilation to the ARMv7 architecture

On Windows platforms

The Microsoft Visual Studio compiler, cl On both platforms, the compiler found on the current execution search path will be used, unless nvcc option -compiler-bindir is specified (see File and Path Specifications).

Community
  • 1
  • 1
Greg Smith
  • 11,007
  • 2
  • 36
  • 37
-1

Your visual studio install is asking for .NET v3.5 framework: http://www.microsoft.com/en-us/download/details.aspx?id=21

Got this info from this: Where can I find Microsoft.Build.Utilities.v3.5

FabricioFCarv
  • 474
  • 4
  • 5
-2

When in your project go to Configuration Properties > CUDA C/C++ > Device and change Code Generation to the following: compute_11,sm_11