open-mmlab / mmcv

OpenMMLab Computer Vision Foundation
https://mmcv.readthedocs.io/en/latest/
Apache License 2.0
5.91k stars 1.65k forks source link

[Bug] 无法在华为Ascend 910上编译安装MMCV #3002

Closed chekistcccp closed 10 months ago

chekistcccp commented 11 months ago

Prerequisite

Environment

EulerOS 2.0 (SP8), CANN-6.3.RC2, PyTorch-1.11.0, torch-npu 1.11.0.post1.dev20230719

Reproduces the problem - code sample

mmcv/mmcv/ops/csrc/common/pytorch_npu_helper.hpp

Reproduces the problem - command or script

MMCV_WITH_OPS=1 MAX_JOBS=8 FORCE_NPU=1 python setup.py build_ext

Reproduces the problem - error message

[51/95] c++ -MMD -MF /home/ma-user/work/mmcv/build/temp.linux-aarch64-cpython-37/mmcv/ops/csrc/pytorch/npu/nms_npu.o.d -pthread -B /home/ma-user/anaconda3/envs/PyTorch-1.11.0/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DMMCV_WITH_NPU -DMMCV_WITH_XLA -I/home/ma-user/work/mmcv/mmcv/ops/csrc/common -I/home/ma-user/work/mmcv/mmcv/ops/csrc/common/npu -I/home/ma-user/anaconda3/envs/PyTorch-1.11.0/lib/python3.7/site-packages/torch_npu/include -I/home/ma-user/anaconda3/envs/PyTorch-1.11.0/lib/python3.7/site-packages/torch/include -I/home/ma-user/anaconda3/envs/PyTorch-1.11.0/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/ma-user/anaconda3/envs/PyTorch-1.11.0/lib/python3.7/site-packages/torch/include/TH -I/home/ma-user/anaconda3/envs/PyTorch-1.11.0/lib/python3.7/site-packages/torch/include/THC -I/home/ma-user/anaconda3/envs/PyTorch-1.11.0/include/python3.7m -c -c /home/ma-user/work/mmcv/mmcv/ops/csrc/pytorch/npu/nms_npu.cpp -o /home/ma-user/work/mmcv/build/temp.linux-aarch64-cpython-37/mmcv/ops/csrc/pytorch/npu/nms_npu.o -std=c++14 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=1 FAILED: /home/ma-user/work/mmcv/build/temp.linux-aarch64-cpython-37/mmcv/ops/csrc/pytorch/npu/nms_npu.o c++ -MMD -MF /home/ma-user/work/mmcv/build/temp.linux-aarch64-cpython-37/mmcv/ops/csrc/pytorch/npu/nms_npu.o.d -pthread -B /home/ma-user/anaconda3/envs/PyTorch-1.11.0/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DMMCV_WITH_NPU -DMMCV_WITH_XLA -I/home/ma-user/work/mmcv/mmcv/ops/csrc/common -I/home/ma-user/work/mmcv/mmcv/ops/csrc/common/npu -I/home/ma-user/anaconda3/envs/PyTorch-1.11.0/lib/python3.7/site-packages/torch_npu/include -I/home/ma-user/anaconda3/envs/PyTorch-1.11.0/lib/python3.7/site-packages/torch/include -I/home/ma-user/anaconda3/envs/PyTorch-1.11.0/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/ma-user/anaconda3/envs/PyTorch-1.11.0/lib/python3.7/site-packages/torch/include/TH -I/home/ma-user/anaconda3/envs/PyTorch-1.11.0/lib/python3.7/site-packages/torch/include/THC -I/home/ma-user/anaconda3/envs/PyTorch-1.11.0/include/python3.7m -c -c /home/ma-user/work/mmcv/mmcv/ops/csrc/pytorch/npu/nms_npu.cpp -o /home/ma-user/work/mmcv/build/temp.linux-aarch64-cpython-37/mmcv/ops/csrc/pytorch/npu/nms_npu.o -std=c++14 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=1 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ In file included from /home/ma-user/work/mmcv/mmcv/ops/csrc/pytorch/npu/nms_npu.cpp:1:0: /home/ma-user/work/mmcv/mmcv/ops/csrc/common/pytorch_npu_helper.hpp:21:10: fatal error: torch_npu/csrc/aten/CustomFunctions.h: No such file or directory

include <torch_npu/csrc/aten/CustomFunctions.h>

      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated.

Additional information

mmcv在npu上的支持是基于CANN-6.3.RC1实现的,目前华为CANN已经更新至6.3RC2和7.0版本,编译时依赖出现变化,需要贵方重新检查代码更新依赖

Liligo commented 11 months ago

遇到了同样的问题

Balabala-Hong commented 11 months ago

+1