facebookresearch / maskrcnn-benchmark

Fast, modular reference implementation of Instance Segmentation and Object Detection algorithms in PyTorch.
MIT License
9.3k stars 2.49k forks source link

CUDA host_config error in Windows 10 installation #787

Open qalid7 opened 5 years ago

qalid7 commented 5 years ago

Hi All

Just a quick question here because CUDA/Visual Studio never returned this error in any other cuda related build.

CUDA9, Windows 10, latest GCC, with the new updated installation guidelines, everything seems to be working until I reach the apex/PyTorch Detection part. I get this error:

c:\program files\nvidia gpu computing toolkit\cuda\v9.0\include\crt/host_config.h(133): fatal error C1189: #error: -- unsupported Microsoft Visual Studio version! Only the versions 2012, 2013, 2015 and 2017 are supported! error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v9.0\\bin\\nvcc.exe' failed with exit status 2

I've looked it up elsewhere and it seems like this error has been sorted with CUDA-9, line 131: #if _MSC_VER < 1600 || _MSC_VER > 1911

What am I missing?

willyd commented 5 years ago

Looks like you have Visual Studio 2019 installed and the build is picking up this version? Not sure how but you should try to force it to pick a different version. Maybe by running vcvarsall.bat amd64?

qalid7 commented 5 years ago

@willyd don't really have VS 2019. I'm actually suspecting it's to do with GCC somehow.. shouldn't VS be disabled for GCC, it's not a requirement is it?

willyd commented 5 years ago

AFAIK you cannot build CUDA code with gcc on Windows. Have you tried removing gcc from your PATH?

I was able to build on Windows but I checked out a commit before the introduction on apex. Maybe this will help you.

HZY302 commented 5 years ago

Have you solved this problem?Can you share the way to solve this problem?

ruoyussh commented 5 years ago

I have encountered the same problem, has anyone solved this?

erick84mm commented 5 years ago

Unfortunately, I couldn't make it work with Visual Studio 2019, so I downgraded to 2017 and everything works.

qalid7 commented 5 years ago

@erick84mm by downgrading you mean? I've both 2015, 2017 installed. Still getting that above error!

erick84mm commented 5 years ago

@qalid7 Here is the procedure I took

Steps to make it work.

  1. Uninstalled Visual Studio 2019
  2. Uninstalled GCC (The build does not work with GCC, because GCC is not compatible with CUDA in windows yet)
  3. Uninstalled all versions of Visual Studio
  4. Installed Visual Studio 2017 (install 2015 for cuda 9 or follow notes)
  5. Deleted my conda environment
  6. followed the maskrcnn_benchmark Windows installation instructions
  7. No problems...

Note, if you are using cuda 9 and VS 2017 you need to install the VC++ 2017 version 15.4 v14.11 toolset (you can do this from the Visual Studio 2017 installer)

image

After that, you need to activate the toolset as default. you can do this by using the following command

cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build" .\vcvarsall.bat x64 -vcvars_ver="14.11"

Notice that I'm using the community edition of VS, you may need to adjust the path to match the version you are using

Additionally notice that:

if _MSC_VER < 1600 || _MSC_VER > 1911

_MSC_VER has to be between 1600 and 1911 (inclusive) and as you can see in the table all VS 2015 versions are within the range, but not all VS 2017 versions are image

List of MSC_VER https://dev.to/yumetodo/list-of-mscver-and-mscfullver-8nd

qalid7 commented 5 years ago

Very useful thanks so much @erick84mm , will give it a go!

CodeAunt commented 4 years ago

Use CUDA 10.0 + visual studio 2017 15.9.23 (14.16) worked successfully. some tricks to compile it on windows10 https://www.cnblogs.com/venusian/p/12996005.html