diff --git a/atvc/examples/ops_pytorch/add/README.md b/atvc/examples/ops_pytorch/add/README.md index d05f80b8fe5a6096dbd08e329fbf64ad5dc390b4..a410bbb708b90eef3847f640989de9ca69228a72 100644 --- a/atvc/examples/ops_pytorch/add/README.md +++ b/atvc/examples/ops_pytorch/add/README.md @@ -119,7 +119,8 @@ z = x + y -L${torch_location}/lib \ -L${torch_npu_location}/lib \ -L${python_lib} \ - -L_ASCEND_INSTALL_PATH/lib64 \ + -L${lib_path} \ + -L${_ASCEND_INSTALL_PATH}/lib64 \ -ltorch -ltorch_cpu -lc10 -ltorch_npu -lpython3 -ltorch_python \ -shared -cce-enable-plugin --cce-aicore-arch=dav-c220 -fPIC -ltiling_api -lplatform -lm -ldl \ -o libascendc_pytorch.so diff --git a/atvc/examples/ops_pytorch/add/run.sh b/atvc/examples/ops_pytorch/add/run.sh index 217025b6eba2b27faabe86d0a7b7fa0af9a1ecf1..f08ce377999b7c644f6d33a11239d6ee9113f897 100644 --- a/atvc/examples/ops_pytorch/add/run.sh +++ b/atvc/examples/ops_pytorch/add/run.sh @@ -13,6 +13,7 @@ torch_location=$(python3 -c "import torch; print(torch.__path__[0])") torch_npu_location=$(python3 -c "import torch_npu; print(torch_npu.__path__[0])") python_include=$(python3 -c "import sysconfig; print(sysconfig.get_path('include'))") python_lib=$(python3 -c "import sysconfig; print(sysconfig.get_path('stdlib'))") +lib_path=$(dirname "$python_lib") export LD_LIBRARY_PATH=${torch_npu_location}/lib/:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=${torch_location}/lib/:$LD_LIBRARY_PATH if [ -z "$ATVC_PATH" ]; then @@ -47,7 +48,8 @@ bisheng -x cce pytorch_ascendc_extension.cpp \ -L${torch_location}/lib \ -L${torch_npu_location}/lib \ -L${python_lib} \ - -L_ASCEND_INSTALL_PATH/lib64 \ + -L${lib_path} \ + -L${_ASCEND_INSTALL_PATH}/lib64 \ -ltorch -ltorch_cpu -lc10 -ltorch_npu -lpython3 -ltorch_python \ -shared -cce-enable-plugin --cce-aicore-arch=dav-c220 -fPIC -ltiling_api -lplatform -lm -ldl \ -o libascendc_pytorch.so diff --git a/atvc/examples/ops_pytorch/reduce_sum/README.md b/atvc/examples/ops_pytorch/reduce_sum/README.md index a61696fde9b28c46dbf54de55063934930e3ec7c..c392188baf8b3c2cc33ef95d74cba928fcdedd79 100644 --- a/atvc/examples/ops_pytorch/reduce_sum/README.md +++ b/atvc/examples/ops_pytorch/reduce_sum/README.md @@ -147,7 +147,8 @@ ReduceSum是对输入tensor的指定轴进行规约累加的计算并输出结 -L${torch_location}/lib \ -L${torch_npu_location}/lib \ -L${python_lib} \ - -L_ASCEND_INSTALL_PATH/lib64 \ + -L${lib_path} \ + -L${_ASCEND_INSTALL_PATH}/lib64 \ -ltorch -ltorch_cpu -lc10 -ltorch_npu -lpython3 -ltorch_python \ -shared -cce-enable-plugin --cce-aicore-arch=dav-c220 -fPIC -ltiling_api -lplatform -lm -ldl \ -o libascendc_pytorch.so diff --git a/atvc/examples/ops_pytorch/reduce_sum/run.sh b/atvc/examples/ops_pytorch/reduce_sum/run.sh index 8c8c371ba1034990556ebc0d6a8027ee7e3a3fac..d0d27305d23756de9ada19d33f66e976957434a2 100644 --- a/atvc/examples/ops_pytorch/reduce_sum/run.sh +++ b/atvc/examples/ops_pytorch/reduce_sum/run.sh @@ -13,6 +13,7 @@ torch_location=$(python3 -c "import torch; print(torch.__path__[0])") torch_npu_location=$(python3 -c "import torch_npu; print(torch_npu.__path__[0])") python_include=$(python3 -c "import sysconfig; print(sysconfig.get_path('include'))") python_lib=$(python3 -c "import sysconfig; print(sysconfig.get_path('stdlib'))") +lib_path=$(dirname "$python_lib") export LD_LIBRARY_PATH=${torch_npu_location}/lib/:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=${torch_location}/lib/:$LD_LIBRARY_PATH if [ -z "$ATVC_PATH" ]; then @@ -47,7 +48,8 @@ bisheng -x cce pytorch_ascendc_extension.cpp \ -L${torch_location}/lib \ -L${torch_npu_location}/lib \ -L${python_lib} \ - -L_ASCEND_INSTALL_PATH/lib64 \ + -L${lib_path} \ + -L${_ASCEND_INSTALL_PATH}/lib64 \ -ltorch -ltorch_cpu -lc10 -ltorch_npu -lpython3 -ltorch_python \ -shared -cce-enable-plugin --cce-aicore-arch=dav-c220 -fPIC -ltiling_api -lplatform -lm -ldl \ -o libascendc_pytorch.so