forked from mindspore-ai/graphengine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lujiale
committed
Mar 27, 2020
0 parents
commit 5f76367
Showing
988 changed files
with
315,376 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
--- | ||
Language: Cpp | ||
# BasedOnStyle: Google | ||
AccessModifierOffset: -1 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlines: Left | ||
AlignOperands: true | ||
AlignTrailingComments: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: All | ||
AllowShortIfStatementsOnASingleLine: true | ||
AllowShortLoopsOnASingleLine: true | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: true | ||
AlwaysBreakTemplateDeclarations: Yes | ||
BinPackArguments: true | ||
BinPackParameters: true | ||
BraceWrapping: | ||
AfterClass: false | ||
AfterControlStatement: false | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterObjCDeclaration: false | ||
AfterStruct: false | ||
AfterUnion: false | ||
AfterExternBlock: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
SplitEmptyFunction: true | ||
SplitEmptyRecord: true | ||
SplitEmptyNamespace: true | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeBraces: Attach | ||
BreakBeforeInheritanceComma: false | ||
BreakInheritanceList: BeforeColon | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializersBeforeComma: false | ||
BreakConstructorInitializers: BeforeColon | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakStringLiterals: true | ||
ColumnLimit: 120 | ||
CommentPragmas: '^ IWYU pragma:' | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 2 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: true | ||
DisableFormat: false | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: true | ||
ForEachMacros: | ||
# - foreach | ||
- Q_FOREACH | ||
- BOOST_FOREACH | ||
IncludeBlocks: Preserve | ||
IncludeCategories: | ||
- Regex: '^<ext/.*\.h>' | ||
Priority: 2 | ||
- Regex: '^<.*\.h>' | ||
Priority: 1 | ||
- Regex: '^<.*' | ||
Priority: 2 | ||
- Regex: '.*' | ||
Priority: 3 | ||
IncludeIsMainRegex: '([-_](test|unittest))?$' | ||
IndentCaseLabels: true | ||
IndentPPDirectives: None | ||
IndentWidth: 2 | ||
IndentWrappedFunctionNames: false | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBinPackProtocolList: Never | ||
ObjCBlockIndentWidth: 2 | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: true | ||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 1 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyBreakTemplateDeclaration: 10 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 200 | ||
PointerAlignment: Left | ||
RawStringFormats: | ||
- Language: Cpp | ||
Delimiters: | ||
- cc | ||
- CC | ||
- cpp | ||
- Cpp | ||
- CPP | ||
- 'c++' | ||
- 'C++' | ||
CanonicalDelimiter: '' | ||
BasedOnStyle: google | ||
- Language: TextProto | ||
Delimiters: | ||
- pb | ||
- PB | ||
- proto | ||
- PROTO | ||
EnclosingFunctions: | ||
- EqualsProto | ||
- EquivToProto | ||
- PARSE_PARTIAL_TEXT_PROTO | ||
- PARSE_TEST_PROTO | ||
- PARSE_TEXT_PROTO | ||
- ParseTextOrDie | ||
- ParseTextProtoOrDie | ||
CanonicalDelimiter: '' | ||
BasedOnStyle: google | ||
ReflowComments: true | ||
SortIncludes: true | ||
SortUsingDeclarations: true | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterTemplateKeyword: true | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 2 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: true | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Auto | ||
StatementMacros: | ||
- Q_UNUSED | ||
- QT_REQUIRE_VERSION | ||
TabWidth: 2 | ||
UseTab: Never | ||
SortIncludes: false | ||
... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# GraphEngine | ||
/build | ||
/output | ||
/prebuilts | ||
*.ir | ||
*.out | ||
|
||
# Dynamic libraries | ||
# *.so | ||
*.dylib | ||
|
||
# Static libraries | ||
*.la | ||
*.lai | ||
*.a | ||
*.lib | ||
|
||
# Protocol buffers | ||
*_pb2.py | ||
*.pb.h | ||
*.pb.cc | ||
|
||
# Object files | ||
*.o | ||
|
||
# Editor | ||
.vscode | ||
.idea/ | ||
cmake-build-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# Copyright 2019-2020 Huawei Technologies Co., Ltd | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ============================================================================ | ||
|
||
cmake_minimum_required(VERSION 3.14) | ||
project (GraphEngine[CXX]) | ||
set(CMAKE_CXX_STANDARD 14) | ||
|
||
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}) | ||
set(GE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}) | ||
set(GE_PROTO_DIR ${GE_SOURCE_DIR}/src) | ||
|
||
if (NOT BUILD_PATH) | ||
set(BUILD_PATH "${CMAKE_SOURCE_DIR}/build") | ||
endif() | ||
# architecture: aarch64 or x86_64 | ||
message(STATUS "System architecture: ${CMAKE_HOST_SYSTEM_PROCESSOR}") | ||
# system: euleros or ubuntu | ||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | ||
execute_process( | ||
COMMAND bash "-c" "cat /etc/os-release | grep ^ID= | awk -F '=' '{print $2}'" | ||
OUTPUT_VARIABLE SYSTEM_TYPE | ||
) | ||
MESSAGE(STATUS "System type: ${SYSTEM_TYPE}.") | ||
endif() | ||
|
||
# download json headers, rather than whole repository | ||
include(${GE_SOURCE_DIR}/cmake/ge_utils.cmake) | ||
include(${GE_SOURCE_DIR}/cmake/external_libs/json.cmake) | ||
include(${GE_SOURCE_DIR}/cmake/external_libs/eigen.cmake) | ||
include(${GE_SOURCE_DIR}/cmake/external_libs/gtest.cmake) | ||
include(${GE_SOURCE_DIR}/cmake/external_libs/protobuf.cmake) | ||
include(${GE_SOURCE_DIR}/cmake/external_libs/onnx.cmake) | ||
set(CMAKE_SKIP_RPATH TRUE) | ||
|
||
# for CPU/GPU mode, find c_sec and slog from local prebuild | ||
if(NOT ENABLE_D AND NOT GE_ONLY) | ||
set(GE_PREBUILD_PATH ${GE_SOURCE_DIR}/third_party/prebuild/${CMAKE_HOST_SYSTEM_PROCESSOR}) | ||
find_library(c_sec libc_sec.so ${GE_PREBUILD_PATH}) | ||
find_library(slog libslog.so ${GE_PREBUILD_PATH}) | ||
# if D_LINK_PATH is set in environment variables, search libraries in given path | ||
elseif(DEFINED ENV{D_LINK_PATH}) | ||
# D_LINK_PATH is set | ||
set(GE_LIB_PATH $ENV{D_LINK_PATH}) | ||
set(GE_SYS_ARCH "") | ||
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64") | ||
# x86 ubuntu | ||
set(GE_SYS_ARCH "x86_64") | ||
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64") | ||
# arm euleros | ||
set(GE_SYS_ARCH "aarch64") | ||
else() | ||
message(FATAL_ERROR "Running on a unsupported architecture: ${SYSTEM_TYPE}, build terminated") | ||
endif() | ||
set(GE_LIB_PATH ${GE_LIB_PATH}/${GE_SYS_ARCH}) | ||
find_library(c_sec libc_sec.so ${GE_LIB_PATH}) | ||
find_library(slog libslog.so ${GE_LIB_PATH}) | ||
find_library(mmpa libmmpa.so ${GE_LIB_PATH}) | ||
find_library(runtime libruntime.so ${GE_LIB_PATH}) | ||
find_library(msprof libmsprof.so ${GE_LIB_PATH}) | ||
find_library(register libregister.so ${GE_LIB_PATH}) | ||
find_library(hccl libhccl.so ${GE_LIB_PATH}) | ||
find_library(cce libcce.so ${GE_LIB_PATH}) | ||
find_library(resource libresource.so ${GE_LIB_PATH}) | ||
else() | ||
# Ascend mode | ||
set(HIAI_INSTALLED_DIR /usr/local/HiAI) | ||
set(HIAI_DRIVER_DIR ${HIAI_INSTALLED_DIR}/driver/lib64) | ||
set(HIAI_RUNTIME_DIR ${HIAI_INSTALLED_DIR}/runtime/lib64) | ||
find_library(c_sec libc_sec.so ${HIAI_DRIVER_DIR}) | ||
find_library(slog libslog.so ${HIAI_DRIVER_DIR}) | ||
find_library(mmpa libmmpa.so ${HIAI_DRIVER_DIR}) | ||
|
||
find_library(cce libcce.so ${HIAI_RUNTIME_DIR}) | ||
find_library(hccl libhccl.so ${HIAI_RUNTIME_DIR}) | ||
find_library(runtime libruntime.so ${HIAI_RUNTIME_DIR}) | ||
find_library(msprof libmsprof.so ${HIAI_RUNTIME_DIR}) | ||
find_library(register libregister.so ${HIAI_RUNTIME_DIR}) | ||
find_library(resource libresource.so ${HIAI_RUNTIME_DIR}) | ||
endif() | ||
|
||
# add compile flags | ||
include(CheckCXXCompilerFlag) | ||
check_cxx_compiler_flag("-std=c++11" SUPPORT_CXX11) | ||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") | ||
message("Build in Debug mode") | ||
set(CMAKE_C_FLAGS "-O0 -g -Wall -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe -fPIC ${CMAKE_C_FLAGS}") | ||
set(CMAKE_CXX_FLAGS "-O0 -g -Wall -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe -fPIC ${CMAKE_CXX_FLAGS}") | ||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic") | ||
endif() | ||
else() | ||
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 "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}") | ||
endif () | ||
|
||
# force __FILE__ to show relative path of file, from source directory, as cmake project makes __FILE__ absolute directory | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILE__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"' -Wno-builtin-macro-redefined") | ||
|
||
# compile libraries from following directories | ||
# libgraph is compiled in any situation | ||
add_subdirectory(${GE_SOURCE_DIR}/src/common/graph) | ||
if(ENABLE_D) | ||
# if MindSpore compiles in D mode, compile the following libraries | ||
add_subdirectory(${GE_SOURCE_DIR}/src/ge/common) | ||
add_subdirectory(${GE_SOURCE_DIR}/src/ge/ge_runtime) | ||
elseif(GE_ONLY) | ||
# standalone GraphEngine compiles all following libraries | ||
add_subdirectory(${GE_SOURCE_DIR}/src/ge/common) | ||
add_subdirectory(${GE_SOURCE_DIR}/src/ge/ge_runtime) | ||
add_subdirectory(${GE_SOURCE_DIR}/src/ge/ge_local_engine) | ||
add_subdirectory(${GE_SOURCE_DIR}/src/ge/graph/build/memory) | ||
add_subdirectory(${GE_SOURCE_DIR}/src/ge/) | ||
add_subdirectory(${GE_SOURCE_DIR}/src/ge/executor) | ||
add_subdirectory(${GE_SOURCE_DIR}/src/ge/client) | ||
add_subdirectory(${GE_SOURCE_DIR}/src/ge/plugin/engine) | ||
endif() | ||
|
||
if (ENABLE_GE_COV OR ENABLE_GE_UT OR ENABLE_GE_ST) | ||
add_subdirectory(tests) | ||
endif() | ||
|
Oops, something went wrong.