commit
930a1fb0a8
@ -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
|
||||||
|
...
|
||||||
|
|
@ -0,0 +1,73 @@
|
|||||||
|
# MindSpore
|
||||||
|
build/
|
||||||
|
mindspore/lib
|
||||||
|
output
|
||||||
|
*.ir
|
||||||
|
|
||||||
|
# Cmake files
|
||||||
|
CMakeFiles/
|
||||||
|
cmake_install.cmake
|
||||||
|
CMakeCache.txt
|
||||||
|
Makefile
|
||||||
|
cmake-build-debug
|
||||||
|
|
||||||
|
# Dynamic libraries
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Static libraries
|
||||||
|
*.la
|
||||||
|
*.lai
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
|
||||||
|
# Protocol buffers
|
||||||
|
*_pb2.py
|
||||||
|
*.pb.h
|
||||||
|
*.pb.cc
|
||||||
|
|
||||||
|
# Object files
|
||||||
|
*.o
|
||||||
|
|
||||||
|
# Editor
|
||||||
|
.vscode
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Cquery
|
||||||
|
.cquery_cached_index/
|
||||||
|
compile_commands.json
|
||||||
|
|
||||||
|
# Ctags and cscope
|
||||||
|
tags
|
||||||
|
TAGS
|
||||||
|
CTAGS
|
||||||
|
GTAGS
|
||||||
|
GRTAGS
|
||||||
|
GSYMS
|
||||||
|
GPATH
|
||||||
|
cscope.*
|
||||||
|
|
||||||
|
# Python files
|
||||||
|
*__pycache__*
|
||||||
|
.pytest_cache
|
||||||
|
|
||||||
|
# Mac files
|
||||||
|
*.DS_Store
|
||||||
|
|
||||||
|
# Test results
|
||||||
|
test_temp_summary_event_file/
|
||||||
|
*.dot
|
||||||
|
*.dat
|
||||||
|
*.svg
|
||||||
|
*.perf
|
||||||
|
*.info
|
||||||
|
*.ckpt
|
||||||
|
*.shp
|
||||||
|
*.pkl
|
||||||
|
.clangd
|
||||||
|
mindspore/version.py
|
||||||
|
mindspore/default_config.py
|
||||||
|
mindspore/.commit_id
|
||||||
|
onnx.proto
|
||||||
|
mindspore/ccsrc/onnx.proto
|
@ -0,0 +1,15 @@
|
|||||||
|
[submodule "third_party/flatbuffers"]
|
||||||
|
path = third_party/flatbuffers
|
||||||
|
url = https://github.com/google/flatbuffers.git
|
||||||
|
[submodule "third_party/googletest"]
|
||||||
|
path = third_party/googletest
|
||||||
|
url = https://github.com/google/googletest.git
|
||||||
|
[submodule "third_party/incubator-tvm"]
|
||||||
|
path = third_party/incubator-tvm
|
||||||
|
url = https://github.com/apache/incubator-tvm.git
|
||||||
|
[submodule "third_party/protobuf"]
|
||||||
|
path = third_party/protobuf
|
||||||
|
url = https://github.com/protocolbuffers/protobuf.git
|
||||||
|
[submodule "graphengine"]
|
||||||
|
path = graphengine
|
||||||
|
url = https://gitee.com/mindspore/graphengine.git
|
@ -0,0 +1,55 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
project (MindSpore)
|
||||||
|
|
||||||
|
include(${CMAKE_SOURCE_DIR}/cmake/options.cmake)
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -g2 -ggdb -fno-inline-functions -fno-omit-frame-pointer -Wl,--allow-shlib-undefined -D_LIBCPP_INLINE_VISIBILITY='' -D'_LIBCPP_EXTERN_TEMPLATE(...)=' -DHALF_ENABLE_CPP11_USER_LITERALS=0 -D_FORTIFY_SOURCE=2 -Wno-cpp")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -Wl,--allow-shlib-undefined -DHALF_ENABLE_CPP11_USER_LITERALS=0 -D_FORTIFY_SOURCE=2")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/local/include -std=c++17 -Werror -Wall -Wno-deprecated-declarations -fPIC")
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
set(PYBIND11_CPP_STANDARD -std=c++17)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPTION_CXX_FLAGS}")
|
||||||
|
|
||||||
|
find_package(Threads)
|
||||||
|
include(${CMAKE_SOURCE_DIR}/cmake/mind_expression.cmake)
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers/include)
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers/include/flatbuffers)
|
||||||
|
|
||||||
|
include(${CMAKE_SOURCE_DIR}/cmake/dependency_utils.cmake)
|
||||||
|
find_package(Python3 COMPONENTS Interpreter Development)
|
||||||
|
if(Python3_FOUND)
|
||||||
|
set(PYTHON_INCLUDE_DIRS "${Python3_INCLUDE_DIRS}")
|
||||||
|
set(PYTHON_LIBRARIES "${Python3_LIBRARIES}")
|
||||||
|
else()
|
||||||
|
find_python_package(py_inc py_lib)
|
||||||
|
set(PYTHON_INCLUDE_DIRS "${py_inc}")
|
||||||
|
set(PYTHON_LIBRARIES "${py_lib}")
|
||||||
|
endif()
|
||||||
|
message("PYTHON_INCLUDE_DIRS = ${PYTHON_INCLUDE_DIRS}")
|
||||||
|
message("PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}")
|
||||||
|
include_directories(${PYTHON_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
set(MS_CCSRC_PATH ${CMAKE_SOURCE_DIR}/mindspore/ccsrc)
|
||||||
|
set(MS_CCSRC_BUILD_PATH ${BUILD_PATH}/mindspore/mindspore/ccsrc)
|
||||||
|
|
||||||
|
if (ENABLE_GE)
|
||||||
|
link_directories(${CMAKE_SOURCE_DIR}/third_party/ge/lib)
|
||||||
|
else()
|
||||||
|
include(${CMAKE_SOURCE_DIR}/cmake/dependency_graphengine.cmake)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/graphengine/inc)
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/graphengine/inc/external)
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/graphengine/inc/framework)
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/graphengine/third_party/fwkacllib/inc)
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/graphengine/third_party/fwkacllib/inc/toolchain)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
|
||||||
|
add_subdirectory(mindspore/ccsrc)
|
||||||
|
if (ENABLE_TESTCASES)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
endif()
|
@ -0,0 +1,115 @@
|
|||||||
|
# MindSpore contributing guidelines
|
||||||
|
|
||||||
|
<!-- TOC -->
|
||||||
|
|
||||||
|
- [MindSpore contributing guidelines](#mindspore-contributing-guidelines)
|
||||||
|
- [Contributor License Agreement](#contributor-license-agreement)
|
||||||
|
- [Getting Started](#getting-started)
|
||||||
|
- [Contribution workflow](#contribution-workflow)
|
||||||
|
- [Code style](#code-style)
|
||||||
|
- [Fork-Pull development model](#fork-pull-development-model)
|
||||||
|
- [Report issues](#report-issues)
|
||||||
|
- [Propose PRs](#propose-prs)
|
||||||
|
|
||||||
|
<!-- /TOC -->
|
||||||
|
|
||||||
|
## Contributor License Agreement
|
||||||
|
|
||||||
|
It's required to sign CLA before your first code submission to MindSpore community.
|
||||||
|
|
||||||
|
For individual contributor, please refer to [ICLA online document](https://www.mindspore.cn/icla) for the detailed information.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
- Fork the repository on [Github](https://github.com/mindspore-ai/mindspore) or [Gitee](https://gitee.com/mindspore/mindspore).
|
||||||
|
- Read the [README.md](README.md) and [install page](https://www.mindspore.cn/install/en) for project information and build instructions.
|
||||||
|
|
||||||
|
## Contribution Workflow
|
||||||
|
|
||||||
|
### Code style
|
||||||
|
|
||||||
|
Please follow this style to make MindSpore easy to review, maintain and develop.
|
||||||
|
|
||||||
|
* Coding guidelines
|
||||||
|
|
||||||
|
The *Python* coding style suggested by [Python PEP 8 Coding Style](https://pep8.org/) and *C++* coding style suggested by [Google C++ Coding Guidelines](http://google.github.io/styleguide/cppguide.html) are used in MindSpore community.
|
||||||
|
|
||||||
|
* Unittest guidelines
|
||||||
|
|
||||||
|
The *Python* unittest style suggested by [pytest](http://www.pytest.org/en/latest/) and *C++* unittest style suggested by [Googletest Primer](https://github.com/google/googletest/blob/master/googletest/docs/primer.md) are used in MindSpore community.
|
||||||
|
|
||||||
|
### Fork-Pull development model
|
||||||
|
|
||||||
|
* Fork MindSpore repository
|
||||||
|
|
||||||
|
Before submitting code to MindSpore project, please make sure that this project have been forked to your own repository. It means that there will be parallel development between MindSpore repository and your own repository, so be careful to avoid the inconsistency between them.
|
||||||
|
|
||||||
|
* Clone the remote repository
|
||||||
|
|
||||||
|
If you want to download the code to the local machine, `git` is the best way:
|
||||||
|
```shell
|
||||||
|
# For GitHub
|
||||||
|
git clone https://github.com/{insert_your_forked_repo}/mindspore.git
|
||||||
|
git remote add upstream https://github.com/mindspore-ai/mindspore.git
|
||||||
|
# For Gitee
|
||||||
|
git clone https://gitee.com/{insert_your_forked_repo}/mindspore.git
|
||||||
|
git remote add upstream https://gitee.com/mindspore/mindspore.git
|
||||||
|
```
|
||||||
|
|
||||||
|
* Develop code locally
|
||||||
|
|
||||||
|
To avoid inconsistency between multiple branches, checking out to a new branch is `SUGGESTED`:
|
||||||
|
```shell
|
||||||
|
git checkout -b {new_branch_name} origin/master
|
||||||
|
```
|
||||||
|
|
||||||
|
Then you can change the code arbitrarily.
|
||||||
|
|
||||||
|
* Push the code to the remote repository
|
||||||
|
|
||||||
|
After updating the code, you should push the update in the formal way:
|
||||||
|
```shell
|
||||||
|
git add .
|
||||||
|
git status # Check the update status
|
||||||
|
git commit -m "Your commit title"
|
||||||
|
git commit -s --amend #Add the concrete description of your commit
|
||||||
|
git push origin {new_branch_name}
|
||||||
|
```
|
||||||
|
|
||||||
|
* Pull a request to MindSpore repository
|
||||||
|
|
||||||
|
In the last step, your need to pull a compare request between your new branch and MindSpore `master` branch. After finishing the pull request, the Jekins CI will be automatically set up for building test.
|
||||||
|
|
||||||
|
### Report issues
|
||||||
|
|
||||||
|
A great way to contribute to the project is to send a detailed report when you encounter an issue. We always appreciate a well-written, thorough bug report, and will thank you for it!
|
||||||
|
|
||||||
|
When reporting issues, refer to this format:
|
||||||
|
|
||||||
|
- What version of env (mindspore, os, python etc) are you using?
|
||||||
|
- Is this a BUG REPORT or FEATURE REQUEST?
|
||||||
|
- What happened?
|
||||||
|
- What you expected to happen?
|
||||||
|
- How to reproduce it?(as minimally and precisely as possible)
|
||||||
|
- Special notes for your reviewers?
|
||||||
|
|
||||||
|
**Issues advisory:**
|
||||||
|
|
||||||
|
- **If you find an unclosed issue, which is exactly what you are going to solve,** please put some comments on that issue to tell others you would be in charge of it.
|
||||||
|
- **If an issue is opened for a while,** it's recommended for contributors to precheck before working on solving that issue.
|
||||||
|
- **If you resolve an issue which is reported by yourself,** it's also required to let others know before closing that issue.
|
||||||
|
|
||||||
|
### Propose PRs
|
||||||
|
|
||||||
|
* Raise your idea as an *issue* on [GitHub](https://github.com/mindspore-ai/mindspore/issues) or [Gitee](https://gitee.com/mindspore/mindspore/issues)
|
||||||
|
* If it is a new feature that needs lots of design details, a design proposal should also be submitted.
|
||||||
|
* After reaching consensus in the issue discussions and design proposal reviews, complete the development on the forked repo and submit a PR.
|
||||||
|
* None of PRs is not permitted until it receives **2+ LGTM** from approvers. Please NOTICE that approver is NOT allowed to add *LGTM* on his own PR.
|
||||||
|
* After PR is sufficiently discussed, it will get merged, abondoned or rejected depending on the outcome of the discussion.
|
||||||
|
|
||||||
|
**PRs advisory:**
|
||||||
|
|
||||||
|
- Any irrelevant changes should be avoided.
|
||||||
|
- Make sure your commit history being ordered.
|
||||||
|
- Always keep your branch up with the master branch.
|
||||||
|
- For bug-fix PRs, make sure all related issues being linked.
|
@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
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.
|
@ -0,0 +1,2 @@
|
|||||||
|
MindSpore
|
||||||
|
Copyright 2019-2020 Huawei Technologies Co., Ltd
|
@ -0,0 +1,124 @@
|
|||||||
|
![MindSpore Logo](docs/MindSpore-logo.png "MindSpore logo")
|
||||||
|
============================================================
|
||||||
|
|
||||||
|
- [What is MindSpore?](#what-is-MindSpore)
|
||||||
|
- [Automatic Differentiation](#automatic-differentiation)
|
||||||
|
- [Automatic Parallel](#automatic-parallel)
|
||||||
|
- [Installation](#installation)
|
||||||
|
- [Binaries](#binaries)
|
||||||
|
- [From Source](#from-source)
|
||||||
|
- [Quickstart](#quickstart)
|
||||||
|
- [Docs](#docs)
|
||||||
|
- [Community](#community)
|
||||||
|
- [Governance](#governance)
|
||||||
|
- [Communication](#communication)
|
||||||
|
- [Contributing](#contributing)
|
||||||
|
- [Release Notes](#release-notes)
|
||||||
|
- [License](#license)
|
||||||
|
|
||||||
|
## What Is MindSpore
|
||||||
|
|
||||||
|
MindSpore is a new open source deep learning training/inference framework that
|
||||||
|
could be used for mobile, edge and cloud scenarios. MindSpore is designed to
|
||||||
|
provide development experience with friendly design and efficient execution for
|
||||||
|
the data scientists and algorithmic engineers, native support for Ascend AI
|
||||||
|
processor, and software hardware co-optimization. At the meantime MindSpore as
|
||||||
|
a global AI open source community, aims to further advance the development and
|
||||||
|
enrichment of the AI software/hardware application ecosystem.
|
||||||
|
|
||||||
|
<img src="docs/MindSpore-architecture.png" alt="MindSpore Architecture" width="600"/>
|
||||||
|
|
||||||
|
For more details please check out our [Architecture Guide](https://www.mindspore.cn/docs/en/0.1.0-alpha/architecture.html).
|
||||||
|
|
||||||
|
### Automatic Differentiation
|
||||||
|
|
||||||
|
There are currently three automatic differentiation techniques in mainstream deep learning frameworks:
|
||||||
|
|
||||||
|
- **Conversion based on static compute graph**: Convert the network into a static data flow graph at compile time, then turn the chain rule into a data flow graph to implement automatic differentiation.
|
||||||
|
- **Conversion based on dynamic compute graph**: Record the operation trajectory of the network during forward execution in an operator overloaded manner, then apply the chain rule to the dynamically generated data flow graph to implement automatic differentiation.
|
||||||
|
- **Conversion based on source code**: This technology is evolving from the functional programming framework and performs automatic differential transformation on the intermediate expression (the expression form of the program during the compilation process) in the form of just-in-time compilation (JIT), supporting complex control flow scenarios, higher-order functions and closures.
|
||||||
|
|
||||||
|
TensorFlow adopted static calculation diagrams in the early days, whereas PyTorch used dynamic calculation diagrams. Static maps can utilize static compilation technology to optimize network performance, however, building a network or debugging it is very complicated. The use of dynamic graphics is very convenient, but it is difficult to achieve extreme optimization in performance.
|
||||||
|
|
||||||
|
But MindSpore finds another way, automatic differentiation based on source code conversion. On the one hand, it supports automatic differentiation of automatic control flow, so it is quite convenient to build models like PyTorch. On the other hand, MindSpore can perform static compilation optimization on neural networks to achieve great performance.
|
||||||
|
|
||||||
|
<img src="docs/Automatic-differentiation.png" alt="Automatic Differentiation" width="600"/>
|
||||||
|
|
||||||
|
The implementation of MindSpore automatic differentiation can be understood as the symbolic differentiation of the program itself. Because MindSpore IR is a functional intermediate expression, it has an intuitive correspondence with the composite function in basic algebra. The derivation formula of the composite function composed of arbitrary basic functions can be derived. Each primitive operation in MindSpore IR can correspond to the basic functions in basic algebra, which can build more complex flow control.
|
||||||
|
|
||||||
|
### Automatic Parallel
|
||||||
|
|
||||||
|
The goal of MindSpore automatic parallel is to build a training method that combines data parallelism, model parallelism, and hybrid parallelism. It can automatically select a least cost model splitting strategy to achieve automatic distributed parallel training.
|
||||||
|
|
||||||
|
<img src="docs/Automatic-parallel.png" alt="Automatic Parallel" width="600"/>
|
||||||
|
|
||||||
|
At present, MindSpore uses a fine-grained parallel strategy of splitting operators, that is, each operator in the figure is splited into a cluster to complete parallel operations. The splitting strategy during this period may be very complicated, but as a developer advocating Pythonic, you don't need to care about the underlying implementation, as long as the top-level API compute is efficient.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Binaries
|
||||||
|
|
||||||
|
MindSpore offers build options across multiple backends:
|
||||||
|
|
||||||
|
| Hardware Platform | Operating System | Status |
|
||||||
|
| :---------------- | :--------------- | :----- |
|
||||||
|
| Ascend910 | Ubuntu-x86 | ✔️ |
|
||||||
|
| | EulerOS-x86 | ✔️ |
|
||||||
|
| | EulerOS-aarch64 | ✔️ |
|
||||||
|
| GPU CUDA 9.2 | Ubuntu-x86 | ✔️ |
|
||||||
|
| GPU CUDA 10.1 | Ubuntu-x86 | ✔️ |
|
||||||
|
| CPU | Ubuntu-x86 | ✔️ |
|
||||||
|
|
||||||
|
For installation using pip, take `Ubuntu-x86` and `CPU` build version as an example:
|
||||||
|
|
||||||
|
1. Download whl from [MindSpore website](https://www.mindspore.cn/), and install the package.
|
||||||
|
|
||||||
|
```
|
||||||
|
pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/0.1.0-alpha/MindSpore/cpu/ubuntu-x86/mindspore-0.1.0-cp37-cp37m-linux_x86_64.whl
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Run the following command to verify the install.
|
||||||
|
|
||||||
|
```
|
||||||
|
python -c 'import mindspore'
|
||||||
|
```
|
||||||
|
|
||||||
|
### From Source
|
||||||
|
|
||||||
|
[Install MindSpore](https://www.mindspore.cn/install/en).
|
||||||
|
|
||||||
|
## Quickstart
|
||||||
|
|
||||||
|
See the [Quick Start](https://www.mindspore.cn/tutorial/en/0.1.0-alpha/quick_start/quick_start.html)
|
||||||
|
to implement the image classification.
|
||||||
|
|
||||||
|
## Docs
|
||||||
|
|
||||||
|
More details about installation guide, tutorials and APIs, please see the
|
||||||
|
[User Documentation](https://gitee.com/mindspore/docs).
|
||||||
|
|
||||||
|
## Community
|
||||||
|
|
||||||
|
### Governance
|
||||||
|
|
||||||
|
Check out how MindSpore Open Governance [works](https://gitee.com/mindspore/community/blob/master/governance.md).
|
||||||
|
|
||||||
|
### Communication
|
||||||
|
|
||||||
|
- [MindSpore Slack](https://join.slack.com/t/mindspore/shared_invite/enQtOTcwMTIxMDI3NjM0LTNkMWM2MzI5NjIyZWU5ZWQ5M2EwMTQ5MWNiYzMxOGM4OWFhZjI4M2E5OGI2YTg3ODU1ODE2Njg1MThiNWI3YmQ) - Communication platform for developers.
|
||||||
|
- IRC channel at `#mindspore` (only for meeting minutes logging purpose)
|
||||||
|
- Video Conferencing: meet.jit.si
|
||||||
|
- Mailing-list: https://mailweb.mindspore.cn/postorius/lists
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Welcome contributions. See our [Contributor Wiki](CONTRIBUTING.md) for
|
||||||
|
more details.
|
||||||
|
|
||||||
|
## Release Notes
|
||||||
|
|
||||||
|
The release notes, see our [RELEASE](RELEASE.md).
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[Apache License 2.0](LICENSE)
|
@ -0,0 +1,73 @@
|
|||||||
|
# Release 0.1.0-alpha
|
||||||
|
|
||||||
|
## Main Features
|
||||||
|
|
||||||
|
### Ascend 910 Training and Inference Framework
|
||||||
|
* Recommended OS: Ubuntu 16.04 (or later) or EulerOS 2.0
|
||||||
|
* Python version: 3.7.5
|
||||||
|
* Preset models
|
||||||
|
* ResNet-50: residual structure-based convolutional neural network (CNN) for image classification, which is widely used.
|
||||||
|
* AlexNet: classic CNN for image classification, achieving historical results in ImageNet LSVRC-2012.
|
||||||
|
* LeNet: classic CNN for image classification, which was proposed by Yann LeCun.
|
||||||
|
* VGG16: classic CNN for image classification, which was proposed by Oxford Visual Geometry Group.
|
||||||
|
* YoloV3: real-time object detection network.
|
||||||
|
* NEZHA: BERT-based Chinese pre-training network produced by Huawei Noah's Ark Laboratory.
|
||||||
|
* Execution modes
|
||||||
|
* Graph mode: provides graph optimization methods such as memory overcommitment, IR fusion, and buffer fusion to achieve optimal execution performance.
|
||||||
|
* PyNative mode: single-step execution mode, facilitating process debugging.
|
||||||
|
* Debugging capability and methods
|
||||||
|
* Save CheckPoints and Summary data during training.
|
||||||
|
* Support asynchronous printing.
|
||||||
|
* Dump the computing data.
|
||||||
|
* Support profiling analysis of the execution process performance.
|
||||||
|
* Distributed execution
|
||||||
|
* Support AllReduce, AllGather, and BroadCast collective communication.
|
||||||
|
* AllReduce data parallel: Each device obtains different training data, which accelerates the overall training process.
|
||||||
|
* Collective communication-based layerwise parallel: Models are divided and allocated to different devices to solve the problem of insufficient memory for large model processing and improve the training speed.
|
||||||
|
* Automatic parallel mode: The better data and model parallel mode can be predicted based on the cost model. It is recommended that this mode be used on ResNet series networks.
|
||||||
|
* Automatic differentiation
|
||||||
|
* Implement automatic differentiation based on Source to Source.
|
||||||
|
* Support distributed scenarios and automatic insertion of reverse communication operators.
|
||||||
|
* Data processing, augmentation, and save format
|
||||||
|
* Load common datasets such as ImageNet, MNIST, CIFAR-10, and CIFAR-100.
|
||||||
|
* Support common data loading pipeline operations, such as shuffle, repeat, batch, map, and sampler.
|
||||||
|
* Provide basic operator libraries to cover common CV scenarios.
|
||||||
|
* Support users to customize Python data augmentation operators through the Pyfunc mechanism.
|
||||||
|
* Support the access of user-defined datasets through the GeneratorDataset mechanism.
|
||||||
|
* Provide the MindSpore data format, data aggregation and storage, random access example, data partition, efficient parallel read, user-defined index, and dataset search.
|
||||||
|
* Convert user datasets to the MindSpore data format.
|
||||||
|
* After data processing and augmentation, provide training applications in feed and graph modes.
|
||||||
|
* FP32/16 mixed precision computation, supporting automatic and manual configuration
|
||||||
|
* Provide common operators such as nn, math, and array, which can be customized.
|
||||||
|
|
||||||
|
### Inference Deployment
|
||||||
|
* Deploy models in MindSpore format on the Ascend 310 platform for inference.
|
||||||
|
* Save models in ONNX format.
|
||||||
|
* Support saving models in LITE format and running models based on the lightweight inference framework.
|
||||||
|
* Recommended OS: Android 4.3 or later
|
||||||
|
* Supported network type: LeNet
|
||||||
|
* Provide the generalization operators generated by TVM and operators generated after specific networks are tuned.
|
||||||
|
|
||||||
|
### Other Hardware Support
|
||||||
|
* GPU platform training
|
||||||
|
* Recommended OS: Ubuntu 16.04
|
||||||
|
* CUDA version: 9.2 or 10.1
|
||||||
|
* CuDNN version: 7.6 or later
|
||||||
|
* Python version: 3.7.5
|
||||||
|
* NCCL version: 2.4.8-1
|
||||||
|
* OpenMPI version: 3.1.5
|
||||||
|
* Supported models: AlexNet, LeNet, and LSTM
|
||||||
|
* Supported datasets: MNIST and CIFAR-10
|
||||||
|
* Support data parallel.
|
||||||
|
* CPU platform training
|
||||||
|
* Recommended OS: Ubuntu 16.04
|
||||||
|
* Python version: 3.7.5
|
||||||
|
* Supported model: LeNet
|
||||||
|
* Supported dataset: MNIST
|
||||||
|
* Provide only the stand-alone operation version.
|
||||||
|
|
||||||
|
## Peripherals and Tools
|
||||||
|
* [MindSpore Official Website] (https://www.mindspore.cn/)
|
||||||
|
* [MindInsight Visualization Debugging and Optimization] (https://gitee.com/mindspore/mindinsight)
|
||||||
|
* [MindArmour Model Security Hardening Package] (https://gitee.com/mindspore/mindarmour)
|
||||||
|
* [GraphEngine Computational Graph Engine] (https://gitee.com/mindspore/graphengine)
|
@ -0,0 +1,14 @@
|
|||||||
|
# Security Risk Description
|
||||||
|
|
||||||
|
1. When MindSpore is used for AI model training, if the user-defined computational graph structure (for example, Python code for generating the MindSpore computational graph) is provided by an untrusted third party, malicious code may exist and will be loaded and executed to attack the system.
|
||||||
|
2. Model files are stored in binary mode. When MindSpore is used to optimize or infer AI models and the model files are loaded in deserialization mode, once malicious code is written into the model files, the code are loaded and executed, causing attacks on the system.
|
||||||
|
3. MindSpore performs only model training and inference based on the data provided by users. Users need to protect data security to avoid privacy leakage.
|
||||||
|
4. MindSpore is a distributed training platform. When MindSpore is used for distributed training, if an Ascend chip is used for training, a device provides a secure transmission protocol for gradient fusion. If GPUs or other clusters are used for training, identity authentication and secure transmission are not provided.
|
||||||
|
|
||||||
|
# Security Usage Suggestions
|
||||||
|
|
||||||
|
1. Run MindSpore in the sandbox.
|
||||||
|
2. Run MindSpore as a non-root user.
|
||||||
|
3. Ensure that the source of a computational graph structure is trustworthy. Do not write code irrelevant to model training in the network structure definition.
|
||||||
|
4. Ensure that the source of a network model is trustworthy or enter secure network model parameters to prevent model parameters from being tampered with.
|
||||||
|
5. Ensure that GPU distributed training is performed on an isolated cluster network.
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Copyright 2019 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.
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
|
@ -0,0 +1,70 @@
|
|||||||
|
message(STATUS "ENABLE_GE set to FALSE, compiling GraphEngine")
|
||||||
|
set(GE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/graphengine)
|
||||||
|
|
||||||
|
message(STATUS "ge dir: ${GE_SOURCE_DIR}")
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
# for CPU/GPU mode, find c_sec and slog from local prebuild
|
||||||
|
if (NOT ENABLE_D)
|
||||||
|
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})
|
||||||
|
elseif (DEFINED ENV{D_LINK_PATH})
|
||||||
|
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()
|
||||||
|
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()
|
||||||
|
|
||||||
|
# compile libraries from following directories
|
||||||
|
# this cmake file is called only when NOT ENABLE_GE is set
|
||||||
|
set(_ge_tmp_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||||
|
|
||||||
|
string(REPLACE " -Wall" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
string(REPLACE " -Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
# force __FILE__ to show relative path of file, from source directory
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILE__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"' -Wno-builtin-macro-redefined")
|
||||||
|
add_subdirectory(${GE_SOURCE_DIR}/src/common/graph)
|
||||||
|
if(ENABLE_D)
|
||||||
|
add_subdirectory(${GE_SOURCE_DIR}/src/ge/common)
|
||||||
|
add_subdirectory(${GE_SOURCE_DIR}/src/ge/ge_runtime)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS ${_ge_tmp_CMAKE_CXX_FLAGS})
|
@ -0,0 +1,36 @@
|
|||||||
|
# googletest library
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# GTest_LIBRARY
|
||||||
|
#
|
||||||
|
|
||||||
|
if (NOT TARGET gtest)
|
||||||
|
set(BUILD_TESTING OFF CACHE BOOL "Disable glog test")
|
||||||
|
|
||||||
|
set(_ms_tmp_CMAKE_POSITION_INDEPENDENT_CODE ${CMAKE_POSITION_INDEPENDENT_CODE})
|
||||||
|
set(_ms_tmp_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||||
|
set(_ms_tmp_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
|
||||||
|
set(_ms_tmp_CMAKE_MACOSX_RPATH ${CMAKE_MACOSX_RPATH})
|
||||||
|
|
||||||
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
set(BUILD_SHARED_LIBS ON)
|
||||||
|
set(CMAKE_MACOSX_RPATH TRUE)
|
||||||
|
set(CMAKE_CXX_FLAGS "${SECURE_CXX_FLAGS}")
|
||||||
|
|
||||||
|
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.0" AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64" AND SYSTEM_TYPE MATCHES "euleros")
|
||||||
|
# -D_GLIBCXX_USE_CXX11_ABI=0 added for the ABI incompatible for libtsdclient.so
|
||||||
|
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/googletest ${CMAKE_BINARY_DIR}/googletest)
|
||||||
|
|
||||||
|
set(CMAKE_POSITION_INDEPENDENT_CODE ${_ms_tmp_CMAKE_POSITION_INDEPENDENT_CODE})
|
||||||
|
set(CMAKE_CXX_FLAGS ${_ms_tmp_CMAKE_CXX_FLAGS})
|
||||||
|
set(BUILD_SHARED_LIBS ${_ms_tmp_BUILD_SHARED_LIBS})
|
||||||
|
set(CMAKE_MACOSX_RPATH ${_ms_tmp_CMAKE_MACOSX_RPATH})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_LIST_DIR}/../third_party/googletest/googletest/include)
|
||||||
|
|
||||||
|
set(GTEST_LIBRARY gtest)
|
||||||
|
|
@ -0,0 +1,100 @@
|
|||||||
|
# Protobuf
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# PROTOBUF_LIBRARY - Link this to use protobuf
|
||||||
|
#
|
||||||
|
if (NOT TARGET protobuf::libprotobuf)
|
||||||
|
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Disable protobuf test")
|
||||||
|
set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "Gen shared library")
|
||||||
|
set(_ms_tmp_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||||
|
|
||||||
|
string(REPLACE " -Wall" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
string(REPLACE " -Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
|
||||||
|
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/protobuf/cmake ${CMAKE_BINARY_DIR}/protobuf)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS ${_ms_tmp_CMAKE_CXX_FLAGS})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_LIST_DIR}/../third_party/protobuf/src)
|
||||||
|
|
||||||
|
set(PROTOBUF_LIBRARY protobuf::libprotobuf)
|
||||||
|
set(PROTOC_EXECUTABLE $<TARGET_FILE:protobuf::protoc>)
|
||||||
|
|
||||||
|
function(ms_protobuf_generate c_var h_var)
|
||||||
|
if(NOT ARGN)
|
||||||
|
message(SEND_ERROR "Error: ms_protobuf_generate() called without any proto files")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(${c_var})
|
||||||
|
set(${h_var})
|
||||||
|
|
||||||
|
foreach(file ${ARGN})
|
||||||
|
get_filename_component(abs_file ${file} ABSOLUTE)
|
||||||
|
get_filename_component(file_name ${file} NAME_WE)
|
||||||
|
get_filename_component(file_dir ${abs_file} PATH)
|
||||||
|
file(RELATIVE_PATH rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${file_dir})
|
||||||
|
|
||||||
|
|
||||||
|
list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.cc")
|
||||||
|
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.h")
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.cc"
|
||||||
|
"${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.h"
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/${rel_path}"
|
||||||
|
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/${rel_path} ${abs_file}
|
||||||
|
DEPENDS protobuf::protoc ${abs_file}
|
||||||
|
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM )
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set_source_files_properties(${${c_var}} ${${h_var}} PROPERTIES GENERATED TRUE)
|
||||||
|
set(${c_var} ${${c_var}} PARENT_SCOPE)
|
||||||
|
set(${h_var} ${${h_var}} PARENT_SCOPE)
|
||||||
|
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(ms_protobuf_generate_py c_var h_var py_var)
|
||||||
|
if(NOT ARGN)
|
||||||
|
message(SEND_ERROR "Error: ms_protobuf_generate() called without any proto files")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(${c_var})
|
||||||
|
set(${h_var})
|
||||||
|
set(${py_var})
|
||||||
|
|
||||||
|
foreach(file ${ARGN})
|
||||||
|
get_filename_component(abs_file ${file} ABSOLUTE)
|
||||||
|
get_filename_component(file_name ${file} NAME_WE)
|
||||||
|
get_filename_component(file_dir ${abs_file} PATH)
|
||||||
|
file(RELATIVE_PATH rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${file_dir})
|
||||||
|
|
||||||
|
|
||||||
|
list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.cc")
|
||||||
|
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.h")
|
||||||
|
list(APPEND ${py_var} "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}_pb2.py")
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.cc"
|
||||||
|
"${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.h"
|
||||||
|
"${CMAKE_BINARY_DIR}/${rel_path}/${file_name}_pb2.py"
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/${rel_path}"
|
||||||
|
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/${rel_path} ${abs_file}
|
||||||
|
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/${rel_path} ${abs_file}
|
||||||
|
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/${rel_path} ${abs_file}
|
||||||
|
COMMAND perl -pi -e "s/import (.+_pb2.*)/from . import \\1/" "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}_pb2.py"
|
||||||
|
COMMAND cp "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}_pb2.py" "${PROJECT_SOURCE_DIR}/mindspore/train/"
|
||||||
|
DEPENDS protobuf::protoc ${abs_file}
|
||||||
|
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM )
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set_source_files_properties(${${c_var}} ${${h_var}} ${${py_var}} PROPERTIES GENERATED TRUE)
|
||||||
|
set(${c_var} ${${c_var}} PARENT_SCOPE)
|
||||||
|
set(${h_var} ${${h_var}} PARENT_SCOPE)
|
||||||
|
set(${py_var} ${${py_var}} PARENT_SCOPE)
|
||||||
|
|
||||||
|
endfunction()
|
@ -0,0 +1,19 @@
|
|||||||
|
# securec library
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# SECUREC_LIBRARY
|
||||||
|
#
|
||||||
|
|
||||||
|
if (NOT TARGET securec)
|
||||||
|
set(_ms_tmp_CMAKE_POSITION_INDEPENDENT_CODE ${CMAKE_POSITION_INDEPENDENT_CODE})
|
||||||
|
set(_ms_tmp_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||||
|
|
||||||
|
set(CMAKE_C_FLAGS "${SECURE_CXX_FLAGS}")
|
||||||
|
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/securec ${CMAKE_BINARY_DIR}/securec)
|
||||||
|
set(CMAKE_POSITION_INDEPENDENT_CODE ${_ms_tmp_CMAKE_POSITION_INDEPENDENT_CODE})
|
||||||
|
set(CMAKE_C_FLAGS ${_ms_tmp_CMAKE_C_FLAGS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_LIST_DIR}/../third_party/securec/include)
|
||||||
|
|
||||||
|
set(SECUREC_LIBRARY securec)
|
@ -0,0 +1,25 @@
|
|||||||
|
# MS Utils
|
||||||
|
#
|
||||||
|
|
||||||
|
function(find_python_package out_inc out_lib)
|
||||||
|
# Use PYTHON_EXECUTABLE if it is defined, otherwise default to python
|
||||||
|
if ("${PYTHON_EXECUTABLE}" STREQUAL "")
|
||||||
|
set(PYTHON_EXECUTABLE "python3")
|
||||||
|
else()
|
||||||
|
set(PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${PYTHON_EXECUTABLE}" -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())"
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
OUTPUT_VARIABLE inc)
|
||||||
|
string(STRIP "${inc}" inc)
|
||||||
|
set(${out_inc} ${inc} PARENT_SCOPE)
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${PYTHON_EXECUTABLE}" -c "import distutils.sysconfig as sysconfig; import os; print(os.path.join(sysconfig.get_config_var('LIBDIR'), sysconfig.get_config_var('LDLIBRARY')))"
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
OUTPUT_VARIABLE lib)
|
||||||
|
string(STRIP "${lib}" lib)
|
||||||
|
set(${out_lib} ${lib} PARENT_SCOPE)
|
||||||
|
endfunction()
|
@ -0,0 +1,7 @@
|
|||||||
|
mindspore_add_pkg(dlpack
|
||||||
|
VER 0.2
|
||||||
|
HEAD_ONLY ./
|
||||||
|
URL https://github.com/dmlc/dlpack/archive/0acb731e0e43d15deee27b66f10e4c5b4e667913.zip
|
||||||
|
MD5 6b8093f17ad4e830d3c63eb3171c4b45)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
|||||||
|
mindspore_add_pkg(dmlc_core
|
||||||
|
VER 0.3
|
||||||
|
HEAD_ONLY ./
|
||||||
|
URL https://github.com/dmlc/dmlc-core/archive/808f485387f9a03f78fa9f1159f387d0d91b7a28.zip
|
||||||
|
MD5 ea36f94c57752bf40fb02dfc362f1ed9)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
set(Eigen3_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||||
|
set(Eigen3_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||||
|
mindspore_add_pkg(Eigen3
|
||||||
|
VER 3.3.7
|
||||||
|
URL https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz
|
||||||
|
MD5 9e30f67e8531477de4117506fe44669b
|
||||||
|
CMAKE_OPTION -DBUILD_TESTING=OFF)
|
||||||
|
find_package(Eigen3 3.3.7 REQUIRED ${MS_FIND_NO_DEFAULT_PATH})
|
||||||
|
include_directories(${Eigen3_INC})
|
||||||
|
include_directories(${EIGEN3_INCLUDE_DIR})
|
||||||
|
set_property(TARGET Eigen3::Eigen PROPERTY IMPORTED_GLOBAL TRUE)
|
||||||
|
add_library(mindspore::eigen ALIAS Eigen3::Eigen)
|
@ -0,0 +1,53 @@
|
|||||||
|
set(flatbuffers_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||||
|
set(flatbuffers_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||||
|
mindspore_add_pkg(flatbuffers
|
||||||
|
VER 1.11.0
|
||||||
|
LIBS flatbuffers
|
||||||
|
EXE flatc
|
||||||
|
URL https://github.com/google/flatbuffers/archive/v1.11.0.tar.gz
|
||||||
|
MD5 02c64880acb89dbd57eebacfd67200d8
|
||||||
|
CMAKE_OPTION -DFLATBUFFERS_BUILD_TESTS=OFF )
|
||||||
|
|
||||||
|
include_directories(${flatbuffers_INC})
|
||||||
|
add_library(mindspore::flatbuffers ALIAS flatbuffers::flatbuffers)
|
||||||
|
add_executable(mindspore::flatc ALIAS flatbuffers::flatc)
|
||||||
|
include_directories(${flatbuffers_INC})
|
||||||
|
function(ms_build_flatbuffers source_schema_files
|
||||||
|
source_schema_dirs
|
||||||
|
custom_target_name
|
||||||
|
generated_output_dir)
|
||||||
|
|
||||||
|
set(total_schema_dirs "")
|
||||||
|
set(total_generated_files "")
|
||||||
|
set(FLATC mindspore::flatc)
|
||||||
|
foreach (schema_dir ${source_schema_dirs})
|
||||||
|
set(total_schema_dirs -I ${schema_dir} ${total_schema_dirs})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
foreach(schema ${source_schema_files})
|
||||||
|
get_filename_component(filename ${schema} NAME_WE)
|
||||||
|
if (NOT ${generated_output_dir} STREQUAL "")
|
||||||
|
set(generated_file ${generated_output_dir}/${filename}_generated.h)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${generated_file}
|
||||||
|
COMMAND ${FLATC} --gen-mutable
|
||||||
|
--reflect-names --gen-object-api -o ${generated_output_dir}
|
||||||
|
${total_schema_dirs}
|
||||||
|
-c -b --reflect-types ${schema}
|
||||||
|
DEPENDS ${FLATC} ${schema}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
COMMENT "Running C++ flatbuffers compiler on ${schema}" VERBATIM)
|
||||||
|
list(APPEND total_generated_files ${generated_file})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
add_custom_target(${custom_target_name} ALL
|
||||||
|
DEPENDS ${total_generated_files})
|
||||||
|
|
||||||
|
if (NOT ${generated_output_dir} STREQUAL "")
|
||||||
|
include_directories(${generated_output_dir})
|
||||||
|
set_property(TARGET ${custom_target_name}
|
||||||
|
PROPERTY GENERATED_OUTPUT_DIR
|
||||||
|
${generated_output_dir})
|
||||||
|
endif()
|
||||||
|
endfunction()
|
@ -0,0 +1,10 @@
|
|||||||
|
set(glog_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_CXX_FLAGS}")
|
||||||
|
set(glog_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||||
|
mindspore_add_pkg(glog
|
||||||
|
VER 0.4.0
|
||||||
|
LIBS glog
|
||||||
|
URL https://github.com/google/glog/archive/v0.4.0.tar.gz
|
||||||
|
MD5 0daea8785e6df922d7887755c3d100d0
|
||||||
|
CMAKE_OPTION -DBUILD_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON)
|
||||||
|
include_directories(${glog_INC})
|
||||||
|
add_library(mindspore::glog ALIAS glog::glog)
|
@ -0,0 +1,13 @@
|
|||||||
|
set(gtest_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||||
|
set(gtest_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||||
|
mindspore_add_pkg(gtest
|
||||||
|
VER 1.8.0
|
||||||
|
LIBS gtest
|
||||||
|
URL https://github.com/google/googletest/archive/release-1.8.0.tar.gz
|
||||||
|
MD5 16877098823401d1bf2ed7891d7dce36
|
||||||
|
CMAKE_OPTION -DBUILD_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON
|
||||||
|
-DCMAKE_MACOSX_RPATH=TRUE -Dgtest_disable_pthreads=ON)
|
||||||
|
include_directories(${gtest_INC})
|
||||||
|
add_library(mindspore::gtest ALIAS gtest::gtest)
|
||||||
|
file(COPY ${gtest_LIBPATH}/libgtest.so DESTINATION ${CMAKE_BINARY_DIR}/googletest/googlemock/gtest)
|
||||||
|
file(COPY ${gtest_LIBPATH}/libgtest_main.so DESTINATION ${CMAKE_BINARY_DIR}/googletest/googlemock/gtest)
|
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
set(jpeg_turbo_USE_STATIC_LIBS ON)
|
||||||
|
set(jpeg_turbo_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -D_FORTIFY_SOURCE=2 -O2")
|
||||||
|
set(jpeg_turbo_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
|
||||||
|
mindspore_add_pkg(jpeg_turbo
|
||||||
|
VER 2.0.4
|
||||||
|
LIBS jpeg
|
||||||
|
URL https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.0.4.tar.gz
|
||||||
|
MD5 44c43e4a9fb352f47090804529317c88
|
||||||
|
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_RPATH=TRUE
|
||||||
|
)
|
||||||
|
include_directories(${jpeg_turbo_INC})
|
||||||
|
add_library(mindspore::jpeg_turbo ALIAS jpeg_turbo::jpeg)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue