Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into nb_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xidulu committed Aug 4, 2020
2 parents 04ca1ba + 95fa63f commit 78c1c6b
Show file tree
Hide file tree
Showing 339 changed files with 3,421 additions and 11,345 deletions.
52 changes: 20 additions & 32 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,33 @@

# The checks defined here will be run and will display by default as warnings.
Checks: >
-*, cppcoreguidelines-c-copy-assignment-signature,
cppcoreguidelines-interfaces-global-init, cppcoreguidelines-no-malloc,
cppcoreguidelines-pro-bounds-constant-array-index, cppcoreguidelines-pro-type-const-cast,
cppcoreguidelines-pro-type-cstyle-cast, cppcoreguidelines-pro-type-member-init,
cppcoreguidelines-pro-type-static-cast-downcast, cppcoreguidelines-pro-type-union-access,
cppcoreguidelines-pro-type-vararg, cppcoreguidelines-slicing,
cppcoreguidelines-special-member-functions, clang-analyzer-security.FloatLoopCounter,
clang-analyzer-security.insecureAPI.*, clang-analyzer-core.CallAndMessage,
clang-analyzer-core.DivideZero, clang-analyzer-core.DynamicTypePropagation,
clang-analyzer-core.NonNullParamChecker, clang-analyzer-core.NullDereference,
clang-analyzer-core.StackAddressEscape, clang-analyzer-core.UndefinedBinaryOperatorResult,
clang-analyzer-core.VLASize, clang-analyzer-core.builtin.BuiltinFunctions,
clang-analyzer-core.builtin.NoReturnFunctions, clang-analyzer-core.uninitialized.ArraySubscript,
clang-analyzer-core.uninitialized.Assign, clang-analyzer-core.uninitialized.Branch,
clang-analyzer-core.uninitialized.CapturedBlockVariable,
clang-analyzer-core.uninitialized.UndefReturn, clang-analyzer-cplusplus.NewDelete,
clang-analyzer-cplusplus.NewDeleteLeaks, clang-analyzer-cplusplus.SelfAssignment,
clang-analyzer-deadcode.DeadStores, modernize-avoid-bind, modernize-deprecated-headers,
modernize-loop-convert, modernize-make-shared, modernize-pass-by-value,
-*, cppcoreguidelines-* clang-analyzer-*, modernize-*,
performance-faster-string-find, performance-for-range-copy,
performance-implicit-conversion-in-loop, performance-inefficient-algorithm,
performance-inefficient-string-concatenation, performance-trivially-destructible,
performance-inefficient-vector-operation, performance-move-const-arg,
performance-move-constructor-init, performance-noexcept-move-constructor,
performance-no-automatic-move, performance-unnecessary-copy-initialization,
performance-type-promotion-in-math-fn
# performance checks not enabled due to segmentation fault in clang-tidy v8+:
# performance-unnecessary-value-param

# In order to trigger an error, you must have a rule defined both in checks and in this section.
WarningsAsErrors: >
cppcoreguidelines-no-malloc, modernize-deprecated-headers,
modernize-loop-convert, modernize-make-shared, modernize-pass-by-value, modernize-make-unique,
modernize-raw-string-literal, modernize-redundant-void-arg, modernize-replace-auto-ptr,
modernize-replace-random-shuffle, modernize-return-braced-init-list, modernize-shrink-to-fit,
modernize-unary-static-assert, modernize-use-bool-literals, modernize-use-default-member-init,
modernize-use-emplace, modernize-use-equals-default, modernize-use-equals-delete,
modernize-use-noexcept, modernize-use-nullptr, modernize-use-override,
modernize-use-transparent-functors, modernize-use-using, performance-*
modernize-use-transparent-functors, modernize-use-using,
performance-unnecessary-copy-initialization, performance-move-const-arg
# cppcoreguidelines checks not enabled:
# cppcoreguidelines-pro-bounds-pointer-arithmetic
# cppcoreguidelines-pro-bounds-array-to-pointer-decay
# cppcoreguidelines-pro-type-reinterpret-cast

# modernize checks not enabled:
# modernize checks not enforced:
# modernize-use-auto
# modernize-make-unique (C++14 and newer only)

# In order to trigger an error, you must have a rule defined both in checks and in this section.
WarningsAsErrors: >
cppcoreguidelines-no-malloc, modernize-use-nullptr, performance-unnecessary-copy-initialization,
modernize-use-emplace, performance-move-const-arg
# modernize-avoid-bind

