I'm trying to get started with CUDA and a 64-bit compiler on Windows 7 SP 1. Ultimately, I wish to compile mex-files for use with Matlab (R2014a). I have an older computer which I successfully configured to do this using older versions of CUDA and VS C++ Express, but I can't seem to get it to work with the newer packages.
I've installed CUDA 6.0 and Visual Studio C++ 2012 Express, which web readings suggest should work together. I'm not sure whether I also need the Microsoft SDK, which used to be necessary in order to get the 64-bit compilers; it seems that these are included with VS these days.
I created a vcvars64.bat inside 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64'. I also made a copy of the entire directory renamed to 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64'. These steps used to be necessary for older versions -- not sure if they still are.
However, when I try to compile, I get the following error:
nvcc : warning : The 'compute_10' and 'sm_10' architectures are
deprecated, and may be removed in a future release. nvcc : fatal
error : nvcc cannot find a supported version of Microsoft Visual
Studio. Only the versions 2008, 2010, and 2012 are supported
Compilation errors found: terminating.
I'm compiling as follows:
nvcc --cuda myfile.cu --output-file myfile.cpp
Following this I would call mex within Matlab to build the mex file. But I can't get past this first step. Does anybody know how nvcc determines where to look for the compiler, and how I can get it to recognize a supported compiler? Note that 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64\cl.exe' is on the system path.
Try to run vcvars64.bat and matlab both from the command line. This makes the correct VS environment variables known to Matlab and nvcc.
Related
I am using CMAKE to build Open Source Projects (like those are available at GitHub etc.) and I also have installed Visual Studio 2019. There is a problem that CMAKE can not find Fortran compiler in my system whereas I've installed MinGW with Fortran compiler. The error is:
**The Fortran compiler identification is unknown**
**No CMAKE_Fortran_COMPILER could be found.**
How can I solve this problem and make CMAKE be aware of Fortran compiler?
Note: I tried other projects that does not require Fortran compiler and those are built successfully.
Installed software:
CMAKE 3.18.5,
Visual Studio 2019,
MinGW
You need to show where your fortran executable file to CMakeList.txt like
set(CMAKE_Fortran_COMPILER "C:/MinGW/bin/gfortran.exe")
EDIT 2 for Visual studio 2019:
If you want to produce Visual Studio 2019 solution
Download IntelĀ® oneAPI HPC Toolkit here.
If cmake cannot find Fortran compiler add a cmake flag CMAKE_Fortran_COMPILER with the value of ifort.exe path that u installed above. Like %install_path%/Intel/oneAPI/compiler/2021.1.1/windows/bin/intel64/ifort.exe
Configure and generate solution.
EDIT:
Alright, now I understand why you get this error. The Visual Studio generator does not support MinGW gfortran. They are totally separate ecosystems.
Remove your build directory and create a fresh one. Then use cmake .. -G "MinGW Makefiles" instead. I tried from CLI prompt of msys and successfully obtained the libraries from Windows machine.
If you are using Intel processors, you should first set-up Fortran environment for Visual Studio 2019
Better to check compilation guide and some troubleshooting Fortran Integration Issues with visual studio
Visual Studio comes with built-in clang support that can be enabled when installing. I have installed that support and now have all the clang executables in C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm\x64\bin.
I'm not using Visual Studio for development but just its clang build chain, I'm using CLion instead. Building works fine, but I have trouble debugging. I cannot debug, even though CLion says that it uses the "Bundled LLDB"; something just seems to go wrong, but CLion doesn't tell me what.
I have the suspicion that it somehow chose the wrong LLDB, so I wanted to check whether I can debug in the shell. But then I realized, that I am unable to locate that "bundled LLDB" CLion is mentioning. There is no lldb.exe in C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm\x64\bin. In fact, I couldn't find an lldb in any subdirectory of C:\Program Files (x86)\Microsoft Visual Studio\2019\Community. So where is the debugger for Visual Studio 2019 clang? Or which other debugger could I use? Could I use the native MSVC debugger instead? If yes, where is this one located?
You would have to build it yourself. From the website:
(*) Support for Windows is under active development. Basic
functionality is expected to work, with functionality improving
rapidly. ARM and AArch64 support is more experimental, with more known
issues than the others.
I am trying to run the code analysis of Visual Studio 2015 on my x64 VC++ project. However I get the following error:
Error C1250 Unable to load plug-in 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\\bin\localespc.dll'
I am activating the x64 toolset of Visual Studio by running the batch script "vcvarsall.bat amd64" before I start the IDE. Visual Studio is run with the "/useenv" option afterwards.
When I check the VC++ environment variables, I can see that the following path is contained in the PATH variable:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64
How can I tell Visual Studio to use the code analyzer (localespc.dll) from there and not the x86 version which it apparently tries to use (according to the error message).
Thanks a lot for your help!
I was having the same issue with my 64-bit C++ projects. I discovered simply renaming/removing localespc.dll from VC\bin allowed the Code Analysis builds to succeed and still report analysis warnings. It seems if VS doesn't find this dll in the VC\bin directory then it won't add the compiler switch for /analyze:plugin but otherwise passes all the other switches required by the Code Analysis.
Set the following property in your project file: <PreferredToolArchitecture>x64</PreferredToolArchitecture>
This tells Visual Studio to use the 64-bit version of various tools, including code analysis. I found How to make Visual Studio use the native amd64 toolchain helpful on the topic.
Note that renaming localespc.dll no longer solves the problem with Visual Studio 2017. It seems that setting PreferredToolArchitecture is Microsoft's intended way to do this.
I'm trying to compile a cuda test program on Windows 7 via Command Prompt,
I'm this command:
nvcc test.cu
But all I get is this error:
nvcc fatal : Cannot find compiler 'cl.exe' in PATH
What may be causing this error?
You will need to add the folder containing the "cl.exe" file to your path environment variable. For example:
C:\Program Files\Microsoft Visual Studio 10.0\VC\bin
Edit: Ok, go to My Computer -> Properties -> Advanced System Settings -> Environment Variables. Here look for "PATH" in the list, and add the path above (or whatever is the location of your cl.exe).
For new Visual Studio cl.exe is present in path => C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx64\x64
x64 is for 64bit
x86 is for 32bit
Solve this problem by adding this options to nvcc
nvcc x.cu ... -ccbin "D:\Program Files\Microsoft Visual Studio 11.0\VC\bin"
for example my compiler is VS2012. and cl.exe is in this dir
cl.exe is Microsoft's C/C++ compiler. So the problem is that you don't have that installed where the command line can find it.
nvcc is only a front end for the CUDA specific part of the program. It must invoke a full compiler to finish the job. In this case it cannot find the Visual Studio compiler 'cl.exe'
Check paths, nvcc documentation etc.
I see that this is an old question but I recently got this error on my Visual Studio 2012 when I tried to build my CUDA project. Apparently I had changed my CUDA project to the Nov 2012 pack, changing it back to the v110 that it usually is by default fixed this error.
In Visual Studio, left click on the CUDA project, ->properties->Configuration Properties-> General -> Platform toolset, and choose: Visual Studio 2012 (v110).
I could probably get it to work with the Nov 2012 pack, but the CUDA code does not use any of the additional functions of that pack, so it is not necessary. (That pack contains the variadic templates for C++11.)
Solve this problem by adding the path to environment variables, which can vary slightly depending in the version of visual studio installed in your system, and are you using 32bit or 64bit system
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64
I would like to use Microsoft Visual Studio 14.0's built in C compiler for simulation in 32-bit Dymola Demo Version 2017. I have opted to include C++ compiler during MVS installation and the files exist in the proper locations. When passing Dymola the location to the compiler, I receive the error:
Compiling and linking the model (Visual C++).
Error in script usage. The correct usage is:
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin\vcvars32"
or
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin\vcvars32" store
"Testing 32-bit compilation"
The command "cl" is either misspelled or could not be found.
Below attached are my settings.
Microsoft have changed some scripts or directory structure.
Visual Studio 2015 (aka 14.0) is supported out of the box by Dymola 2017 FD01 or newer,
so the easiest solution would probably be to switch to the very latest Dymola version:
https://www.3ds.com/products-services/catia/products/dymola/latest-release/
Also, when installing newer versions of Visual Studio, you should make sure to install the C++ components!!
If you forgot to install those, you can still install them later by following these steps:
open Visual Studio
click File, New, Project, then Templates, Visual C++
if the C++ parts are not installed, you will have the option to install them here
after that, you should be able to run the compiler test as shown in the screenshot below