Verified-Intelligence / auto_LiRPA

auto_LiRPA: An Automatic Linear Relaxation based Perturbation Analysis Library for Neural Networks and General Computational Graphs
https://arxiv.org/pdf/2002.12920
Other
269 stars 67 forks source link

Error Installing Cuda Extensions #52

Open cherrywoods opened 10 months ago

cherrywoods commented 10 months ago

Describe the bug Running python auto_LiRPA/cuda_utils.py install fails (nvcc failed with exit code 1).

To Reproduce

environment.yaml file:

name: auto_LiRPA
channels:
  - pytorch
dependencies:
  - python=3.10
  - pytorch=1.12.1
  - torchvision=0.13.1
  - cudatoolkit=11.3
  - numpy=1.25.*
  - packaging=20.*
  - pytest=7.4.*
  - pylint=2.16.*
  - appdirs=1.4.*
  - pyyaml=6.*
  - ninja=1.10.*
  - tqdm=4.65.*
  - pip
  - pip:
    - pytest-order>=1.1.0,<1.2.0
conda env create -f environment.yaml
conda activate auto_LiRPA
python setup.py install
python auto_LiRPA/cuda_utils.py install

Output of last (failing) command:

Building and installing native CUDA modules...
running install
/home/dboetius/.miniconda3/envs/prob-specs/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
/home/dboetius/.miniconda3/envs/prob-specs/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` and ``easy_install``.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://github.com/pypa/setuptools/issues/917 for details.
        ********************************************************************************

!!
  self.initialize_options()
running bdist_egg
running egg_info
writing auto_LiRPA_cuda_utils.egg-info/PKG-INFO
writing dependency_links to auto_LiRPA_cuda_utils.egg-info/dependency_links.txt
writing top-level names to auto_LiRPA_cuda_utils.egg-info/top_level.txt
/home/dboetius/.miniconda3/envs/prob-specs/lib/python3.10/site-packages/torch/utils/cpp_extension.py:411: 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.'))
reading manifest file 'auto_LiRPA_cuda_utils.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'auto_LiRPA_cuda_utils.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
/home/dboetius/.miniconda3/envs/prob-specs/lib/python3.10/site-packages/torch/utils/cpp_extension.py:813: UserWarning: The detected CUDA version (11.5) has a minor version mismatch with the version that was used to compile PyTorch (11.3). Most likely this shouldn't be a problem.
  warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
/home/dboetius/.miniconda3/envs/prob-specs/lib/python3.10/site-packages/torch/utils/cpp_extension.py:820: UserWarning: There are no g++ version bounds defined for CUDA version 11.5
  warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
building 'auto_LiRPA_cuda_utils' extension
/usr/bin/nvcc -I/home/dboetius/.miniconda3/envs/prob-specs/lib/python3.10/site-packages/torch/include -I/home/dboetius/.miniconda3/envs/prob-specs/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/dboetius/.miniconda3/envs/prob-specs/lib/python3.10/site-packages/torch/include/TH -I/home/dboetius/.miniconda3/envs/prob-specs/lib/python3.10/site-packages/torch/include/THC -I/home/dboetius/.miniconda3/envs/prob-specs/include/python3.10 -c auto_LiRPA/cuda/cuda_kernels.cu -o build/temp.linux-x86_64-cpython-310/auto_LiRPA/cuda/cuda_kernels.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=auto_LiRPA_cuda_utils -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14
/home/dboetius/.miniconda3/envs/prob-specs/lib/python3.10/site-packages/torch/include/c10/core/SymInt.h(84): warning #68-D: integer conversion resulted in a change of sign

/home/dboetius/.miniconda3/envs/prob-specs/lib/python3.10/site-packages/torch/include/c10/core/SymInt.h(84): warning #68-D: integer conversion resulted in a change of sign

/usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:
  435 |         function(_Functor&& __f)
      |                                                                                                                                                 ^ 
/usr/include/c++/11/bits/std_function.h:435:145: note:         ‘_ArgTypes’
/usr/include/c++/11/bits/std_function.h:530:146: error: parameter packs not expanded with ‘...’:
  530 |         operator=(_Functor&& __f)
      |                                                                                                                                                  ^ 
/usr/include/c++/11/bits/std_function.h:530:146: note:         ‘_ArgTypes’
error: command '/usr/bin/nvcc' failed with exit code 1

System configuration:

huanzhang12 commented 10 months ago

Thank you for reporting it to us! The CUDA extension is currently not actively used. You can skip its installation for now. It should not be an issue at this time.

cherrywoods commented 10 months ago

Alright, thank you for your answer! Maybe it would be good to remove (or expand) the section on installing the CUDA extensions in the README in this case.