一、问题现象(附报错日志上下文):
按照:https://gitee.com/ascend/pytorch/tree/2.0.3.tr5/ 链接中的README.zh.md操作到编译torch的二进制包时报错
二、软件版本:
-- CANN 版本 (e.g., CANN 5.0.3):
--Tensorflow/Pytorch/MindSpore 版本:pytorch 1.8.1
--Python 版本 (e.g., Python 3.7.5):
-- MindStudio版本 (e.g., MindStudio 2.0.0 (beta3)):
--操作系统版本 (e.g., Ubuntu 18.04):
三、测试步骤:
按照 https://gitee.com/ascend/pytorch/tree/2.0.3.tr5/ 链接中README.zh.md 操作步骤操作的
四、日志信息:
[ 95%] Built target tensorpipe_agent
/home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to at::native::npu_random_choice_with_mask(at::Tensor const&, long, long, long)' /home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to
at::native::npu_ps_roi_pooling(at::Tensor const&, at::Tensor const&, double, long, long)'
/home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to at::native::npu_bounding_box_encode(at::Tensor const&, at::Tensor const&, double, double, double, double, double, double, double, double)' /home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to
at::native::npu_nms_v4(at::Tensor const&, at::Tensor const&, c10::Scalar, at::Tensor const&, at::Tensor const&, bool)'
/home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to at::native::npu_clear_float_status(at::Tensor const&)' /home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to
at::native::npu_get_float_status(at::Tensor const&)'
/home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to at::native::npu_batch_nms(at::Tensor const&, at::Tensor const&, double, double, long, long, bool, bool)' /home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to
at::native::npu_ptiou(at::Tensor const&, at::Tensor const&, long)'
/home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to at::native::npu_softmax_cross_entropy_with_logits(at::Tensor const&, at::Tensor const&)' /home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to
at::native::npu_nms_with_mask(at::Tensor const&, c10::Scalar)'
/home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to at::native::npu_roi_alignbk(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, long, long, double, long, c10::optional<long>)' /home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to
at::native::npu_softmax_cross_entropy_with_logits_backward(at::Tensor const&, at::Tensor const&, at::Tensor const&)'
/home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to at::native::npu_apply_adam(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::Scalar, c10::Scalar, c10::Scalar, c10::Scalar, c10::Scalar, c10::Scalar, at::Tensor const&, c10::optional<bool>, c10::optional<bool>)' /home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to
at::native::npu_roi_align(at::Tensor const&, at::Tensor const&, double, long, long, long, long)'
/home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to at::native::npu_pad(at::Tensor const&, c10::ArrayRef<long>)' /home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to
at::native::npu_bounding_box_decode(at::Tensor const&, at::Tensor const&, double, double, double, double, double, double, double, double, c10::ArrayRef, double)'
/home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to at::native::npu_alloc_float_status(at::Tensor const&)' /home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to
at::native::npu_one_hot(at::Tensor const&, long, long, c10::Scalar, c10::Scalar)'
/home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to at::native::npu_ps_roi_pooling_backward(at::Tensor const&, at::Tensor const&, double, long, long, c10::ArrayRef<long>)' /home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to
at::native::npu_iou(at::Tensor const&, at::Tensor const&, long)'
/home/qindai/tools/pytorch/pytorch/build/lib/libtorch_cpu.so: undefined reference to `at::native::npu_bert_apply_adam(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::Scalar, c10::Scalar, c10::Scalar, c10::Scalar, at::Tensor const&, c10::Scalar, c10::Scalar, c10::Scalar)'
collect2: error: ld returned 1 exit status
caffe2/torch/lib/libshm/CMakeFiles/torch_shm_manager.dir/build.make:108: recipe for target 'bin/torch_shm_manager' failed
make[2]: *** [bin/torch_shm_manager] Error 1
CMakeFiles/Makefile2:4720: recipe for target 'caffe2/torch/lib/libshm/CMakeFiles/torch_shm_manager.dir/all' failed
make[1]: *** [caffe2/torch/lib/libshm/CMakeFiles/torch_shm_manager.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[100%] Built target torch_python
Makefile:159: recipe for target 'all' failed
make: *** [all] Error 2
Traceback (most recent call last):
File "setup.py", line 835, in
build_deps()
File "setup.py", line 337, in build_deps
cmake=cmake)
File "/home/qindai/tools/pytorch/pytorch/tools/build_pytorch_libs.py", line 58, in build_caffe2
cmake.build(my_env)
File "/home/qindai/tools/pytorch/pytorch/tools/setup_helpers/cmake.py", line 345, in build
self.run(build_args, my_env)
File "/home/qindai/tools/pytorch/pytorch/tools/setup_helpers/cmake.py", line 140, in run
check_call(command, cwd=self.build_dir, env=env)
File "/usr/local/python3.7.5/lib/python3.7/subprocess.py", line 363, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '16']' returned non-zero exit status 2.
Failed to compile the wheel file. Please check the source code by yourself.
获取方法请参考wiki: