Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stepan Nassyr
JUAWEI EasyConfigs
Commits
f1d7116f
Commit
f1d7116f
authored
Apr 02, 2022
by
Stepan Nassyr
Browse files
Latest attempts at getting CANN-tfplugin running
parent
505b2597
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Golden_Repo/2021a/c/CANN-tfplugin/CANN-tfplugin-1.3.0-goolf-2021a.9-Python-3.7.5.eb
0 → 100644
View file @
f1d7116f
# Stepan Nassyr (JSC)
#easyblock = 'Binary'
easyblock = 'CMakeNinja'
name = 'CANN-tfplugin'
version = '1.3.0'
homepage = 'https://e.huawei.com/en/products/cloud-computing-dc/atlas/cann'
description = 'CANN plugin for TensorFlow'
versionsuffix = '-Python-%(pyver)s'
toolchain = {'name': 'goolf', 'version': '2021a.9'}
sources = [{
'filename': '%(name)s-%(version)s.tar.gz',
'git_config': {
'url': 'https://gitee.com/ascend/',
'repo_name': 'tensorflow',
'commit': 'dd7616a',
'recursive': True,
'keep_git_dir': True,
},
}]
patches = [
'tfplugin-1.5.1-secure_c-checksum.patch',
'tfplugin-1.3.0-use-swig-properly.patch',
'tfplugin-1.7.0-install-in-cmake.patch',
'tfplugin-1.3.0-flag-fix-plus-keep-cxx11abi.patch',
# 'tfplugin-1.7.0-ge-cxx11abi-shim.patch',
'tfplugin-1.3.0-fix-missing-symbols.patch',
]
builddependencies = [
('CMake', '3.20.0'),
('Ninja', '1.10.2'),
('SWIG', '4.0.2')
]
cann_version = "5.0.2.alpha005"
dependencies = [
('Python', '3.7.5'),
('CANN-Toolkit', cann_version, versionsuffix),
('SciPy-Stack', '2021a', versionsuffix),
('TensorFlow-CANN-Core', '1.15.0', versionsuffix),
]
preconfigopts="olddir=$(pwd) && cd %%(builddir)s/tensorflow && ASCEND_CUSTOM_PATH=$EBROOTCANNMINTOOLKIT/ascend-toolkit/%s/ ./configure && cd $olddir &&" % cann_version
configopts="-DENABLE_OPEN_SRC=True"
sanity_check_paths = {
'files': ['lib/python/site-packages/npu_bridge/tf_adapter.py'],
'dirs' : ['lib/python/site-packages/npu_bridge']
}
modextrapaths = {
'PYTHONPATH' : ['lib/python/site-packages'],
}
moduleclass = 'lib'
Golden_Repo/2021a/c/CANN-tfplugin/CANN-tfplugin-1.5.1-goolf-2021a.9-Python-3.7.5.eb
0 → 100644
View file @
f1d7116f
# Stepan Nassyr (JSC)
#easyblock = 'Binary'
easyblock = 'CMakeNinja'
name = 'CANN-tfplugin'
version = '1.5.1'
homepage = 'https://e.huawei.com/en/products/cloud-computing-dc/atlas/cann'
description = 'CANN plugin for TensorFlow'
versionsuffix = '-Python-%(pyver)s'
toolchain = {'name': 'goolf', 'version': '2021a.9'}
sources = [{
'filename': '%(name)s-%(version)s.tar.gz',
'git_config': {
'url': 'https://gitee.com/ascend/',
'repo_name': 'tensorflow',
'commit': 'b79ac8a',
'recursive': True,
'keep_git_dir': True,
},
}]
patches = [
'tfplugin-1.5.1-secure_c-checksum.patch',
'tfplugin-1.7.0-use-swig-properly.patch',
'tfplugin-1.7.0-install-in-cmake.patch',
'tfplugin-1.7.0-flag-fix-plus-keep-cxx11abi.patch',
# 'tfplugin-1.7.0-ge-cxx11abi-shim.patch',
'tfplugin-1.6.0-fix-missing-symbols.patch',
]
builddependencies = [
('CMake', '3.20.0'),
('Ninja', '1.10.2'),
('SWIG', '4.0.2')
]
cann_version = "5.0.2.alpha005"
dependencies = [
('Python', '3.7.5'),
('CANN-Toolkit', cann_version, versionsuffix),
('SciPy-Stack', '2021a', versionsuffix),
('TensorFlow-CANN-Core', '1.15.0', versionsuffix),
]
preconfigopts="olddir=$(pwd) && cd %%(builddir)s/tensorflow && ASCEND_CUSTOM_PATH=$EBROOTCANNMINTOOLKIT/ascend-toolkit/%s/ ./configure && cd $olddir &&" % cann_version
configopts="-DENABLE_OPEN_SRC=True"
sanity_check_paths = {
'files': ['lib/python/site-packages/npu_bridge/tf_adapter.py'],
'dirs' : ['lib/python/site-packages/npu_bridge']
}
modextrapaths = {
'PYTHONPATH' : ['lib/python/site-packages'],
}
moduleclass = 'lib'
Golden_Repo/2021a/c/CANN-tfplugin/CANN-tfplugin-1.6.0-goolf-2021a.9-Python-3.7.5.eb
0 → 100644
View file @
f1d7116f
# Stepan Nassyr (JSC)
#easyblock = 'Binary'
easyblock = 'CMakeNinja'
name = 'CANN-tfplugin'
version = '1.6.0'
homepage = 'https://e.huawei.com/en/products/cloud-computing-dc/atlas/cann'
description = 'CANN plugin for TensorFlow'
versionsuffix = '-Python-%(pyver)s'
toolchain = {'name': 'goolf', 'version': '2021a.9'}
sources = [{
'filename': '%(name)s-%(version)s.tar.gz',
'git_config': {
'url': 'https://gitee.com/ascend/',
'repo_name': 'tensorflow',
'commit': '9cf0552',
'recursive': True,
'keep_git_dir': True,
},
}]
patches = [
'tfplugin-1.7.0-secure_c-checksum.patch',
'tfplugin-1.7.0-use-swig-properly.patch',
'tfplugin-1.7.0-install-in-cmake.patch',
'tfplugin-1.7.0-flag-fix-plus-keep-cxx11abi.patch',
# 'tfplugin-1.7.0-ge-cxx11abi-shim.patch',
'tfplugin-1.6.0-fix-missing-symbols.patch',
]
builddependencies = [
('CMake', '3.20.0'),
('Ninja', '1.10.2'),
('SWIG', '4.0.2')
]
cann_version = "5.0.2.alpha005"
dependencies = [
('Python', '3.7.5'),
('CANN-Toolkit', cann_version, versionsuffix),
('SciPy-Stack', '2021a', versionsuffix),
('TensorFlow-CANN-Core', '1.15.0', versionsuffix),
]
preconfigopts="olddir=$(pwd) && cd %%(builddir)s/tensorflow && ASCEND_CUSTOM_PATH=$EBROOTCANNMINTOOLKIT/ascend-toolkit/%s/ ./configure && cd $olddir &&" % cann_version
configopts="-DENABLE_OPEN_SRC=True"
sanity_check_paths = {
'files': ['lib/python/site-packages/npu_bridge/tf_adapter.py'],
'dirs' : ['lib/python/site-packages/npu_bridge']
}
modextrapaths = {
'PYTHONPATH' : ['lib/python/site-packages'],
}
moduleclass = 'lib'
Golden_Repo/2021a/c/CANN-tfplugin/CANN-tfplugin-1.7.0-goolf-2021a.9-Python-3.7.5.eb
View file @
f1d7116f
...
...
@@ -27,7 +27,8 @@ patches = [
'tfplugin-1.7.0-use-swig-properly.patch',
'tfplugin-1.7.0-install-in-cmake.patch',
'tfplugin-1.7.0-flag-fix-plus-keep-cxx11abi.patch',
'tfplugin-1.7.0-ge-cxx11abi-shim.patch',
# 'tfplugin-1.7.0-ge-cxx11abi-shim.patch',
'tfplugin-1.7.0-fix-missing-symbols.patch',
]
builddependencies = [
...
...
@@ -42,7 +43,7 @@ dependencies = [
('Python', '3.7.5'),
('CANN-Toolkit', cann_version, versionsuffix),
('SciPy-Stack', '2021a', versionsuffix),
('TensorFlow-CANN', '1.15.0', versionsuffix),
('TensorFlow-CANN
-Core
', '1.15.0', versionsuffix),
]
preconfigopts="olddir=$(pwd) && cd %%(builddir)s/tensorflow && ASCEND_CUSTOM_PATH=$EBROOTCANNMINTOOLKIT/ascend-toolkit/%s/ ./configure && cd $olddir &&" % cann_version
...
...
Golden_Repo/2021a/c/CANN-tfplugin/CANN-tfplugin-5.0.2.alpha005-goolf-2021a.9-Python-3.7.5.eb
View file @
f1d7116f
...
...
@@ -38,6 +38,7 @@ dependencies = [
('CMake', '3.20.0'),
('Python', '3.7.5'),
('CANN-Toolkit', version, versionsuffix),
('TensorFlow-CANN-Core', '1.15.0', versionsuffix),
('SciPy-Stack', '2021a', versionsuffix),
]
...
...
Golden_Repo/2021a/c/CANN-tfplugin/tfplugin-1.3.0-fix-missing-symbols.patch
0 → 100644
View file @
f1d7116f
diff --git a/tf_adapter/kernels/geop_npu.cc b/tf_adapter/kernels/geop_npu.cc
index 8bb5a27..76c1065 100644
--- a/tf_adapter/kernels/geop_npu.cc
+++ b/tf_adapter/kernels/geop_npu.cc
@@ -70,7 +70,8 @@
#include "graph/model.h"
namespace tensorflow {
-Status FunctionalizeControlFlow(Graph *graph, FunctionLibraryDefinition *library);
+// No Idea where this function is supposed to be defined
+//Status FunctionalizeControlFlow(Graph *graph, FunctionLibraryDefinition *library);
namespace {
using geDataUniquePtr = std::unique_ptr<uint8_t[], std::function<void(uint8_t *)>>;
@@ -872,11 +873,11 @@
Status GeOp::BuildGraphDef(FunctionLibraryDefinition &flib_def, const std::vecto
if (enable_force_v2_control == "1") {
WriteTextProto(Env::Default(), GetDumpPath() + function_.name() + "_v1.pbtxt", graph_def);
- Status status = FunctionalizeControlFlow(&graph, &flib_def);
- if (status != Status::OK()) {
- LOG(WARNING) << "[GEOP] Failed functionalize control flow: " << status.error_message();
+ //Status status = FunctionalizeControlFlow(&graph, &flib_def);
+ //if (status != Status::OK()) {
+ LOG(WARNING) << "[GEOP] Failed functionalize control flow: FunctionalizeControlFlow() is undefined, so the call was removed";
return Status::OK();
- }
+ //}
graph.ToGraphDef(&graph_def);
WriteTextProto(Env::Default(), GetDumpPath() + function_.name() + "_v2.pbtxt", graph_def);
}
Golden_Repo/2021a/c/CANN-tfplugin/tfplugin-1.3.0-flag-fix-plus-keep-cxx11abi.patch
0 → 100644
View file @
f1d7116f
diff --color -urN tensorflow-unpatched/CMakeLists.txt tensorflow/CMakeLists.txt
--- tensorflow-unpatched/CMakeLists.txt 2022-02-08 16:28:23.458249630 +0000
+++ tensorflow/CMakeLists.txt 2022-02-08 16:29:32.188097198 +0000
@@ -7,9 +7,8 @@
include(UseSWIG)
set(CMAKE_CXX_STANDARD 11)
- set(CMAKE_C_FLAGS "-O2 -DNDEBUG -Wno-deprecated-declarations -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -s -pipe ${CMAKE_C_FLAGS}")
- set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -DNDEBUG -Wno-deprecated-declarations -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -s -pipe ${CMAKE_CXX_FLAGS}")
- add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
+ set(CMAKE_C_FLAGS "-DNDEBUG -Wno-deprecated-declarations -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -s -pipe ${CMAKE_C_FLAGS}")
+ set(CMAKE_CXX_FLAGS "-DNDEBUG -Wno-deprecated-declarations -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -s -pipe ${CMAKE_CXX_FLAGS}")
# build external prjects
if(DEFINED ENV{D_PKG_SERVER})
set(TF_PKG_SERVER $ENV{D_PKG_SERVER})
Golden_Repo/2021a/c/CANN-tfplugin/tfplugin-1.3.0-use-swig-properly.patch
0 → 100644
View file @
f1d7116f
diff --color -urN tensorflow-unpatched/CMakeLists.txt tensorflow/CMakeLists.txt
--- tensorflow-unpatched/CMakeLists.txt 2022-02-08 16:24:10.318788564 +0000
+++ tensorflow/CMakeLists.txt 2022-02-08 16:26:26.658496063 +0000
@@ -1,8 +1,11 @@
option(ENABLE_OPEN_SRC "Enable graphengine compile in opensource." FALSE)
if (ENABLE_OPEN_SRC)
- cmake_minimum_required(VERSION 3.14)
+ cmake_minimum_required(VERSION 3.18)
project(TFAdapter)
+ find_package(SWIG 4.0 COMPONENTS python)
+ include(UseSWIG)
+
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_FLAGS "-O2 -DNDEBUG -Wno-deprecated-declarations -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -s -pipe ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -DNDEBUG -Wno-deprecated-declarations -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -s -pipe ${CMAKE_CXX_FLAGS}")
@@ -45,7 +48,9 @@
#file(COPY ${CMAKE_BINARY_DIR}/dist/swig/tf_adapter.py DESTINATION ${CMAKE_BINARY_DIR}/dist/python/npu_bridge)
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_LIST_DIR}/tf_adapter/*.cc)
- add_library(_tf_adapter SHARED ${SOURCES} ${CMAKE_BINARY_DIR}/dist/swig/ge_plugin_wrap.cxx)
+ set_property(SOURCE ${CMAKE_BINARY_DIR}/dist/swig/ge_plugin.i PROPERTY CPLUSPLUS ON)
+ swig_add_library(_tf_adapter TYPE SHARED LANGUAGE python SOURCES ${SOURCES} ${CMAKE_BINARY_DIR}/dist/swig/ge_plugin.i OUTPUT_DIR ${CMAKE_BINARY_DIR}/dist/python/npu_bridge)
+ set_property(TARGET _tf_adapter PROPERTY SWIG_COMPILE_OPTIONS -threads)
foreach (COMPILE_FLAG ${COMPILE_FLAGS})
target_compile_options(_tf_adapter PUBLIC "${COMPILE_FLAG}")
Golden_Repo/2021a/c/CANN-tfplugin/tfplugin-1.5.1-fix-missing-symbols.patch
0 → 100644
View file @
f1d7116f
This diff is collapsed.
Click to expand it.
Golden_Repo/2021a/c/CANN-tfplugin/tfplugin-1.5.1-secure_c-checksum.patch
0 → 100644
View file @
f1d7116f
diff --color -urN tensorflow-unpatched/cmake/secure_c.cmake tensorflow/cmake/secure_c.cmake
--- tensorflow-unpatched/cmake/secure_c.cmake 2022-02-04 09:27:50.579972570 +0000
+++ tensorflow/cmake/secure_c.cmake 2022-02-04 09:28:34.230256920 +0000
@@ -5,13 +5,13 @@
FetchContent_Declare(
secure_c
URL ${_json_url}
- URL_HASH MD5=193f0ca5246c1dd84920db34d2d8249f
+ URL_HASH MD5=f3db321939ae17527b8939651f7e1c8b
)
else()
FetchContent_Declare(
secure_c
URL https://gitee.com/openeuler/libboundscheck/repository/archive/v1.1.10.tar.gz
- URL_HASH MD5=193f0ca5246c1dd84920db34d2d8249f
+ URL_HASH MD5=f3db321939ae17527b8939651f7e1c8b
)
endif()
FetchContent_GetProperties(secure_c)
Golden_Repo/2021a/c/CANN-tfplugin/tfplugin-1.6.0-fix-missing-symbols.patch
0 → 100644
View file @
f1d7116f
diff --git a/tf_adapter/kernels/geop_npu.cc b/tf_adapter/kernels/geop_npu.cc
index 8bb5a27..76c1065 100644
--- a/tf_adapter/kernels/geop_npu.cc
+++ b/tf_adapter/kernels/geop_npu.cc
@@ -70,7 +70,8 @@
#include "graph/model.h"
namespace tensorflow {
-Status FunctionalizeControlFlow(Graph *graph, FunctionLibraryDefinition *library);
+// No Idea where this function is supposed to be defined
+//Status FunctionalizeControlFlow(Graph *graph, FunctionLibraryDefinition *library);
namespace {
using geDataUniquePtr = std::unique_ptr<uint8_t[], std::function<void(uint8_t *)>>;
@@ -872,11 +873,11 @@
Status GeOp::BuildGraphDef(FunctionLibraryDefinition &flib_def, const std::vecto
if (enable_force_v2_control == "1") {
WriteTextProto(Env::Default(), GetDumpPath() + function_.name() + "_v1.pbtxt", graph_def);
- Status status = FunctionalizeControlFlow(&graph, &flib_def);
- if (status != Status::OK()) {
- LOG(WARNING) << "[GEOP] Failed functionalize control flow: " << status.error_message();
+ //Status status = FunctionalizeControlFlow(&graph, &flib_def);
+ //if (status != Status::OK()) {
+ LOG(WARNING) << "[GEOP] Failed functionalize control flow: FunctionalizeControlFlow() is undefined, so the call was removed";
return Status::OK();
- }
+ //}
graph.ToGraphDef(&graph_def);
WriteTextProto(Env::Default(), GetDumpPath() + function_.name() + "_v2.pbtxt", graph_def);
}
diff --git a/tf_adapter/optimizers/om_partition_subgraphs_pass.cc b/tf_adapter/optimizers/om_partition_subgraphs_pass.cc
index 396afbf..57e47c3 100644
--- a/tf_adapter/optimizers/om_partition_subgraphs_pass.cc
+++ b/tf_adapter/optimizers/om_partition_subgraphs_pass.cc
@@ -998,7 +998,7 @@
Status MarkForPartition(std::unique_ptr<Graph> *graph_in, int &clusterNum, bool
if (src->IsNextIteration()) {
continue;
}
- if (!cycles.InsertEdge(cluster_map[src]->index, cluster_map[dst]->index)) {
+ if (!cycles.InsertEdge(cluster_map[src]->index, cluster_map[dst]->index, false)) {
ADP_LOG(ERROR) << "Failing due to cycle";
LOG(ERROR) << "Failing due to cycle";
return errors::Unimplemented("Input graph has a cycle (inserting an edge from ", src->DebugString(), " to ",
Golden_Repo/2021a/c/CANN-tfplugin/tfplugin-1.7.0-fix-missing-symbols.patch
0 → 100644
View file @
f1d7116f
This diff is collapsed.
Click to expand it.
Golden_Repo/2021a/c/CANN-tfplugin/tfplugin-1.7.0-ge-cxx11abi-shim.patch
View file @
f1d7116f
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment