torch1.11.0,二进制编译apex报错
收藏回复举报
torch1.11.0,二进制编译apex报错
发表于2023-12-12 17:13:37
0 查看

教程按照此链接来的 https://gitee.com/ascend/apex/tree/v1.11.0/

本机环境:

  • python3.9.18
  • cann 6.3RC2
  • torch 1.11.0
  • torch_npu 1.11.0

执行:python3 setup.py --cpp_ext --npu_float_status bdist_wheel 时报错:

^
/root/miniconda3/envs/torch1.11/lib/python3.9/site-packages/torch_npu/include/torch_npu/csrc/core/npu/npu_log.h:21:23: note: in definition of macro ‘ASCEND_LOGI’
   aclAppLog(ACL_INFO, __FILENAME__, __FUNCTION__, __LINE__, "[PTA]:"#fmt, ##__VA_ARGS__)
                       ^~~~~~~~~~~~
/root/miniconda3/envs/torch1.11/lib/python3.9/site-packages/torch_npu/include/torch_npu/csrc/core/npu/npu_log.h:21:23: note: suggested alternative: ‘__FILE__’
   aclAppLog(ACL_INFO, __FILENAME__, __FUNCTION__, __LINE__, "[PTA]:"#fmt, ##__VA_ARGS__)
                       ^
/root/miniconda3/envs/torch1.11/lib/python3.9/site-packages/torch_npu/include/torch_npu/csrc/core/npu/npu_log.h:21:23: note: in definition of macro ‘ASCEND_LOGI’
   aclAppLog(ACL_INFO, __FILENAME__, __FUNCTION__, __LINE__, "[PTA]:"#fmt, ##__VA_ARGS__)
                       ^~~~~~~~~~~~
/root/miniconda3/envs/torch1.11/lib/python3.9/site-packages/torch_npu/include/torch_npu/csrc/core/npu/NPUEvent.h: In member function ‘void c10_npu::NPUEvent::createEvent(c10::DeviceIndex)’:
/root/miniconda3/envs/torch1.11/lib/python3.9/site-packages/torch_npu/include/torch_npu/csrc/core/npu/npu_log.h:21:23: error: ‘__FILENAME__’ was not declared in this scope
   aclAppLog(ACL_INFO, __FILENAME__, __FUNCTION__, __LINE__, "[PTA]:"#fmt, ##__VA_ARGS__)
                       ^
/root/miniconda3/envs/torch1.11/lib/python3.9/site-packages/torch_npu/include/torch_npu/csrc/core/npu/npu_log.h:21:23: note: in definition of macro ‘ASCEND_LOGI’
   aclAppLog(ACL_INFO, __FILENAME__, __FUNCTION__, __LINE__, "[PTA]:"#fmt, ##__VA_ARGS__)
                       ^~~~~~~~~~~~
/root/miniconda3/envs/torch1.11/lib/python3.9/site-packages/torch_npu/include/torch_npu/csrc/core/npu/npu_log.h:21:23: note: suggested alternative: ‘__FILE__’
   aclAppLog(ACL_INFO, __FILENAME__, __FUNCTION__, __LINE__, "[PTA]:"#fmt, ##__VA_ARGS__)
                       ^
/root/miniconda3/envs/torch1.11/lib/python3.9/site-packages/torch_npu/include/torch_npu/csrc/core/npu/npu_log.h:21:23: note: in definition of macro ‘ASCEND_LOGI’
   aclAppLog(ACL_INFO, __FILENAME__, __FUNCTION__, __LINE__, "[PTA]:"#fmt, ##__VA_ARGS__)
                       ^~~~~~~~~~~~
In file included from /root/miniconda3/envs/torch1.11/lib/python3.9/site-packages/torch_npu/include/torch_npu/csrc/core/npu/NPUStream.h:31:0,
                 from /root/miniconda3/envs/torch1.11/lib/python3.9/site-packages/torch_npu/include/torch_npu/csrc/core/npu/NPUEvent.h:17,
                 from /home/ma-user/workspace_ljy/ljy/apex_torch1,11/apex/apex/csrc/npu_float_status/op_runner.cpp:21:
/root/miniconda3/envs/torch1.11/lib/python3.9/site-packages/torch_npu/include/torch_npu/csrc/aten/NPUNativeFunctions.h: At global scope:
/root/miniconda3/envs/torch1.11/lib/python3.9/site-packages/torch_npu/include/torch_npu/csrc/aten/NPUNativeFunctions.h:37:13: warning: ‘bool at_npu::key::isDeviceTensor(const at::Tensor&)’ defined but not used [-Wunused-function]
 static bool isDeviceTensor(const at::Tensor &tensor) {
             ^~~~~~~~~~~~~~
error: command '/usr/bin/gcc' failed with exit code 1

本机环境torch1.11.0 已验证torch_npu安装成功,如下所示:

(torch1.11) [root@bms-cq apex]# python3 -c "import torch;import torch_npu; a = torch.randn(3, 4).npu(); print(a + a);"
tensor([[ 2.3550, -4.5331,  0.9368,  3.8049],
        [-1.1262,  2.0880, -0.0305, -0.4717],
        [-0.3692, -3.1443, -2.4632, -1.8881]], device='npu:0')

本帖最后由 匿名用户 于 2023/12/12 17:24:22 编辑

我要发帖子