Closed
[Bug-Report|缺陷反馈]: aclInit在AdxDataDumpServerInit报错,与dump组件有同名函数,走到ge中报错 #77
ffmhAdd on Jun 3Closed at Jul 8
xiangrenzhi
Jun 3 Comments:
Jun 3 Comments:
感谢指出这个问题,经初步确认,该问题应该由于在libge_runner.so里引用了adump_server.a导致的,具体修复方案正在进一步确认中。


Jun 25 Assign xiangrenzhi as responsible person
Jul 6 Assign lidaoming1 as responsible person
Jul 6 Removed responsible person xiangrenzhi
lidaoming1
Jul 6 Comments:
Jul 6 Comments:
Jul 8 changed custom state from 进行中 to 已解决
Jul 8 Close issue
wuyouqi1
Nov 4 Comments:
Nov 4 Comments:
export LD_LIBRARY_PATH=${CONDA_PREFIX}/lib/python3.10/site-packages/torch/lib:${CONDA_PREFIX}/lib/python3.10/site-packages/torch_npu/lib:${CONDA_PREFIX}/lib:${ASCEND_TOOLKIT_HOME}/lib64:/usr/local/Ascend/driver/lib64:/usr/local/Ascend/driver/lib64/driver:${LD_LIBRARY_PATH}
./a.out


wuyouqi1
28 days ago Comments:
28 days ago Comments:
arm:
(wyq_py10) -bash-5.2$ cat demo_usenpu.cpp
// demo_usenpu.cpp: REAL libtorch_npu usage demo.
// References an actual libtorch_npu.so exported symbol (GetCANNVersion) so that
// -Wl,--as-needed cannot drop the dependency, then calls aclInit(acl_default.json).
// Purpose: prove --as-needed is NOT a workaround for issue 77 real mixed-use programs.
#include <stdio.h>
#include <string>
#include <acl/acl.h>
#include <torch_npu/csrc/core/npu/GetCANNInfo.h>
int main() {
// real libtorch_npu API call (harmless: version query only, no ACL init side effect)
std::string ver = GetCANNVersion("CANN");
printf("[torch_npu API] GetCANNVersion() = %s\n", ver.c_str());
const char* cfg = "./acl_default.json";
int ret = aclInit(cfg);
printf("aclInit returned %d (0x%x)\n", ret, ret);
if (ret == 0) {
printf("aclFinalize returned %d\n", aclFinalize());
}
return ret == 0 ? 0 : 1;
}
(wyq_py10) -bash-5.2$ g++ demo_usenpu.cpp -o b.out \
-I${CONDA_PREFIX}/lib/python3.10/site-packages/torch_npu/include \
-I${ASCEND_TOOLKIT_HOME}/include -I${CONDA_PREFIX}/include/python3.10/ \
-Wl,--as-needed \
-L${CONDA_PREFIX}/lib/python3.10/site-packages/torch/lib \
-L${CONDA_PREFIX}/lib/python3.10/site-packages/torch_npu/lib \
-L${ASCEND_TOOLKIT_HOME}/lib64 -L${CONDA_PREFIX}/lib/ \
-ltorch_npu -ltorch -ltorch_cpu -ltorch_python -lc10 -lascendcl -lpython3.10
(wyq_py10) -bash-5.2$
(wyq_py10) -bash-5.2$ ./b.out
[torch_npu API] GetCANNVersion() = 9.3.0
aclInit returned 500000 (0x7a120)
x86:
(base) root@huawei:/home/wyq# g++ demo_npu.cpp -o b.out -I${CONDA_PREFIX}/lib/python3.12/site-packages/torch_npu/include -I${ASCEND_TOOLKIT_HOME}/include -I${CONDA_PREFIX}/include/python3.12/ -Wl,--as-needed -L${CONDA_PREFIX}/lib/python3.12/site-packages/torch/lib -L${CONDA_PREFIX}/lib/python3.12/site-packages/torch_npu/lib -L${ASCEND_TOOLKIT_HOME}/lib64 -L${CONDA_PREFIX}/lib/ -ltorch_npu -ltorch -ltorch_cpu -ltorch_python -lc10 -lascendcl -lpython3.12
(base) root@huawei:/home/wyq# ./b.out
[torch_npu API] GetCANNVersion() = 9.3.0
aclInit returned 0 (0x0)
aclFinalize returned 0
(base) root@huawei:/home/wyq# cat demo_npu.cpp
// demo_usenpu.cpp: REAL libtorch_npu usage demo.
// References an actual libtorch_npu.so exported symbol (GetCANNVersion) so that
// -Wl,--as-needed cannot drop the dependency, then calls aclInit(acl_default.json).
// Purpose: prove --as-needed is NOT a workaround for issue 77 real mixed-use programs.
#include <stdio.h>
#include <string>
#include <acl/acl.h>
#include <torch_npu/csrc/core/npu/GetCANNInfo.h>
int main() {
// real libtorch_npu API call (harmless: version query only, no ACL init side effect)
std::string ver = GetCANNVersion("CANN");
printf("[torch_npu API] GetCANNVersion() = %s\n", ver.c_str());
const char* cfg = "./acl_default.json";
int ret = aclInit(cfg);
printf("aclInit returned %d (0x%x)\n", ret, ret);
if (ret == 0) {
printf("aclFinalize returned %d\n", aclFinalize());
}
return ret == 0 ? 0 : 1;
}
(base) root@huawei:/home/wyq# cat acl_default.json
{"dump":{"dump_scene":"lite_exception"}, "defaultDevice":{"default_device":"0"}}
(base) root@huawei:/home/wyq#


Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.
Describe the current behavior / 问题描述 (Mandatory / 必填)
aclInit returned 500000 (0x7a120)aclInit在AdxDataDumpServerInit报错,与dump组件有同名函数,走到ge中报错。
Environment / 环境信息 (Mandatory / 必填)
910B, CANN9.0.0/9.1.0
Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)
// demo.cpp #include <stdio.h> #include <acl/acl.h> //#include <pybind11/embed.h> //namespace py = pybind11; int main() { //py::scoped_interpreter guard{}; //py::module_::import("torch_npu"); // torch_npu.__init__.py → _lazy_init() → aclInit(acl_default.json) → 500000 const char* cfg = "./acl_default.json"; int ret = aclInit(cfg); // int ret = aclInit(nullptr); printf("aclInit returned %d (0x%x)\n", ret, ret); return 0; }g++ -I ${ASCEND_TOOLKIT_HOME}/include \ -I ${CONDA_PREFIX}/include/python3.10/ \ -L ${CONDA_PREFIX}/lib/python3.10/site-packages/torch/lib \ -L ${CONDA_PREFIX}/lib/python3.10/site-packages/torch_npu/lib \ -L ${ASCEND_TOOLKIT_HOME}/lib64 \ -L ${CONDA_PREFIX}/lib/ \ -ltorch_npu -ltorch -ltorch_cpu -ltorch_python -lc10 -lascendcl -lpython3.10 -lgfortran \ demo.cpp -o a.outDescribe the expected behavior / 预期结果 (Mandatory / 必填)
aclInit正常返回
Related log / screenshot / 日志 / 截图 (Mandatory / 必填)
Special notes for this issue/备注 (Optional / 选填)