0

I am trying to use GCC to compile with nvcc as opposed to cl.exe using the command

nvcc -c -o depthconv_cuda_kernel.o depthconv_cuda_kernel.cu --compiler-bindir "C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin" --allow-unsupported-compiler  -x cu -Xcompiler -fPIC -std c++11 --gpu-architecture=compute_86 --gpu-code=sm_86 -DGPU -I"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/include" -DCUDNN --compiler-options "-DGPU -DCUDNN -fPIC"

Importantly I have set --compiler-bindir to the mingw bin directory, as well as used the flag --allow-unsupported-compiler (not sure if that is necessary).

I need gcc for the command line options std c++11 as well as -fPIC . It seems nvcc is still looking for MSVC's cl.exe, how can I change this so it uses the GCC compiler I need? I get the message:

Failed to run C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/cl.exe (The system cannot find the file specified. ). nvcc fatal : Failed to preprocess host compiler properties.

IntegrateThis
  • 853
  • 2
  • 16
  • 39
  • 2
    The only supported host compiler for CUDA on windows is cl.exe – Robert Crovella Nov 01 '20 at 22:58
  • @RobertCrovella I was afraid that might be the case, but I wanted to make sure. Is there any way around this, i.e to adapt the flags I need for cl.exe, in particular -fPIC and support for c++ 11 ? – IntegrateThis Nov 01 '20 at 23:00
  • I don't know if there is any way to trick nvcc. There was at least one question on the cuda tag where people were discussing how to use mingw. If you search on the cuda tag for mingw you may find it. Good luck! – Robert Crovella Nov 01 '20 at 23:08
  • 2
    any recent version of cl.exe supports c++11 natively. You don't need a flag for that. – Robert Crovella Nov 02 '20 at 00:00
  • 1
    Also https://stackoverflow.com/q/13309662/681865 -- I get the strong feel you don't understand what you are asking for and why you are asking for it – talonmies Nov 02 '20 at 00:27
  • @talonmies I just read this, and yes you are right, I am new to some of these topics. It seems that asking for -fPIC doesn't really make sense in the context of windows if I understand correctly. Any other thoughts/reading material appreciated as I am just learning. – IntegrateThis Nov 02 '20 at 00:32

0 Answers0