# Todo: define a better regex match that includes most project headers, but excludes third party
# code.
Expand Down
5 changes: 0 additions & 5 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ coverage:
round: down
range: "70...100"

status:
project: yes
patch: yes
changes: no

parsers:
gcov:
branch_detection:
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Greetings

on: [pull_request, issues]

jobs:
greeting:
runs-on: ubuntu-latest
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: |
Welcome to Apache MXNet (incubating)! We are on a mission to democratize AI, and we are glad that you are contributing to it by opening this issue.
Please make sure to include all the relevant context, and one of the @apache/mxnet-committers will be here shortly.
If you are interested in contributing to our project, let us know! Also, be sure to check out our guide on [contributing to MXNet](https://mxnet.apache.org/community/contribute) and our [development guides wiki](https://cwiki.apache.org/confluence/display/MXNET/Developments).
pr-message: |
Welcome to Apache MXNet (incubating)! We are on a mission to democratize AI, and we are glad that you are contributing to it by opening this pull request.
Please make sure that the changes are covered by tests. One of the @apache/mxnet-committers will be here shortly.
If you run into any issue with the CI and tests, we recommend that you first check out our guide on [developer guides wiki](https://cwiki.apache.org/confluence/display/MXNET/Developments).
Let our @apache/mxnet-committers know if you need any help!
2 changes: 1 addition & 1 deletion 3rdparty/nvidia_cub
Submodule nvidia_cub updated 105 files
2 changes: 1 addition & 1 deletion 3rdparty/onnx-tensorrt
Submodule onnx-tensorrt updated 63 files
+1 −0 .gitmodules
+46 −177 CMakeLists.txt
+0 −91 Dockerfile
+0 −101 FancyActivation.cu
+0 −142 FancyActivation.hpp
+187 −70 ImporterContext.hpp
+0 −185 InstanceNormalization.cpp
+0 −133 InstanceNormalization.hpp
+607 −517 ModelImporter.cpp
+60 −46 ModelImporter.hpp
+8 −6 NvOnnxParser.cpp
+46 −21 NvOnnxParser.h
+0 −29 NvOnnxParserRuntime.cpp
+0 −85 NvOnnxParserRuntime.h
+0 −30 NvOnnxParserTypedefs.h
+306 −56 OnnxAttrs.cpp
+37 −21 OnnxAttrs.hpp
+0 −57 PluginFactory.cpp
+0 −59 PluginFactory.hpp
+56 −35 README.md
+0 −120 ResizeNearest.cu
+0 −108 ResizeNearest.hpp
+361 −0 ShapeTensor.cpp
+155 −0 ShapeTensor.hpp
+85 −99 ShapedWeights.cpp
+17 −19 ShapedWeights.hpp
+0 −133 Split.cu
+0 −112 Split.hpp
+175 −78 Status.hpp
+78 −40 TensorOrWeights.hpp
+3,646 −1,808 builtin_op_importers.cpp
+2 −1 builtin_op_importers.hpp
+0 −38 builtin_plugins.cpp
+0 −32 builtin_plugins.hpp
+25 −1 common.hpp
+1 −7 contributing.md
+70 −0 docker/onnx-tensorrt-deb.Dockerfile
+80 −0 docker/onnx-tensorrt-tar.Dockerfile
+6 −1 getSupportedAPITest.cpp
+0 −9 libnvonnxparser_runtime.version
+66 −3 main.cpp
+0 −60 nv_onnx_runtime_bindings.i
+32 −17 onnx2trt.hpp
+43 −30 onnx2trt_common.hpp
+3 −3 onnx2trt_runtime.hpp
+1,684 −54 onnx2trt_utils.cpp
+236 −375 onnx2trt_utils.hpp
+155 −150 onnx_backend_test.py
+27 −49 onnx_tensorrt/backend.py
+30 −0 onnx_tensorrt/config.py
+64 −78 onnx_tensorrt/tensorrt_engine.py
+53 −10 onnx_trt_backend.cpp
+130 −44 onnx_utils.hpp
+162 −138 operators.md
+0 −175 plugin.cpp
+0 −183 plugin.hpp
+0 −27 plugin_common.hpp
+0 −125 serialize.hpp
+30 −14 setup.py
+1 −1 third_party/onnx
+73 −56 toposort.hpp
+149 −198 trt_utils.hpp
+1 −1 utils.hpp
90 changes: 34 additions & 56 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ option(USE_JEMALLOC "Build with Jemalloc support" OFF)
option(USE_LIBJPEG_TURBO "Use libjpeg-turbo" OFF)
option(USE_DIST_KVSTORE "Build with DIST_KVSTORE support" OFF)
option(USE_PLUGINS_WARPCTC "Use WARPCTC Plugins" OFF)
option(USE_PLUGIN_CAFFE "Use Caffe Plugin" OFF)
option(USE_CPP_PACKAGE "Build C++ Package" OFF)
option(USE_MXNET_LIB_NAMING "Use MXNet library naming conventions." ON)
option(USE_GPROF "Compile with gprof (profiling) flag" OFF)
Expand All @@ -90,6 +89,7 @@ cmake_dependent_option(ENABLE_TESTCOVERAGE "Enable compilation with test coverag
option(USE_INT64_TENSOR_SIZE "Use int64_t to represent the total number of elements in a tensor" OFF)
option(BUILD_CYTHON_MODULES "Build cython modules." OFF)
option(LOG_FATAL_THROW "Log exceptions but do not abort" ON)
option(USE_CXX11_ABI "Build with GLIBCXX_USE_CXX11_ABI" ON)
cmake_dependent_option(USE_SPLIT_ARCH_DLL "Build a separate DLL for each Cuda arch (Windows only)." ON "MSVC" OFF)
cmake_dependent_option(USE_CCACHE "Attempt using CCache to wrap the compilation" ON "UNIX" OFF)

Expand All @@ -100,6 +100,12 @@ message(STATUS "CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}")

message(STATUS "CMAKE_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}")

if(USE_CXX11_ABI)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1)
else()
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
endif()

if(USE_TVM_OP)
add_definitions(-DMXNET_USE_TVM_OP=1)
endif()
Expand Down Expand Up @@ -142,12 +148,15 @@ else()
execute_process(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE SYSTEM_ARCHITECTURE)
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Distribution" AND UNIX AND NOT APPLE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
set(CMAKE_INSTALL_RPATH $\{ORIGIN\})
# Enforce DT_PATH instead of DT_RUNPATH
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--disable-new-dtags")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--disable-new-dtags")
if(CMAKE_BUILD_TYPE STREQUAL "Distribution")
if(UNIX AND NOT APPLE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
set(CMAKE_INSTALL_RPATH $\{ORIGIN\})
# Enforce DT_PATH instead of DT_RUNPATH
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--disable-new-dtags")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--disable-new-dtags")
endif()
set(Protobuf_USE_STATIC_LIBS ON)
endif()

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/upstream;${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules;${CMAKE_MODULE_PATH}")
Expand Down Expand Up @@ -229,6 +238,7 @@ if(USE_TENSORRT)
include_directories(3rdparty/onnx-tensorrt/third_party/onnx/)
add_definitions(-DMXNET_USE_TENSORRT=1)
add_definitions(-DONNX_NAMESPACE=onnx)
add_definitions(-DONNX_ML=1)

find_package(Protobuf REQUIRED)

Expand All @@ -238,14 +248,11 @@ if(USE_TENSORRT)
find_library(ONNX_PROTO_LIBRARY NAMES libonnx_proto.so REQUIRED
PATHS ${ONNX_PATH}
DOC "Path to onnx_proto library.")
find_library(ONNX_TRT_RUNTIME_LIBRARY NAMES libnvonnxparser_runtime.so REQUIRED
PATHS ${ONNX_TRT_PATH}
DOC "Path to onnx_proto library.")
find_library(ONNX_TRT_PARSER_LIBRARY NAMES libnvonnxparser.so REQUIRED
PATHS ${ONNX_TRT_PATH}
DOC "Path to onnx_proto library.")
DOC "Path to onnx_proto parser library.")

list(APPEND mxnet_LINKER_LIBS libnvinfer.so ${ONNX_TRT_PARSER_LIBRARY} ${ONNX_TRT_RUNTIME_LIBRARY}
list(APPEND mxnet_LINKER_LIBS libnvinfer.so ${ONNX_TRT_PARSER_LIBRARY}
${ONNX_PROTO_LIBRARY} ${ONNX_LIBRARY} ${PROTOBUF_LIBRARY})
endif()

Expand Down Expand Up @@ -276,6 +283,7 @@ if(USE_MKLDNN)
include_directories(${PROJECT_BINARY_DIR}/3rdparty/mkldnn/include)
add_definitions(-DMXNET_USE_MKLDNN=1)
list(APPEND mxnet_LINKER_LIBS dnnl)
set_target_properties(dnnl PROPERTIES CXX_CLANG_TIDY "") # don't lint 3rdparty dependency
endif()

# Allow Cuda compiles outside of src tree to find things in 'src' and 'include'
Expand All @@ -299,7 +307,6 @@ foreach(var ${C_CXX_INCLUDE_DIRECTORIES})
endforeach()

include_directories("include")
include_directories("3rdparty/nvidia_cub")
include_directories("3rdparty/tvm/nnvm/include")
include_directories("3rdparty/tvm/include")
include_directories("3rdparty/dmlc-core/include")
Expand Down Expand Up @@ -407,6 +414,7 @@ if(USE_OPENMP)
AND NOT CMAKE_CROSSCOMPILING)
load_omp()
list(APPEND mxnet_LINKER_LIBS omp)
set_target_properties(omp PROPERTIES CXX_CLANG_TIDY "") # don't lint 3rdparty dependency
if(UNIX)
list(APPEND mxnet_LINKER_LIBS pthread)
endif()
Expand Down Expand Up @@ -464,6 +472,8 @@ set(GTEST_MAIN_LIBRARY gtest_main)
set(GTEST_LIBRARY gtest)

add_subdirectory(${GTEST_ROOT})
set_target_properties(gtest PROPERTIES CXX_CLANG_TIDY "") # don't lint 3rdparty dependency
set_target_properties(gtest_main PROPERTIES CXX_CLANG_TIDY "") # don't lint 3rdparty dependency
find_package(GTest REQUIRED)

# cudnn detection
Expand All @@ -480,6 +490,7 @@ endif()

if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/dmlc-core/cmake)
add_subdirectory("3rdparty/dmlc-core")
set_target_properties(dmlc PROPERTIES CXX_CLANG_TIDY "") # don't lint 3rdparty dependency
endif()

