From dd547dc8860798abb42907e3e206201aa8b29c22 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 5 Nov 2020 16:01:23 +0800 Subject: [PATCH 01/64] update CMakeLists.txt. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc85f683c..da0f35493 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,9 +3,9 @@ if (ENABLE_OPEN_SRC) cmake_minimum_required(VERSION 3.14) project(TFAdapter) - set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD 17) set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "-std=c++17 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") # build external prjects if(DEFINED ENV{D_PKG_SERVER}) set(TF_PKG_SERVER $ENV{D_PKG_SERVER}) -- Gitee From 68165a6dad8646e69f7bfed3d2b69df761969dfb Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 5 Nov 2020 16:09:22 +0800 Subject: [PATCH 02/64] update CMakeLists.txt. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index da0f35493..dc85f683c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,9 +3,9 @@ if (ENABLE_OPEN_SRC) cmake_minimum_required(VERSION 3.14) project(TFAdapter) - set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD 11) set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-std=c++17 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") # build external prjects if(DEFINED ENV{D_PKG_SERVER}) set(TF_PKG_SERVER $ENV{D_PKG_SERVER}) -- Gitee From a676f0c92fccc9bf40439eb342a65e3c08df52ba Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 5 Nov 2020 16:37:05 +0800 Subject: [PATCH 03/64] update CMakeLists.txt. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc85f683c..2fd2e4aef 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,8 @@ if (ENABLE_OPEN_SRC) project(TFAdapter) set(CMAKE_CXX_STANDARD 11) - set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") + set(CMAKE_C_FLAGS "-O2 -DNDEBUG -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -DNDEBUG -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") # build external prjects if(DEFINED ENV{D_PKG_SERVER}) set(TF_PKG_SERVER $ENV{D_PKG_SERVER}) -- Gitee From d3d49f2e5d1c79a8321fe066cfe2ab3f5e3e8591 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 14:12:02 +0800 Subject: [PATCH 04/64] update CMakeLists.txt. --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fd2e4aef..56c71c2b7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,13 +11,13 @@ if (ENABLE_OPEN_SRC) set(TF_PKG_SERVER $ENV{D_PKG_SERVER}) message("Download packages from PKG server") endif() - include(${CMAKE_CURRENT_LIST_DIR}/cmake/nlohmann_json.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/cmake/secure_c.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/cmake/tensorflow.cmake) include_directories(${CMAKE_CURRENT_LIST_DIR}) include_directories(${CMAKE_CURRENT_LIST_DIR}/inc) include_directories(${CMAKE_CURRENT_LIST_DIR}/inc/external) include_directories(${CMAKE_CURRENT_LIST_DIR}/inc/soft_dp) + include(${CMAKE_CURRENT_LIST_DIR}/cmake/nlohmann_json.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/cmake/secure_c.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/cmake/tensorflow.cmake) if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/tools/COMPILE_FLAGS OR NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/tools/LINK_FLAGS OR NOT EXISTS -- Gitee From 100cb2af22f7d573fb2606da2203238f89af280b Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 14:17:43 +0800 Subject: [PATCH 05/64] update configure.py. --- configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.py b/configure.py index ce7a3ec12..55659fbe3 100755 --- a/configure.py +++ b/configure.py @@ -181,8 +181,8 @@ def setup_swig(): def main(): env_snapshot = dict(os.environ) - setup_python() setup_ascend(env_snapshot.get(_ASCEND_INSTALL_PATH_ENV)) + setup_python() setup_swig() -- Gitee From baaf849ba714d0dc58923f6f8c8e83013d28ff48 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 14:40:18 +0800 Subject: [PATCH 06/64] update configure.py. --- configure.py | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.py b/configure.py index 55659fbe3..f644fbda9 100755 --- a/configure.py +++ b/configure.py @@ -139,6 +139,7 @@ def setup_ascend(env_path): f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libindextransform.so\n")) f.write(os.path.join(ascend_path, "driver", "lib64", "driver", "libtsdclient.so\n")) f.write(os.path.join(ascend_path, "driver", "lib64", "common", "libc_sec.so\n")) + f.write(os.path.join(ascend_path, "driver", "lib64", "common", "libmmpa.so\n")) def setup_swig(): """Get swig install path.""" -- Gitee From 0f90ea2e8a8c4a78f02b910f3520229727e13bd1 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 15:02:21 +0800 Subject: [PATCH 07/64] update configure.py. --- configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.py b/configure.py index f644fbda9..423decade 100755 --- a/configure.py +++ b/configure.py @@ -132,7 +132,7 @@ def setup_ascend(env_path): elif not os.path.exists(ascend_path): print('Invalid ascend path: %s cannot be found.' % ascend_path) - with open(real_config_path('LINK_FLAGS'), 'a') as f: + with open(real_config_path('LINK_FLAGS'), 'w') as f: f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libfmk_parser.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libdatatransfer.so\n")) -- Gitee From 17edcc981717c479d7408c205916984465014055 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 16:07:48 +0800 Subject: [PATCH 08/64] update CMakeLists.txt. --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 56c71c2b7..a94560198 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,19 @@ if (ENABLE_OPEN_SRC) target_link_libraries(_tf_adapter PUBLIC "${LINK_FLAG}") endforeach (LINK_FLAG) + target_link_libraries(tf_adapter PUBLIC + $ + -Wl,--no-as-needed + ${ASCEND_CUSTOM_PATH}/fwkacllib/lib64/libge_runner.so + ${ASCEND_CUSTOM_PATH}/fwkacllib/lib64/libfmk_parser.so + ${ASCEND_CUSTOM_PATH}/fwkacllib/lib64/libdatatransfer.so + ${ASCEND_CUSTOM_PATH}/fwkacllib/lib64/libindextransform.so + ${ASCEND_CUSTOM_PATH}/fwkacllib/lib64/libtsdclient.so + ${ASCEND_CUSTOM_PATH}/driver/lib64/common/libc_sec.so + ${ASCEND_CUSTOM_PATH}/driver/lib64/common/libmmpa.so + -Wl,--as-needed + ) + set_target_properties(_tf_adapter PROPERTIES PREFIX "") set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/dist/python/npu_bridge) -- Gitee From 8a54767dbeaa2ec518c88813cab62161a51736f2 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 16:10:34 +0800 Subject: [PATCH 09/64] update configure.py. --- configure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.py b/configure.py index 423decade..74e324d74 100755 --- a/configure.py +++ b/configure.py @@ -131,7 +131,7 @@ def setup_ascend(env_path): break elif not os.path.exists(ascend_path): print('Invalid ascend path: %s cannot be found.' % ascend_path) - +""" with open(real_config_path('LINK_FLAGS'), 'w') as f: f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libfmk_parser.so\n")) @@ -140,7 +140,7 @@ def setup_ascend(env_path): f.write(os.path.join(ascend_path, "driver", "lib64", "driver", "libtsdclient.so\n")) f.write(os.path.join(ascend_path, "driver", "lib64", "common", "libc_sec.so\n")) f.write(os.path.join(ascend_path, "driver", "lib64", "common", "libmmpa.so\n")) - +""" def setup_swig(): """Get swig install path.""" default_swig_path = which('swig') -- Gitee From 6fdd00dccae70a15c6abf3bb9619dcca48d36363 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 16:13:45 +0800 Subject: [PATCH 10/64] update CMakeLists.txt. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a94560198..4b9a24c23 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,7 @@ if (ENABLE_OPEN_SRC) foreach (LINK_FLAG ${LINK_FLAGS}) target_link_libraries(_tf_adapter PUBLIC "${LINK_FLAG}") endforeach (LINK_FLAG) - +""" target_link_libraries(tf_adapter PUBLIC $ -Wl,--no-as-needed @@ -60,6 +60,7 @@ if (ENABLE_OPEN_SRC) ${ASCEND_CUSTOM_PATH}/driver/lib64/common/libmmpa.so -Wl,--as-needed ) +""" set_target_properties(_tf_adapter PROPERTIES PREFIX "") -- Gitee From 133a12673d2442e70b1ba6445897051715b62d1e Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 16:14:06 +0800 Subject: [PATCH 11/64] update CMakeLists.txt. --- CMakeLists.txt | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b9a24c23..56c71c2b7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,20 +47,6 @@ if (ENABLE_OPEN_SRC) foreach (LINK_FLAG ${LINK_FLAGS}) target_link_libraries(_tf_adapter PUBLIC "${LINK_FLAG}") endforeach (LINK_FLAG) -""" - target_link_libraries(tf_adapter PUBLIC - $ - -Wl,--no-as-needed - ${ASCEND_CUSTOM_PATH}/fwkacllib/lib64/libge_runner.so - ${ASCEND_CUSTOM_PATH}/fwkacllib/lib64/libfmk_parser.so - ${ASCEND_CUSTOM_PATH}/fwkacllib/lib64/libdatatransfer.so - ${ASCEND_CUSTOM_PATH}/fwkacllib/lib64/libindextransform.so - ${ASCEND_CUSTOM_PATH}/fwkacllib/lib64/libtsdclient.so - ${ASCEND_CUSTOM_PATH}/driver/lib64/common/libc_sec.so - ${ASCEND_CUSTOM_PATH}/driver/lib64/common/libmmpa.so - -Wl,--as-needed - ) -""" set_target_properties(_tf_adapter PROPERTIES PREFIX "") -- Gitee From 74d15d090bc7e6f59cf9dc997f236430e8caa407 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 16:14:30 +0800 Subject: [PATCH 12/64] update configure.py. --- configure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.py b/configure.py index 74e324d74..423decade 100755 --- a/configure.py +++ b/configure.py @@ -131,7 +131,7 @@ def setup_ascend(env_path): break elif not os.path.exists(ascend_path): print('Invalid ascend path: %s cannot be found.' % ascend_path) -""" + with open(real_config_path('LINK_FLAGS'), 'w') as f: f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libfmk_parser.so\n")) @@ -140,7 +140,7 @@ def setup_ascend(env_path): f.write(os.path.join(ascend_path, "driver", "lib64", "driver", "libtsdclient.so\n")) f.write(os.path.join(ascend_path, "driver", "lib64", "common", "libc_sec.so\n")) f.write(os.path.join(ascend_path, "driver", "lib64", "common", "libmmpa.so\n")) -""" + def setup_swig(): """Get swig install path.""" default_swig_path = which('swig') -- Gitee From 672ae1002f6fef81b623048d2f226547c0531049 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 16:20:25 +0800 Subject: [PATCH 13/64] update tf_adapter/kernels/geop_npu.cc. --- tf_adapter/kernels/geop_npu.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tf_adapter/kernels/geop_npu.cc b/tf_adapter/kernels/geop_npu.cc index 20da57128..2c977b549 100644 --- a/tf_adapter/kernels/geop_npu.cc +++ b/tf_adapter/kernels/geop_npu.cc @@ -254,7 +254,7 @@ void GeOp::Finalize() { LOG(WARNING) << "[GEOP] Save check report failed."; } if (handle_ != nullptr) { - (void)mmDlclose(handle_); + // (void)mmDlclose(handle_); } } } -- Gitee From 6443a423836a892316b00191da0cd63b35f4446d Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 16:27:18 +0800 Subject: [PATCH 14/64] update tf_adapter/kernels/geop_npu.cc. --- tf_adapter/kernels/geop_npu.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tf_adapter/kernels/geop_npu.cc b/tf_adapter/kernels/geop_npu.cc index 2c977b549..20da57128 100644 --- a/tf_adapter/kernels/geop_npu.cc +++ b/tf_adapter/kernels/geop_npu.cc @@ -254,7 +254,7 @@ void GeOp::Finalize() { LOG(WARNING) << "[GEOP] Save check report failed."; } if (handle_ != nullptr) { - // (void)mmDlclose(handle_); + (void)mmDlclose(handle_); } } } -- Gitee From 2aa8743d0256b889fbd92245ce472eb0da7cba63 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 22:05:24 +0800 Subject: [PATCH 15/64] update configure.py. --- configure.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.py b/configure.py index 423decade..cf3e8c61d 100755 --- a/configure.py +++ b/configure.py @@ -111,7 +111,9 @@ def setup_python(): for flag in compile_args[2:-1]: f.write(flag + '\n') f.write("-I" + compile_args[-1] + '\n') + print('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb1') with open(real_config_path('LINK_FLAGS'), 'w') as f: + print('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2') f.write(os.path.join(compile_args[1], 'libtensorflow_framework.so.1\n')) f.write(os.path.join(compile_args[1], 'python', '_pywrap_tensorflow_internal.so\n')) break @@ -131,8 +133,9 @@ def setup_ascend(env_path): break elif not os.path.exists(ascend_path): print('Invalid ascend path: %s cannot be found.' % ascend_path) - + print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1') with open(real_config_path('LINK_FLAGS'), 'w') as f: + print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2') f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libfmk_parser.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libdatatransfer.so\n")) -- Gitee From 267063a5eb9fab731057a1267b9a4534690bffd4 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 22:10:25 +0800 Subject: [PATCH 16/64] update configure.py. --- configure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.py b/configure.py index cf3e8c61d..57b3f7db4 100755 --- a/configure.py +++ b/configure.py @@ -133,9 +133,9 @@ def setup_ascend(env_path): break elif not os.path.exists(ascend_path): print('Invalid ascend path: %s cannot be found.' % ascend_path) - print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1') + print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1: %s' % ascend_path) with open(real_config_path('LINK_FLAGS'), 'w') as f: - print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2') + print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2: %s.' % ascend_path) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libfmk_parser.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libdatatransfer.so\n")) -- Gitee From b61260e5c46f118836e9456cab61aab364948ba0 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 22:36:12 +0800 Subject: [PATCH 17/64] update CMakeLists.txt. --- CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 56c71c2b7..36b414346 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,22 +3,22 @@ if (ENABLE_OPEN_SRC) cmake_minimum_required(VERSION 3.14) project(TFAdapter) - set(CMAKE_CXX_STANDARD 11) - set(CMAKE_C_FLAGS "-O2 -DNDEBUG -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -DNDEBUG -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_STANDARD 17) + set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-std=c++17 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") # build external prjects if(DEFINED ENV{D_PKG_SERVER}) set(TF_PKG_SERVER $ENV{D_PKG_SERVER}) message("Download packages from PKG server") endif() + include(${CMAKE_CURRENT_LIST_DIR}/cmake/nlohmann_json.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/cmake/secure_c.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/cmake/tensorflow.cmake) include_directories(${CMAKE_CURRENT_LIST_DIR}) include_directories(${CMAKE_CURRENT_LIST_DIR}/inc) include_directories(${CMAKE_CURRENT_LIST_DIR}/inc/external) include_directories(${CMAKE_CURRENT_LIST_DIR}/inc/soft_dp) - include(${CMAKE_CURRENT_LIST_DIR}/cmake/nlohmann_json.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/cmake/secure_c.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/cmake/tensorflow.cmake) - + if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/tools/COMPILE_FLAGS OR NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/tools/LINK_FLAGS OR NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/tools/PYTHON_BIN_PATH OR NOT EXISTS -- Gitee From 5f6d2b5c401245c8f734aa06e7aade783fb4f15a Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 22:37:20 +0800 Subject: [PATCH 18/64] update configure.py. --- configure.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/configure.py b/configure.py index 57b3f7db4..a9521a813 100755 --- a/configure.py +++ b/configure.py @@ -111,9 +111,7 @@ def setup_python(): for flag in compile_args[2:-1]: f.write(flag + '\n') f.write("-I" + compile_args[-1] + '\n') - print('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb1') with open(real_config_path('LINK_FLAGS'), 'w') as f: - print('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2') f.write(os.path.join(compile_args[1], 'libtensorflow_framework.so.1\n')) f.write(os.path.join(compile_args[1], 'python', '_pywrap_tensorflow_internal.so\n')) break @@ -133,16 +131,12 @@ def setup_ascend(env_path): break elif not os.path.exists(ascend_path): print('Invalid ascend path: %s cannot be found.' % ascend_path) - print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1: %s' % ascend_path) with open(real_config_path('LINK_FLAGS'), 'w') as f: - print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2: %s.' % ascend_path) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libfmk_parser.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libdatatransfer.so\n")) - f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libindextransform.so\n")) f.write(os.path.join(ascend_path, "driver", "lib64", "driver", "libtsdclient.so\n")) f.write(os.path.join(ascend_path, "driver", "lib64", "common", "libc_sec.so\n")) - f.write(os.path.join(ascend_path, "driver", "lib64", "common", "libmmpa.so\n")) def setup_swig(): """Get swig install path.""" @@ -185,8 +179,8 @@ def setup_swig(): def main(): env_snapshot = dict(os.environ) - setup_ascend(env_snapshot.get(_ASCEND_INSTALL_PATH_ENV)) setup_python() + setup_ascend(env_snapshot.get(_ASCEND_INSTALL_PATH_ENV)) setup_swig() -- Gitee From 169302fb7cbeba46b0616c9ba0539c5a2c02a8d1 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 22:49:04 +0800 Subject: [PATCH 19/64] update CMakeLists.txt. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36b414346..99068752c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,9 +3,9 @@ if (ENABLE_OPEN_SRC) cmake_minimum_required(VERSION 3.14) project(TFAdapter) - set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD 11) set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-std=c++17 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") # build external prjects if(DEFINED ENV{D_PKG_SERVER}) set(TF_PKG_SERVER $ENV{D_PKG_SERVER}) -- Gitee From f17f22266b7af2811f7f4fcf3c38fefea33a80fb Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:02:48 +0800 Subject: [PATCH 20/64] update configure.py. --- configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.py b/configure.py index a9521a813..d55f7fc03 100755 --- a/configure.py +++ b/configure.py @@ -131,7 +131,7 @@ def setup_ascend(env_path): break elif not os.path.exists(ascend_path): print('Invalid ascend path: %s cannot be found.' % ascend_path) - with open(real_config_path('LINK_FLAGS'), 'w') as f: + with open(real_config_path('LINK_FLAGS'), 'a') as f: f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libfmk_parser.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libdatatransfer.so\n")) -- Gitee From bca90b5879541afe48a962e0ead2077f761f18a8 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:06:20 +0800 Subject: [PATCH 21/64] update configure.py. --- configure.py | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.py b/configure.py index d55f7fc03..38f745e5e 100755 --- a/configure.py +++ b/configure.py @@ -135,6 +135,7 @@ def setup_ascend(env_path): f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libfmk_parser.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libdatatransfer.so\n")) + f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libindextransform.so\n")) f.write(os.path.join(ascend_path, "driver", "lib64", "driver", "libtsdclient.so\n")) f.write(os.path.join(ascend_path, "driver", "lib64", "common", "libc_sec.so\n")) -- Gitee From 54080df087ca0916176170e01e416d93f02c8b67 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:14:22 +0800 Subject: [PATCH 22/64] update CMakeLists.txt. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99068752c..36b414346 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,9 +3,9 @@ if (ENABLE_OPEN_SRC) cmake_minimum_required(VERSION 3.14) project(TFAdapter) - set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD 17) set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "-std=c++17 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") # build external prjects if(DEFINED ENV{D_PKG_SERVER}) set(TF_PKG_SERVER $ENV{D_PKG_SERVER}) -- Gitee From a71a61dbe64b6303b75277ec0de3c8a130ca7191 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:18:09 +0800 Subject: [PATCH 23/64] update CMakeLists.txt. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36b414346..99068752c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,9 +3,9 @@ if (ENABLE_OPEN_SRC) cmake_minimum_required(VERSION 3.14) project(TFAdapter) - set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD 11) set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-std=c++17 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") # build external prjects if(DEFINED ENV{D_PKG_SERVER}) set(TF_PKG_SERVER $ENV{D_PKG_SERVER}) -- Gitee From cf6009ef30a959564bdd8eebd81f90bdf7ba8ed5 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:25:56 +0800 Subject: [PATCH 24/64] update configure.py. --- configure.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.py b/configure.py index 38f745e5e..fdb8f25f9 100755 --- a/configure.py +++ b/configure.py @@ -111,6 +111,7 @@ def setup_python(): for flag in compile_args[2:-1]: f.write(flag + '\n') f.write("-I" + compile_args[-1] + '\n') + print('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.' % compile_args[1]) with open(real_config_path('LINK_FLAGS'), 'w') as f: f.write(os.path.join(compile_args[1], 'libtensorflow_framework.so.1\n')) f.write(os.path.join(compile_args[1], 'python', '_pywrap_tensorflow_internal.so\n')) @@ -131,6 +132,7 @@ def setup_ascend(env_path): break elif not os.path.exists(ascend_path): print('Invalid ascend path: %s cannot be found.' % ascend_path) + print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.' % ascend_path) with open(real_config_path('LINK_FLAGS'), 'a') as f: f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libfmk_parser.so\n")) -- Gitee From 8aa0de5a90f4bb4ee4c3f2c5918b574d17610687 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:27:24 +0800 Subject: [PATCH 25/64] update configure.py. --- configure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.py b/configure.py index fdb8f25f9..e5244937e 100755 --- a/configure.py +++ b/configure.py @@ -111,7 +111,7 @@ def setup_python(): for flag in compile_args[2:-1]: f.write(flag + '\n') f.write("-I" + compile_args[-1] + '\n') - print('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.' % compile_args[1]) + print('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: %s.' % compile_args[1]) with open(real_config_path('LINK_FLAGS'), 'w') as f: f.write(os.path.join(compile_args[1], 'libtensorflow_framework.so.1\n')) f.write(os.path.join(compile_args[1], 'python', '_pywrap_tensorflow_internal.so\n')) @@ -132,7 +132,7 @@ def setup_ascend(env_path): break elif not os.path.exists(ascend_path): print('Invalid ascend path: %s cannot be found.' % ascend_path) - print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.' % ascend_path) + print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: %s.' % ascend_path) with open(real_config_path('LINK_FLAGS'), 'a') as f: f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libfmk_parser.so\n")) -- Gitee From 00db8666928075dc307ebc6b6a52f8528d358e54 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:30:13 +0800 Subject: [PATCH 26/64] update configure.py. --- configure.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.py b/configure.py index e5244937e..756493791 100755 --- a/configure.py +++ b/configure.py @@ -112,9 +112,11 @@ def setup_python(): f.write(flag + '\n') f.write("-I" + compile_args[-1] + '\n') print('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: %s.' % compile_args[1]) + """ with open(real_config_path('LINK_FLAGS'), 'w') as f: f.write(os.path.join(compile_args[1], 'libtensorflow_framework.so.1\n')) f.write(os.path.join(compile_args[1], 'python', '_pywrap_tensorflow_internal.so\n')) + """ break @@ -133,6 +135,7 @@ def setup_ascend(env_path): elif not os.path.exists(ascend_path): print('Invalid ascend path: %s cannot be found.' % ascend_path) print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: %s.' % ascend_path) + """ with open(real_config_path('LINK_FLAGS'), 'a') as f: f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libfmk_parser.so\n")) @@ -140,7 +143,7 @@ def setup_ascend(env_path): f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libindextransform.so\n")) f.write(os.path.join(ascend_path, "driver", "lib64", "driver", "libtsdclient.so\n")) f.write(os.path.join(ascend_path, "driver", "lib64", "common", "libc_sec.so\n")) - + """ def setup_swig(): """Get swig install path.""" default_swig_path = which('swig') -- Gitee From d1464df78b48f2b725581b883e82f4d85486b3d9 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:32:12 +0800 Subject: [PATCH 27/64] update CMakeLists.txt. --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99068752c..ddf2678b9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,19 @@ if (ENABLE_OPEN_SRC) foreach (LINK_FLAG ${LINK_FLAGS}) target_link_libraries(_tf_adapter PUBLIC "${LINK_FLAG}") endforeach (LINK_FLAG) + + target_link_libraries(tf_adapter PUBLIC + $ + -Wl,--no-as-needed + /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/libc_sec.so + /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/libge_runner.so + /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/libdatatransfer.so + /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/libfmk_parser.so + /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/libindextransform.so + /usr/local/python/python375/lib/python3.7/site-packages/tensorflow_core/libtensorflow_framework.so.1 + /usr/local/python/python375/lib/python3.7/site-packages/tensorflow_core/_pywrap_tensorflow_internal.so + -Wl,--as-needed + ) set_target_properties(_tf_adapter PROPERTIES PREFIX "") -- Gitee From 9d236f3c3244b5798d5e4a6f5604e6db4cdc9eeb Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:32:42 +0800 Subject: [PATCH 28/64] update CMakeLists.txt. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddf2678b9..073ba144b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,8 @@ if (ENABLE_OPEN_SRC) project(TFAdapter) set(CMAKE_CXX_STANDARD 11) - set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") + set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -ftrapv -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -Wall -fPIC -ftrapv -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") # build external prjects if(DEFINED ENV{D_PKG_SERVER}) set(TF_PKG_SERVER $ENV{D_PKG_SERVER}) -- Gitee From e128bba9e0d9b2667f5e65daaeee02b15a273976 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:35:51 +0800 Subject: [PATCH 29/64] update configure.py. --- configure.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/configure.py b/configure.py index 756493791..ea7ec068f 100755 --- a/configure.py +++ b/configure.py @@ -112,11 +112,9 @@ def setup_python(): f.write(flag + '\n') f.write("-I" + compile_args[-1] + '\n') print('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: %s.' % compile_args[1]) - """ with open(real_config_path('LINK_FLAGS'), 'w') as f: f.write(os.path.join(compile_args[1], 'libtensorflow_framework.so.1\n')) f.write(os.path.join(compile_args[1], 'python', '_pywrap_tensorflow_internal.so\n')) - """ break @@ -135,7 +133,6 @@ def setup_ascend(env_path): elif not os.path.exists(ascend_path): print('Invalid ascend path: %s cannot be found.' % ascend_path) print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: %s.' % ascend_path) - """ with open(real_config_path('LINK_FLAGS'), 'a') as f: f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libfmk_parser.so\n")) @@ -143,7 +140,6 @@ def setup_ascend(env_path): f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libindextransform.so\n")) f.write(os.path.join(ascend_path, "driver", "lib64", "driver", "libtsdclient.so\n")) f.write(os.path.join(ascend_path, "driver", "lib64", "common", "libc_sec.so\n")) - """ def setup_swig(): """Get swig install path.""" default_swig_path = which('swig') -- Gitee From 4ba293b852589a7294c6f00cddb407d154ce10e2 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:38:14 +0800 Subject: [PATCH 30/64] update CMakeLists.txt. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 073ba144b..c224d20dc 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ if (ENABLE_OPEN_SRC) target_link_libraries(_tf_adapter PUBLIC "${LINK_FLAG}") endforeach (LINK_FLAG) - target_link_libraries(tf_adapter PUBLIC + target_link_libraries(_tf_adapter PUBLIC $ -Wl,--no-as-needed /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/libc_sec.so -- Gitee From e1fe48dd6d35ac4945e696179a8e2964dcdc31df Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:42:18 +0800 Subject: [PATCH 31/64] update CMakeLists.txt. --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c224d20dc..c9f1a3a3a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,11 +51,11 @@ if (ENABLE_OPEN_SRC) target_link_libraries(_tf_adapter PUBLIC $ -Wl,--no-as-needed - /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/libc_sec.so - /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/libge_runner.so - /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/libdatatransfer.so - /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/libfmk_parser.so - /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/libindextransform.so + /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/driver/lib64/common/libc_sec.so + /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/fwkacllib/lib64/libge_runner.so + /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/fwkacllib/lib64/libdatatransfer.so + /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/fwkacllib/lib64/libfmk_parser.so + /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/fwkacllib/lib64/libindextransform.so /usr/local/python/python375/lib/python3.7/site-packages/tensorflow_core/libtensorflow_framework.so.1 /usr/local/python/python375/lib/python3.7/site-packages/tensorflow_core/_pywrap_tensorflow_internal.so -Wl,--as-needed -- Gitee From 255cbecfb5725b8d77d0268f43bbe69db1531612 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:44:39 +0800 Subject: [PATCH 32/64] update CMakeLists.txt. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c9f1a3a3a..696e9f86f 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ if (ENABLE_OPEN_SRC) /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/fwkacllib/lib64/libfmk_parser.so /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/fwkacllib/lib64/libindextransform.so /usr/local/python/python375/lib/python3.7/site-packages/tensorflow_core/libtensorflow_framework.so.1 - /usr/local/python/python375/lib/python3.7/site-packages/tensorflow_core/_pywrap_tensorflow_internal.so + /usr/local/python/python375/lib/python3.7/site-packages/tensorflow_core/python/_pywrap_tensorflow_internal.so -Wl,--as-needed ) -- Gitee From 2e98c7bb59eae2694d3452fe570824f73bd3ae20 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:52:05 +0800 Subject: [PATCH 33/64] update configure.py. --- configure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.py b/configure.py index ea7ec068f..b52185fce 100755 --- a/configure.py +++ b/configure.py @@ -181,8 +181,8 @@ def setup_swig(): def main(): env_snapshot = dict(os.environ) - setup_python() - setup_ascend(env_snapshot.get(_ASCEND_INSTALL_PATH_ENV)) + #setup_python() + #setup_ascend(env_snapshot.get(_ASCEND_INSTALL_PATH_ENV)) setup_swig() -- Gitee From 6aa5eeddd7bf8b02e8289d1d8ef44244f0443069 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:54:13 +0800 Subject: [PATCH 34/64] update configure.py. --- configure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.py b/configure.py index b52185fce..ea7ec068f 100755 --- a/configure.py +++ b/configure.py @@ -181,8 +181,8 @@ def setup_swig(): def main(): env_snapshot = dict(os.environ) - #setup_python() - #setup_ascend(env_snapshot.get(_ASCEND_INSTALL_PATH_ENV)) + setup_python() + setup_ascend(env_snapshot.get(_ASCEND_INSTALL_PATH_ENV)) setup_swig() -- Gitee From bd9201436f7de5439f5650fb740d7f0253e7985a Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Tue, 10 Nov 2020 23:55:51 +0800 Subject: [PATCH 35/64] update CMakeLists.txt. --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 696e9f86f..d533fcccb 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,16 @@ if (ENABLE_OPEN_SRC) foreach (LINK_FLAG ${LINK_FLAGS}) target_link_libraries(_tf_adapter PUBLIC "${LINK_FLAG}") endforeach (LINK_FLAG) + + target_compile_options(_tf_adapter PUBLIC + $<$:-std=c++11> + -O2 + -DNDEBUG + -ftrapv + ) + target_compile_definitions(_tf_adapter PUBLIC + _FORTIFY_SOURCE=2 + ) target_link_libraries(_tf_adapter PUBLIC $ -- Gitee From 4ed645b5253dd8de7a274bd6a8cb7fa5e09192c5 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Wed, 11 Nov 2020 00:00:14 +0800 Subject: [PATCH 36/64] update CMakeLists.txt. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d533fcccb..97bef67df 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,6 @@ if (ENABLE_OPEN_SRC) ) target_link_libraries(_tf_adapter PUBLIC - $ -Wl,--no-as-needed /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/driver/lib64/common/libc_sec.so /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/fwkacllib/lib64/libge_runner.so -- Gitee From 1753ba693af0612555bf7fc8ceec3154c63e4220 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Wed, 11 Nov 2020 09:52:39 +0800 Subject: [PATCH 37/64] update CMakeLists.txt. --- CMakeLists.txt | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 97bef67df..99068752c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,8 @@ if (ENABLE_OPEN_SRC) project(TFAdapter) set(CMAKE_CXX_STANDARD 11) - set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -ftrapv -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -Wall -fPIC -ftrapv -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") + set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") # build external prjects if(DEFINED ENV{D_PKG_SERVER}) set(TF_PKG_SERVER $ENV{D_PKG_SERVER}) @@ -48,28 +48,6 @@ if (ENABLE_OPEN_SRC) target_link_libraries(_tf_adapter PUBLIC "${LINK_FLAG}") endforeach (LINK_FLAG) - target_compile_options(_tf_adapter PUBLIC - $<$:-std=c++11> - -O2 - -DNDEBUG - -ftrapv - ) - target_compile_definitions(_tf_adapter PUBLIC - _FORTIFY_SOURCE=2 - ) - - target_link_libraries(_tf_adapter PUBLIC - -Wl,--no-as-needed - /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/driver/lib64/common/libc_sec.so - /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/fwkacllib/lib64/libge_runner.so - /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/fwkacllib/lib64/libdatatransfer.so - /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/fwkacllib/lib64/libfmk_parser.so - /home/jenkins/share-data/libs_yellow/20201109/ascend910/euleros_x86_gcc7.3.0/fwkacllib/lib64/libindextransform.so - /usr/local/python/python375/lib/python3.7/site-packages/tensorflow_core/libtensorflow_framework.so.1 - /usr/local/python/python375/lib/python3.7/site-packages/tensorflow_core/python/_pywrap_tensorflow_internal.so - -Wl,--as-needed - ) - set_target_properties(_tf_adapter PROPERTIES PREFIX "") set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/dist/python/npu_bridge) -- Gitee From 270a758927c92d4d4340db4c9842ea82a4b18e65 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Wed, 11 Nov 2020 15:26:40 +0800 Subject: [PATCH 38/64] update CMakeLists.txt. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99068752c..44b3a8554 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,8 @@ if (ENABLE_OPEN_SRC) project(TFAdapter) set(CMAKE_CXX_STANDARD 11) - set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") + set(CMAKE_C_FLAGS "-O2 -DNDEBUG -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -DNDEBUG -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") # build external prjects if(DEFINED ENV{D_PKG_SERVER}) set(TF_PKG_SERVER $ENV{D_PKG_SERVER}) -- Gitee From 1bdb3f4270a66454b6d529d8d4d85c2ec123141d Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Wed, 11 Nov 2020 17:39:34 +0800 Subject: [PATCH 39/64] update CMakeLists.txt. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44b3a8554..e8be79e88 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,8 @@ if (ENABLE_OPEN_SRC) project(TFAdapter) set(CMAKE_CXX_STANDARD 11) - set(CMAKE_C_FLAGS "-O2 -DNDEBUG -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -DNDEBUG -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") + set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") # build external prjects if(DEFINED ENV{D_PKG_SERVER}) set(TF_PKG_SERVER $ENV{D_PKG_SERVER}) -- Gitee From 57686df7799a8efe0c3c215e63e90a345c2b656d Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 11:39:57 +0800 Subject: [PATCH 40/64] update configure.py. --- configure.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.py b/configure.py index ea7ec068f..d66cb0b50 100755 --- a/configure.py +++ b/configure.py @@ -112,7 +112,7 @@ def setup_python(): f.write(flag + '\n') f.write("-I" + compile_args[-1] + '\n') print('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: %s.' % compile_args[1]) - with open(real_config_path('LINK_FLAGS'), 'w') as f: + with open(real_config_path('LINK_FLAGS'), 'a') as f: f.write(os.path.join(compile_args[1], 'libtensorflow_framework.so.1\n')) f.write(os.path.join(compile_args[1], 'python', '_pywrap_tensorflow_internal.so\n')) break @@ -133,7 +133,7 @@ def setup_ascend(env_path): elif not os.path.exists(ascend_path): print('Invalid ascend path: %s cannot be found.' % ascend_path) print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: %s.' % ascend_path) - with open(real_config_path('LINK_FLAGS'), 'a') as f: + with open(real_config_path('LINK_FLAGS'), 'w') as f: f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libfmk_parser.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libdatatransfer.so\n")) @@ -181,8 +181,8 @@ def setup_swig(): def main(): env_snapshot = dict(os.environ) - setup_python() setup_ascend(env_snapshot.get(_ASCEND_INSTALL_PATH_ENV)) + setup_python() setup_swig() -- Gitee From 9b280b1f13d30bed57e01a0e41cfcea93169febe Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 11:40:58 +0800 Subject: [PATCH 41/64] update CMakeLists.txt. --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e8be79e88..c82a6bf72 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,9 @@ if (ENABLE_OPEN_SRC) project(TFAdapter) set(CMAKE_CXX_STANDARD 11) - set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") + set(CMAKE_C_FLAGS "-O2 -DNDEBUG -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -DNDEBUG -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") + add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) # build external prjects if(DEFINED ENV{D_PKG_SERVER}) set(TF_PKG_SERVER $ENV{D_PKG_SERVER}) -- Gitee From 29b9a1b6d812fa5c9f06014827f77cfea999a37d Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:31:18 +0800 Subject: [PATCH 42/64] update inc/common/util/ai_core/common/aicore_util_attr_define.h. --- .../util/ai_core/common/aicore_util_attr_define.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/inc/common/util/ai_core/common/aicore_util_attr_define.h b/inc/common/util/ai_core/common/aicore_util_attr_define.h index f3556cb50..297be0b23 100644 --- a/inc/common/util/ai_core/common/aicore_util_attr_define.h +++ b/inc/common/util/ai_core/common/aicore_util_attr_define.h @@ -32,6 +32,14 @@ static const std::string L1_OPTIMIZED = "l1_optimized"; static const std::string L2_OPTIMIZED = "l2_optimized"; -static const std::string OP_SLICE_INFO = "_op_slice_info"; +static const std::string ATTR_NAME_UNKNOWN_SHAPE = "_unknown_shape"; + +static const std::string ATTR_NAME_IS_UNKNOWN_GRAPH = "_fe_is_unknown_graph"; + +static const std::string ATTR_NAME_IS_UNKNOWN_SHAPE_OP = "_fe_is_unknown_shape_op"; + +static const std::string ATTR_NAME_TVM_CACHE_READ_MODE = "tvm_cache_read_mode"; + +static const std::string ATTR_NAME_TBE_KERNEL_SIZE = "_tbeKernelSize"; } // namespace fe #endif -- Gitee From c2d40ff5faca5c00e27e0fb68eea20a597a4d347 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:31:58 +0800 Subject: [PATCH 43/64] update inc/common/util/ai_core/common/aicore_util_types.h. --- inc/common/util/ai_core/common/aicore_util_types.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inc/common/util/ai_core/common/aicore_util_types.h b/inc/common/util/ai_core/common/aicore_util_types.h index e57dbca71..f5e9d2298 100644 --- a/inc/common/util/ai_core/common/aicore_util_types.h +++ b/inc/common/util/ai_core/common/aicore_util_types.h @@ -109,6 +109,10 @@ enum OpImplType { EN_RESERVED // reserved value }; +// Dont change the order, only add new mode in the end +enum L2Mode { EN_L2_CLOSE = 0, EN_L2_BUFFER_OPTIMIZE, EN_L2_CACHE_NORMAL, EN_L2_CACHE_RC }; +enum BufferFusionMode { EN_OPTIMIZE_DISABLE = 0, EN_L2_BUFFER, EN_L2_FUSION}; + static const std::map DATATYPE_SIZE_MAP{ {ge::DT_FLOAT, sizeof(float)}, {ge::DT_FLOAT16, sizeof(int16_t)}, -- Gitee From 930d8b222438c21d0242898aecf5d6288dc1c3a7 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:32:22 +0800 Subject: [PATCH 44/64] update inc/hccl/base.h. --- inc/hccl/base.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/hccl/base.h b/inc/hccl/base.h index 94253bf4a..8e27d6b80 100644 --- a/inc/hccl/base.h +++ b/inc/hccl/base.h @@ -49,7 +49,7 @@ typedef enum { HOROVOD_REDUCE_RESERVED /**< reserved */ } HorovodReduceOp; -const u32 HCCL_MAX_SEGMENT_NUM = 8; // The max number of gradient segments. +const u32 HCCL_MAX_SEGMENT_NUM = 32; // The max number of gradient segments. /** * @brief the feature of the model -- Gitee From 558a41a621d75b8cb5d4dd95eaa490554c5df906 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:33:28 +0800 Subject: [PATCH 45/64] update inc/graph/compute_graph.h. --- inc/graph/compute_graph.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inc/graph/compute_graph.h b/inc/graph/compute_graph.h index 90a4c743a..33227bb33 100644 --- a/inc/graph/compute_graph.h +++ b/inc/graph/compute_graph.h @@ -249,11 +249,16 @@ class ComputeGraph : public std::enable_shared_from_this, public A private: graphStatus DFSTopologicalSorting(std::vector &node_vec, std::map &map_in_edge_num, - std::vector &stack); + std::vector &stack, bool reverse); graphStatus BFSTopologicalSorting(std::vector &node_vec, std::map &map_in_edge_num, std::deque &stack); graphStatus CollectBreadthOutNode(const NodePtr &node, std::map &map_in_edge_num, std::map &breadth_node_map); + /// nodes like : (a) <--- (c) ---> (b) + /// node a and b have only one parent node c, and a is connected to c firstly + /// topo order of DFS is `c, b, a` with `dfs_reverse=false` as default + /// in same case, user could get `c, a, b` with `dfs_reverse=true` + graphStatus TopologicalSortingGraph(bool dfs_reverse = false); graphStatus TopologicalSortingGraph(); graphStatus SortNodes(std::vector &stack, std::map &mapInEdgeNum); Vistor AllGraphNodes(std::vector> &subgraphs) const; -- Gitee From f3080c47c7aba88d2fa5cfcd1bd4e4bdd98f4ad5 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:36:26 +0800 Subject: [PATCH 46/64] update inc/external/ge/ge_api_types.h. --- inc/external/ge/ge_api_types.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/inc/external/ge/ge_api_types.h b/inc/external/ge/ge_api_types.h index 1c6b7a3ef..d55ba7764 100644 --- a/inc/external/ge/ge_api_types.h +++ b/inc/external/ge/ge_api_types.h @@ -222,6 +222,18 @@ const char *const OPTION_GE_MAX_DUMP_OP_NUM = "ge.maxDumpOpNum"; // Its value should be "0" or "1", default value is "1" const char *const ENABLE_PRINT_OP_PASS = "ge.enablePrintOpPass"; +// Configure operator compilation path +// Its value should be file path, default value is "./" +const char *const DEBUG_DIR = "ge.debugDir"; + +// Configure operator compiler cache path +// Its value should be file path, default value is "./" +const char *const OP_COMPILER_CACHE_DIR = "ge.op_compiler_cache_dir"; + +// Configure operator compiler cache mode +// Its value should be "disable", "enable" or "force", default value is "disable" +const char *const OP_COMPILER_CACHE_MODE = "ge.op_compiler_cache_mode"; + // Configure whether to use single stream. // Its value should be "true" or "false", default value is "false" const char *const ENABLE_SINGLE_STREAM = "ge.enableSingleStream"; @@ -298,6 +310,9 @@ namespace ir_option { static const char *const INPUT_FP16_NODES = ge::INPUT_FP16_NODES.c_str(); static const char *const LOG_LEVEL = "log"; static const char *const OPTYPELIST_FOR_IMPLMODE = ge::OPTYPELIST_FOR_IMPLMODE.c_str(); + static const char *const DEBUG_DIR = ge::DEBUG_DIR; + static const char *const OP_COMPILER_CACHE_DIR = ge::OP_COMPILER_CACHE_DIR; + static const char *const OP_COMPILER_CACHE_MODE = ge::OP_COMPILER_CACHE_MODE; // for interface: aclgrphBuildModel const std::set ir_builder_suppported_options = { @@ -332,6 +347,10 @@ namespace ir_option { ENABLE_SMALL_CHANNEL, OP_SELECT_IMPL_MODE, OPTYPELIST_FOR_IMPLMODE + OPTYPELIST_FOR_IMPLMODE, + DEBUG_DIR, + OP_COMPILER_CACHE_DIR, + OP_COMPILER_CACHE_MODE }; } } // namespace ge -- Gitee From b294f8cc63483ecfd6e3dc92917d51266f66ac9f Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:39:19 +0800 Subject: [PATCH 47/64] update inc/graph/debug/ge_attr_define.h. --- inc/graph/debug/ge_attr_define.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/inc/graph/debug/ge_attr_define.h b/inc/graph/debug/ge_attr_define.h index 334abd1dd..208263822 100644 --- a/inc/graph/debug/ge_attr_define.h +++ b/inc/graph/debug/ge_attr_define.h @@ -190,6 +190,7 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_MOD GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_AUTOMIC_ADD_START; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_AUTOMIC_ADD_MEM_SIZE; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_STREAM_LABEL; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_RTS_LABEL_NODE; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_STREAM_CYCLE_EVENT_FLAG; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_DYNAMIC_OUTPUT_DIMS; @@ -783,8 +784,6 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAM GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_MODEL_TASK_GEN_VAR_ADDR; -GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_STREAM_LABEL; - GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_CONTINUOUS_STREAM_LABEL; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_MODEL_VAR_SIZE; -- Gitee From e3315a6adf7769b16d834e0be9c13aee2619eaf1 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:40:34 +0800 Subject: [PATCH 48/64] update inc/framework/generator/ge_generator.h. --- inc/framework/generator/ge_generator.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/inc/framework/generator/ge_generator.h b/inc/framework/generator/ge_generator.h index 4902a0213..a7bf4a38a 100644 --- a/inc/framework/generator/ge_generator.h +++ b/inc/framework/generator/ge_generator.h @@ -88,6 +88,8 @@ class GeGenerator { const string &model_file_name, OpEngineType engine_type, ModelBufferData &model_buff, bool is_offline = true); + Status CheckForSingleOp(OpDescPtr &op_desc, const vector &inputs, const vector &outputs); + class Impl; std::shared_ptr impl_; -- Gitee From e9a0739a7004fad30106d6478ee846d9e2bf7b52 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:41:08 +0800 Subject: [PATCH 49/64] update inc/graph/ge_local_context.h. --- inc/graph/ge_local_context.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/inc/graph/ge_local_context.h b/inc/graph/ge_local_context.h index 36beaa798..04060ba48 100644 --- a/inc/graph/ge_local_context.h +++ b/inc/graph/ge_local_context.h @@ -32,6 +32,12 @@ class GEThreadLocalContext { void SetSessionOption(map options_map); void SetGlobalOption(map options_map); + map GetAllGraphOptions() const; + map GetAllSessionOptions() const; + map GetAllGlobalOptions() const; + map GetAllOptions() const; + + private: map graph_options_; map session_options_; -- Gitee From c57134b4a6fec590b285b6fffaf73b274beef55a Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:41:53 +0800 Subject: [PATCH 50/64] update inc/external/graph/gnode.h. --- inc/external/graph/gnode.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/external/graph/gnode.h b/inc/external/graph/gnode.h index 5465293f8..882e6d28e 100644 --- a/inc/external/graph/gnode.h +++ b/inc/external/graph/gnode.h @@ -116,9 +116,9 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GNode { bool HasAttr(const ge::AscendString &name); - graphStatus GetSubgraph(uint32_t index, GraphPtr graph) const; + graphStatus GetSubgraph(uint32_t index, GraphPtr &graph) const; - graphStatus GetALLSubgraphs(std::vector graph_list) const; + graphStatus GetALLSubgraphs(std::vector &graph_list) const; private: std::shared_ptr impl_; -- Gitee From 93e5c43a168b28bff474e077d279a7baaa094845 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:42:42 +0800 Subject: [PATCH 51/64] update inc/graph/utils/graph_utils.h. --- inc/graph/utils/graph_utils.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/inc/graph/utils/graph_utils.h b/inc/graph/utils/graph_utils.h index 0e7adfe05..bdff00b73 100644 --- a/inc/graph/utils/graph_utils.h +++ b/inc/graph/utils/graph_utils.h @@ -145,6 +145,8 @@ class GraphUtils { static ComputeGraphPtr CreateGraphFromOperator(const string &name, const std::vector &inputs); + static GraphPtr CreateGraphPtrFromComputeGraph(const ComputeGraphPtr compute_graph); + static graphStatus AddEdge(const OutDataAnchorPtr &src, const InDataAnchorPtr &dst); static graphStatus AddEdge(const OutDataAnchorPtr &src, const Format &src_format, const InDataAnchorPtr &dst, -- Gitee From b767fb78e82037efe60feea57ef05569f003d577 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:43:37 +0800 Subject: [PATCH 52/64] update inc/external/hccl/hccl_types.h. --- inc/external/hccl/hccl_types.h | 63 ++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 3 deletions(-) diff --git a/inc/external/hccl/hccl_types.h b/inc/external/hccl/hccl_types.h index d67af11e6..de982588a 100644 --- a/inc/external/hccl/hccl_types.h +++ b/inc/external/hccl/hccl_types.h @@ -19,20 +19,77 @@ #include -#ifdef _cplusplus +#ifdef __cplusplus extern "C" { -#endif +#endif // __cplusplus +/** + * @brief HCCL functions return value definition + */ typedef enum { + HCCL_SUCCESS = 0, /**< success */ + HCCL_E_PARA = 1, /**< parameter error */ + HCCL_E_PTR = 2, /**< empty pointer */ + HCCL_E_MEMORY = 3, /**< memory error */ + HCCL_E_INTERNAL = 4, /**< internal error */ + HCCL_E_NOT_SUPPORT = 5, /**< not support feature */ + HCCL_E_NOT_FOUND = 6, /**< not found specific resource */ + HCCL_E_UNAVAIL = 7, /**< resource unavailable */ + HCCL_E_SYSCALL = 8, /**< call system interface error */ + HCCL_E_TIMEOUT = 9, /**< timeout */ + HCCL_E_OPEN_FILE_FAILURE = 10, /**< open file fail */ + HCCL_E_TCP_CONNECT = 11, /**< tcp connect fail */ + HCCL_E_ROCE_CONNECT = 12, /**< roce connect fail */ + HCCL_E_TCP_TRANSFER = 13, /**< tcp transfer fail */ + HCCL_E_ROCE_TRANSFER = 14, /**< roce transfer fail */ + HCCL_E_RUNTIME = 15, /**< call runtime api fail */ + HCCL_E_DRV = 16, /**< call driver api fail */ + HCCL_E_PROFILING = 17, /**< call profiling api fail */ + HCCL_E_CCE = 18, /**< call cce api fail */ + HCCL_E_NETWORK = 19, /**< call network api fail */ + HCCL_E_RESERVED /**< reserved */ } HcclResult; +/** + * @brief handle to HCCL communicator + */ +typedef void *HcclComm; + +/** + * @brief HCCL Reduction opperation + */ typedef enum { + HCCL_REDUCE_SUM = 0, /**< sum */ + HCCL_REDUCE_PROD = 1, /**< prod */ + HCCL_REDUCE_MAX = 2, /**< max */ + HCCL_REDUCE_MIN = 3, /**< min */ + HCCL_REDUCE_RESERVED /**< reserved */ } HcclReduceOp; +/** + * @brief HCCL data type + */ typedef enum { + HCCL_DATA_TYPE_INT8 = 0, /**< int8 */ + HCCL_DATA_TYPE_INT16 = 1, /**< int16 */ + HCCL_DATA_TYPE_INT32 = 2, /**< int32 */ + HCCL_DATA_TYPE_FP16 = 3, /**< fp16 */ + HCCL_DATA_TYPE_FP32 = 4, /**< fp32 */ + HCCL_DATA_TYPE_INT64 = 5, /**< int64 */ + HCCL_DATA_TYPE_UINT64 = 6, /**< uint64 */ + HCCL_DATA_TYPE_RESERVED /**< reserved */ } HcclDataType; -#ifdef _cplusplus +const uint32_t HCCL_ROOT_INFO_BYTES = 4108; // 4108: root info length + +/** + * @brief HCCL root info + */ +typedef struct HcclRootInfoDef { + char internal[HCCL_ROOT_INFO_BYTES]; +} HcclRootInfo; + +#ifdef __cplusplus } #endif #endif -- Gitee From 5c44e355d89b02b9bad4ada42e80a9008911f29c Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:44:18 +0800 Subject: [PATCH 53/64] update inc/common/proto/insert_op.proto. --- inc/common/proto/insert_op.proto | 35 +++++++++++++++++--------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/inc/common/proto/insert_op.proto b/inc/common/proto/insert_op.proto index e28d65326..b4c969eb6 100644 --- a/inc/common/proto/insert_op.proto +++ b/inc/common/proto/insert_op.proto @@ -38,28 +38,31 @@ message AippOpParams { dynamic = 2; } - // AIPP模式,区分静态AIPP和动态AIPP + // AIPP妯″紡锛屽尯鍒嗛潤鎬丄IPP鍜屽姩鎬丄IPP AippMode aipp_mode = 1; - // related_input_rank参数为必填,类型为整型,配置范围>=0, <=输入Data算子的个数,默认值为0。 - // 标识对模型的第几个输入做AIPP处理,例如模型有两个输入,需要对第2个输入做AIPP,则配置related_input_rank为1。 + // related_input_rank鍙傛暟涓哄繀濉紝绫诲瀷涓烘暣鍨嬶紝閰嶇疆鑼冨洿>=0, <=杈撳叆Data绠楀瓙鐨勪釜鏁帮紝榛樿鍊间负0銆 + // 鏍囪瘑瀵规ā鍨嬬殑绗嚑涓緭鍏ュ仛AIPP澶勭悊锛屼緥濡傛ā鍨嬫湁涓や釜杈撳叆锛岄渶瑕佸绗2涓緭鍏ュ仛AIPP锛屽垯閰嶇疆related_input_rank涓1銆 uint32 related_input_rank = 2; - // input_edge_idx参数为可选,类型为整型,配置范围为>=0。 - // 配置该参数的作用,在于对Data算子不同的输出做不同的AIPP处理,如果该参数没有配置,默认对related_input_rank指定的模型输入的所有输出边做AIPP。 - // 配置值 <= Data算子输出边的个数。 + // related_input_name is optional and the top name of data node which inserts aipp + string related_input_name = 6; + + // input_edge_idx鍙傛暟涓哄彲閫夛紝绫诲瀷涓烘暣鍨嬶紝閰嶇疆鑼冨洿涓>=0銆 + // 閰嶇疆璇ュ弬鏁扮殑浣滅敤锛屽湪浜庡Data绠楀瓙涓嶅悓鐨勮緭鍑哄仛涓嶅悓鐨凙IPP澶勭悊锛屽鏋滆鍙傛暟娌℃湁閰嶇疆锛岄粯璁ゅrelated_input_rank鎸囧畾鐨勬ā鍨嬭緭鍏ョ殑鎵鏈夎緭鍑鸿竟鍋欰IPP銆 + // 閰嶇疆鍊 <= Data绠楀瓙杈撳嚭杈圭殑涓暟銆 repeated uint32 input_edge_idx = 3; - // [Begin] 动态AIPP参数,配置静态AIPP时无效 + // [Begin] 鍔ㄦ丄IPP鍙傛暟锛岄厤缃潤鎬丄IPP鏃舵棤鏁 uint32 max_src_image_size = 4; - // 是否支持旋转。默认不支持,开启支持旋转时,会有额外的空间和性能损失 + // 鏄惁鏀寔鏃嬭浆銆傞粯璁や笉鏀寔锛屽紑鍚敮鎸佹棆杞椂锛屼細鏈夐澶栫殑绌洪棿鍜屾ц兘鎹熷け bool support_rotation = 5; - // [End] 动态AIPP参数 + // [End] 鍔ㄦ丄IPP鍙傛暟 - // [Begin] 静态AIPP参数,配置动态AIPP时无效 + // [Begin] 闈欐丄IPP鍙傛暟锛岄厤缃姩鎬丄IPP鏃舵棤鏁 InputFormat input_format = 51; bool csc_switch = 52; float cpadding_value = 53; @@ -115,7 +118,7 @@ message AippOpParams { repeated int32 input_bias_1 = 43; repeated int32 input_bias_2 = 44; - // [End] 静态AIPP参数 + // [End] 闈欐丄IPP鍙傛暟 // The n number that is used for raw/rgbir data into f16 transformation. // The transformation equation is x/(2^n). If set to 0, no transform is performed. @@ -124,13 +127,13 @@ message AippOpParams { message MultiShapeOpParams { enum MultiShapeMode { - batch = 0; //动态batch - resolution = 1; //动态分辨率,扩展用 + batch = 0; //鍔ㄦ乥atch + resolution = 1; //鍔ㄦ佸垎杈ㄧ巼锛屾墿灞曠敤 } - MultiShapeMode mode = 1; //算子模式 - uint32 related_input_rank = 2; //新增算子插入到哪个输入 + MultiShapeMode mode = 1; //绠楀瓙妯″紡 + uint32 related_input_rank = 2; //鏂板绠楀瓙鎻掑叆鍒板摢涓緭鍏 - repeated uint32 batch_list = 11; //batch_list值,batch_list的个数是2到8之间 + repeated uint32 batch_list = 11; //batch_list鍊硷紝batch_list鐨勪釜鏁版槸2鍒8涔嬮棿 } -- Gitee From 73a6f729fe91be6870c179d6e65f44e4d434157d Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:44:56 +0800 Subject: [PATCH 54/64] update inc/graph/node.h. --- inc/graph/node.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/graph/node.h b/inc/graph/node.h index 1b3355415..66a9ebd10 100644 --- a/inc/graph/node.h +++ b/inc/graph/node.h @@ -95,7 +95,7 @@ class Node : public std::enable_shared_from_this { ComputeGraphPtr GetOwnerComputeGraph() const; graphStatus SetOwnerComputeGraph(const ComputeGraphPtr &graph); - + graphStatus SetAnyOwnerComputeGraph(const ComputeGraphPtr &graph); Vistor GetAllInDataAnchors() const; Vistor GetAllOutDataAnchors() const; uint32_t GetAllInDataAnchorsSize() const; -- Gitee From 92682cd069a3d0bd73bd8b4e4c660afc8ba05830 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:45:43 +0800 Subject: [PATCH 55/64] update inc/framework/omg/omg_inner_types.h. --- inc/framework/omg/omg_inner_types.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/inc/framework/omg/omg_inner_types.h b/inc/framework/omg/omg_inner_types.h index c48d16494..6cc4afd35 100644 --- a/inc/framework/omg/omg_inner_types.h +++ b/inc/framework/omg/omg_inner_types.h @@ -100,6 +100,8 @@ struct OmgContext { std::vector net_out_nodes; // net out nodes top names(only caffe has top) std::vector out_top_names; + // net data nodes top names(only caffe has top) + std::vector data_top_names; // preferential format used by the entire network domiTensorFormat_t net_format = DOMI_TENSOR_RESERVED; domi::FrameworkType type = domi::FRAMEWORK_RESERVED; -- Gitee From 76a94327bf8630c8bc52acfed873285f5f51ee03 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:46:50 +0800 Subject: [PATCH 56/64] update inc/graph/op_desc.h. --- inc/graph/op_desc.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inc/graph/op_desc.h b/inc/graph/op_desc.h index 42bf6c67a..8a88ab97c 100644 --- a/inc/graph/op_desc.h +++ b/inc/graph/op_desc.h @@ -282,6 +282,8 @@ class OpDesc : public std::enable_shared_from_this, public AttrHolder { graphStatus GetSubgraphNameByInstanceName(const std::string &instance_name, std::string &subgraph_name) const; + graphStatus InferDataSlice(); + protected: ProtoAttrMapHelper MutableAttrMap() override; ConstProtoAttrMapHelper GetAttrMap() const override; @@ -321,6 +323,7 @@ class OpDesc : public std::enable_shared_from_this, public AttrHolder { std::function infer_func_ = nullptr; std::function infer_format_func_ = nullptr; std::function verifier_func_ = nullptr; + std::function infer_data_slice_func_ = nullptr; string op_kernel_lib_name_; string engine_name_; friend class OpDescUtils; -- Gitee From 1636917f15812e276391dcebfd1ca914a28b6a4b Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:48:40 +0800 Subject: [PATCH 57/64] update inc/framework/omg/parser/parser_inner_ctx.h. --- inc/framework/omg/parser/parser_inner_ctx.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/inc/framework/omg/parser/parser_inner_ctx.h b/inc/framework/omg/parser/parser_inner_ctx.h index b57420eb1..31a519ef6 100644 --- a/inc/framework/omg/parser/parser_inner_ctx.h +++ b/inc/framework/omg/parser/parser_inner_ctx.h @@ -49,6 +49,8 @@ struct ParserContext { std::vector user_out_nodes_top_vec; // net out nodes (where user_out_nodes or leaf nodes) std::vector net_out_nodes; + // net data nodes top names(only caffe has top) + std::vector data_top_names; // net out nodes top names(only caffe has top) std::vector out_top_names; // Whether to use dynamic batch size or dynamic image size -- Gitee From 4d0e6b6e2b225d928bc95aaa46baabd9d3b40ff6 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:51:12 +0800 Subject: [PATCH 58/64] update inc/framework/ge_runtime/task_info.h. --- inc/framework/ge_runtime/task_info.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/inc/framework/ge_runtime/task_info.h b/inc/framework/ge_runtime/task_info.h index e36c43334..68d718700 100644 --- a/inc/framework/ge_runtime/task_info.h +++ b/inc/framework/ge_runtime/task_info.h @@ -161,13 +161,12 @@ class TbeTaskInfo : public TaskInfo { class AicpuTaskInfo : public TaskInfo { public: AicpuTaskInfo(const std::string &op_name, uint32_t stream_id, const string &so_name, const std::string &kernel_name, - const std::string &node_def, const std::string &ext_info, const std::vector &input_data_addrs, + const std::string &node_def, const std::vector &input_data_addrs, const std::vector &output_data_addrs, bool dump_flag) : TaskInfo(op_name, stream_id, TaskInfoType::AICPU, dump_flag), so_name_(so_name), kernel_name_(kernel_name), node_def_(node_def), - ext_info_(ext_info), input_data_addrs_(input_data_addrs), output_data_addrs_(output_data_addrs) {} ~AicpuTaskInfo() override {} @@ -177,13 +176,11 @@ class AicpuTaskInfo : public TaskInfo { const std::string &node_def() const { return node_def_; } const std::vector &input_data_addrs() const { return input_data_addrs_; } const std::vector &output_data_addrs() const { return output_data_addrs_; } - const std::string &ext_info() const { return ext_info_; } private: std::string so_name_; std::string kernel_name_; std::string node_def_; - std::string ext_info_; std::vector input_data_addrs_; std::vector output_data_addrs_; }; -- Gitee From 605605f32afbf7dd14efd1a4dedec1c400bf50bc Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:51:45 +0800 Subject: [PATCH 59/64] update inc/framework/ge_runtime/task_info.h. --- inc/framework/ge_runtime/task_info.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/framework/ge_runtime/task_info.h b/inc/framework/ge_runtime/task_info.h index 68d718700..2b34c93fa 100644 --- a/inc/framework/ge_runtime/task_info.h +++ b/inc/framework/ge_runtime/task_info.h @@ -305,7 +305,7 @@ class HcclTaskInfo : public TaskInfo { int64_t root_id() const { return root_id_; } int64_t op_type() const { return op_type_; } int64_t data_type() const { return data_type_; } - const std::string &group() const { return group_; } + const std::string group() const { return group_; } std::function hcom_bind_model() const { return hcom_bind_model_; } std::function hcom_unbind_model() const { return hcom_unbind_model_; } std::function, void *)> hcom_distribute_task() const { -- Gitee From 3779bceb635677d6e1c2fbf06b6c373fcdf1f118 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:53:17 +0800 Subject: [PATCH 60/64] update configure.py. --- configure.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.py b/configure.py index d66cb0b50..bd240d32a 100755 --- a/configure.py +++ b/configure.py @@ -134,12 +134,12 @@ def setup_ascend(env_path): print('Invalid ascend path: %s cannot be found.' % ascend_path) print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: %s.' % ascend_path) with open(real_config_path('LINK_FLAGS'), 'w') as f: + f.write(os.path.join(ascend_path, "driver", "lib64", "driver", "libtsdclient.so\n")) + f.write(os.path.join(ascend_path, "driver", "lib64", "common", "libc_sec.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libfmk_parser.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libdatatransfer.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libindextransform.so\n")) - f.write(os.path.join(ascend_path, "driver", "lib64", "driver", "libtsdclient.so\n")) - f.write(os.path.join(ascend_path, "driver", "lib64", "common", "libc_sec.so\n")) def setup_swig(): """Get swig install path.""" default_swig_path = which('swig') @@ -181,8 +181,8 @@ def setup_swig(): def main(): env_snapshot = dict(os.environ) - setup_ascend(env_snapshot.get(_ASCEND_INSTALL_PATH_ENV)) setup_python() + setup_ascend(env_snapshot.get(_ASCEND_INSTALL_PATH_ENV)) setup_swig() -- Gitee From fad59adbcbcb426fe78ea934b6e52640b7b3e94b Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 14:55:43 +0800 Subject: [PATCH 61/64] update inc/external/ge/ge_api_types.h. --- inc/external/ge/ge_api_types.h | 1 - 1 file changed, 1 deletion(-) diff --git a/inc/external/ge/ge_api_types.h b/inc/external/ge/ge_api_types.h index d55ba7764..d4fccffda 100644 --- a/inc/external/ge/ge_api_types.h +++ b/inc/external/ge/ge_api_types.h @@ -346,7 +346,6 @@ namespace ir_option { FUSION_SWITCH_FILE, ENABLE_SMALL_CHANNEL, OP_SELECT_IMPL_MODE, - OPTYPELIST_FOR_IMPLMODE OPTYPELIST_FOR_IMPLMODE, DEBUG_DIR, OP_COMPILER_CACHE_DIR, -- Gitee From 8f0554172f1721c2795d9f4140b301bc5764b01d Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 15:10:40 +0800 Subject: [PATCH 62/64] update CMakeLists.txt. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c82a6bf72..917481af8 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,8 @@ if (ENABLE_OPEN_SRC) project(TFAdapter) set(CMAKE_CXX_STANDARD 11) - set(CMAKE_C_FLAGS "-O2 -DNDEBUG -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -DNDEBUG -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") + set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) # build external prjects if(DEFINED ENV{D_PKG_SERVER}) -- Gitee From 654d5397c598996d4ea3ea0c184ccd5a4041a669 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 15:13:47 +0800 Subject: [PATCH 63/64] update CMakeLists.txt. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 917481af8..c82a6bf72 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,8 @@ if (ENABLE_OPEN_SRC) project(TFAdapter) set(CMAKE_CXX_STANDARD 11) - set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") + set(CMAKE_C_FLAGS "-O2 -DNDEBUG -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -DNDEBUG -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) # build external prjects if(DEFINED ENV{D_PKG_SERVER}) -- Gitee From 70487c21a6306a62b50d7b202a36ee0a33780418 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Thu, 12 Nov 2020 15:14:27 +0800 Subject: [PATCH 64/64] update configure.py. --- configure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.py b/configure.py index bd240d32a..43f64415f 100755 --- a/configure.py +++ b/configure.py @@ -112,7 +112,7 @@ def setup_python(): f.write(flag + '\n') f.write("-I" + compile_args[-1] + '\n') print('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: %s.' % compile_args[1]) - with open(real_config_path('LINK_FLAGS'), 'a') as f: + with open(real_config_path('LINK_FLAGS'), 'w') as f: f.write(os.path.join(compile_args[1], 'libtensorflow_framework.so.1\n')) f.write(os.path.join(compile_args[1], 'python', '_pywrap_tensorflow_internal.so\n')) break @@ -133,7 +133,7 @@ def setup_ascend(env_path): elif not os.path.exists(ascend_path): print('Invalid ascend path: %s cannot be found.' % ascend_path) print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: %s.' % ascend_path) - with open(real_config_path('LINK_FLAGS'), 'w') as f: + with open(real_config_path('LINK_FLAGS'), 'a') as f: f.write(os.path.join(ascend_path, "driver", "lib64", "driver", "libtsdclient.so\n")) f.write(os.path.join(ascend_path, "driver", "lib64", "common", "libc_sec.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) -- Gitee