mapillary / inplace_abn

In-Place Activated BatchNorm for Memory-Optimized Training of DNNs
BSD 3-Clause "New" or "Revised" License
1.32k stars 187 forks source link

Installation error: nvc unknown switch #238

Open mangelett opened 1 year ago

mangelett commented 1 year ago

Hi,

I try to install inplace_abn with the command python3 -m pip install inplace_abn. But it fails because of unknown switch:

      No CUDA runtime is found, using CUDA_HOME='/softs/nvidia/hpc_sdk/Linux_x86_64/22.11/cuda/11.8/'
      WARNING setuptools_scm.pyproject_reading toml section missing 'pyproject.toml does not contain a tool.setuptools_scm section'
      running install
      /softs/python/python3.10.9/efficientPS_env/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/inplace_abn
      copying inplace_abn/__init__.py -> build/lib.linux-x86_64-cpython-310/inplace_abn
      copying inplace_abn/abn.py -> build/lib.linux-x86_64-cpython-310/inplace_abn
      copying inplace_abn/functions.py -> build/lib.linux-x86_64-cpython-310/inplace_abn
      copying inplace_abn/group.py -> build/lib.linux-x86_64-cpython-310/inplace_abn
      copying inplace_abn/_version.py -> build/lib.linux-x86_64-cpython-310/inplace_abn
      running build_ext
      /softs/python/python3.10.9/efficientPS_env/lib/python3.10/site-packages/torch/utils/cpp_extension.py:476: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
        warnings.warn(msg.format('we could not find ninja.'))
      /softs/python/python3.10.9/efficientPS_env/lib/python3.10/site-packages/torch/utils/cpp_extension.py:338: UserWarning:

                                     !! WARNING !!

      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      Your compiler (/softs/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/bin/nvc++) is not compatible with the compiler Pytorch was
      built with for this platform, which is g++ on linux. Please
      use g++ to to compile your extension. Alternatively, you may
      compile PyTorch from source using /softs/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/bin/nvc++, and then you can also use
      /softs/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/bin/nvc++ to compile your extension.

      See https://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.md for help
      with compiling PyTorch from source.
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                                    !! WARNING !!

        warnings.warn(WRONG_COMPILER_WARNING.format(
      /softs/python/python3.10.9/efficientPS_env/lib/python3.10/site-packages/torch/utils/cpp_extension.py:398: UserWarning: There are no /softs/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/bin/nvc++ version bounds defined for CUDA version 11.8
        warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
      building 'inplace_abn._backend' extension
      creating build/temp.linux-x86_64-cpython-310
      creating build/temp.linux-x86_64-cpython-310/src
      /softs/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/bin/nvc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DWITH_CUDA=1 -I/tmp/pip-req-build-kudcpgf3/include -I/softs/python/python3.10.9/efficientPS_env/lib/python3.10/site-packages/torch/include -I/softs/python/python3.10.9/efficientPS_env/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/softs/python/python3.10.9/efficientPS_env/lib/python3.10/site-packages/torch/include/TH -I/softs/python/python3.10.9/efficientPS_env/lib/python3.10/site-packages/torch/include/THC -I/softs/nvidia/hpc_sdk/Linux_x86_64/22.11/cuda/11.8/include -I/softs/python/python3.10.9/efficientPS_env/include -I/softs/python/python3.10.9/include/python3.10 -c src/inplace_abn.cpp -o build/temp.linux-x86_64-cpython-310/src/inplace_abn.o -O3 -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=_backend -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17
      nvc-Error-Unknown switch: -Wno-unused-result
      nvc-Error-Unknown switch: -fwrapv
      error: command '/softs/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/bin/nvc' failed with exit code 1

The CUDA version is 11.8: see the return of nvcc --version:

nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0

I tried to installed torch with the specific CUDA version: python3 -m pip install torch==2.0.1+cu118 torchvision torchaudio --index-urlhttps://download.pytorch.org/whl/cu118but it didn't solve the problem. Is there a way to modify the compilation flags ?