FILE(GLOB_RECURSE SOURCE "src/*.cc" "src/*.h" "include/*.h")
Expand All @@ -494,7 +505,9 @@ FILE(GLOB_RECURSE NNVMSOURCE
3rdparty/tvm/nnvm/src/core/*.h
3rdparty/tvm/nnvm/src/pass/*.h
3rdparty/tvm/nnvm/include/*.h)
list(APPEND SOURCE ${NNVMSOURCE})
add_library(nnvm OBJECT ${NNVMSOURCE})
set_target_properties(nnvm PROPERTIES CXX_CLANG_TIDY "") # don't lint 3rdparty dependency
list(APPEND SOURCE $<TARGET_OBJECTS:nnvm>)

# add source group
FILE(GLOB_RECURSE GROUP_SOURCE "src/*.cc" "3rdparty/tvm/nnvm/*.cc" "plugin/*.cc")
Expand All @@ -521,39 +534,6 @@ if(USE_OPERATOR_TUNING AND USE_OPENMP)
add_definitions(-DMXNET_USE_OPERATOR_TUNING=1)
endif()

if(USE_PLUGIN_CAFFE)
if(NOT USE_CUDA)
set(CPU_ONLY ON)
add_definitions(-DCPU_ONLY=1)
endif()
if(NOT DEFINED CAFFE_PATH)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/caffe)
set(CAFFE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/caffe)
else()
set(CAFFE_PATH $ENV{CAFFE_PATH})
endif()
endif()
list(APPEND CMAKE_MODULE_PATH ${CAFFE_PATH}/cmake)
include_directories(${CAFFE_PATH}/include)
include_directories(${CAFFE_PATH}/build/src)
include_directories(${CMAKE_BINARY_DIR}/caffe/include)
link_directories(${CAFFE_PATH}/build/lib)
if(NOT DEFINED CAFFE_PATH)
message(FATAL_ERROR "Please set CAFFE_PATH to point to the caffe source installation")
endif()
FILE(GLOB_RECURSE PLUGINS_SOURCE "plugin/caffe/*.cc" "plugin/caffe/*.h")
FILE(GLOB_RECURSE PLUGINS_CUSRC "plugin/caffe/*.cu")
list(APPEND SOURCE ${PLUGINS_SOURCE})
list(APPEND CUDA ${PLUGINS_CUSRC})
include_directories(${CMAKE_BINARY_DIR}/include)
add_definitions(-DMXNET_USE_CAFFE=1)
list(APPEND mxnet_LINKER_LIBS
protobuf boost_system boost_thread boost_filesystem
gflags glog caffe
${Caffe_LINKER_LIBS}
)
endif()

if (NOT (EXTRA_OPERATORS STREQUAL ""))
mxnet_source_group("Extra" GLOB_RECURSE "${EXTRA_OPERATORS}/*.cc")
mxnet_source_group("Extra\\Cuda" GLOB_RECURSE "${EXTRA_OPERATORS}/*.cu")
Expand Down Expand Up @@ -640,14 +620,10 @@ if(USE_CUDA)
link_directories(${CUDAToolkit_LIBRARY_DIR})
endif()

# unsupported: if caffe is a subdirectory of mxnet, load its CMakeLists.txt as well
if(USE_PLUGIN_CAFFE)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/caffe)
add_subdirectory(caffe)
endif()
if(CUDAToolkit_VERSION_MAJOR LESS "11")
include_directories("3rdparty/nvidia_cub")
endif()


if(MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /EHsc")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /EHsc /Gy")
Expand All @@ -674,7 +650,6 @@ if(UNIX)
endif()
target_link_libraries(mxnet PUBLIC mshadow)
target_link_libraries(mxnet PUBLIC ${CMAKE_DL_LIBS})
target_compile_definitions(mxnet PUBLIC DMLC_LOG_FATAL_THROW=$<BOOL:${LOG_FATAL_THROW}>)
if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
target_compile_options(mxnet PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-Werror>")
# Ignore erroneous compiler warnings:
Expand All @@ -701,7 +676,6 @@ elseif(MSVC)
foreach(arch ${arch_code_list})
add_library(mxnet_${arch} SHARED ${SOURCE})
target_link_libraries(mxnet_${arch} PUBLIC mshadow)
target_compile_definitions(mxnet_${arch} PUBLIC DMLC_LOG_FATAL_THROW=$<BOOL:${LOG_FATAL_THROW}>)
target_compile_options(
mxnet_${arch}
PRIVATE
Expand Down Expand Up @@ -737,10 +711,10 @@ elseif(MSVC)
endif(USE_SPLIT_ARCH_DLL)
else()
add_library(mxnet SHARED ${SOURCE})
target_compile_definitions(mxnet PUBLIC DMLC_LOG_FATAL_THROW=$<BOOL:${LOG_FATAL_THROW}>)
target_link_libraries(mxnet PUBLIC mshadow)
endif()
endif()
target_compile_definitions(mxnet PUBLIC DMLC_LOG_FATAL_THROW=$<BOOL:${LOG_FATAL_THROW}>)

# extension libraries (custom operators, custom subgraphs) are built by default
add_library(customop_lib SHARED ${CMAKE_CURRENT_SOURCE_DIR}/example/extensions/lib_custom_op/gemm_lib.cc)
Expand Down Expand Up @@ -782,6 +756,7 @@ if(USE_DIST_KVSTORE)
add_subdirectory("3rdparty/ps-lite")
add_definitions(-DMXNET_USE_DIST_KVSTORE)
list(APPEND mxnet_LINKER_LIBS pslite)
set_target_properties(pslite PROPERTIES CXX_CLANG_TIDY "") # don't lint 3rdparty dependency
endif()

if(USE_MKLDNN)
Expand All @@ -796,6 +771,9 @@ function(BuildTVMOP)
# scope the variables in BuildTVM.cmake to avoid conflict
include(cmake/BuildTVM.cmake)
add_subdirectory("3rdparty/tvm")
set_target_properties(tvm PROPERTIES CXX_CLANG_TIDY "") # don't lint 3rdparty dependency
set_target_properties(tvm_topi PROPERTIES CXX_CLANG_TIDY "") # don't lint 3rdparty dependency
set_target_properties(tvm_runtime PROPERTIES CXX_CLANG_TIDY "") # don't lint 3rdparty dependency
endfunction()

if(USE_TVM_OP)
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ List of Contributors
* [Connor Goggins](https://github.com/connorgoggins)
* [Wei Chu](https://github.com/waytrue17)
* [Yang Shi](https://github.com/ys2843)
* [Joe Evans](https://github.com/josephevans)

Label Bot
---------
Expand Down
Loading

0 comments on commit 78c1c6b

Please sign in to comment.