Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
push github from f4e1320
Browse files Browse the repository at this point in the history
  • Loading branch information
liujunjie03 committed Apr 15, 2019
1 parent d6632f5 commit f1bf52a
Show file tree
Hide file tree
Showing 949 changed files with 94,029 additions and 31,760 deletions.
82 changes: 55 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ include(cmake/msg_color.cmake)
include(cmake/utils.cmake)
include(cmake/statistic.cmake)

set(CMAKE_EXPORT_COMPILE_COMMANDS YES)

# ----------------------------------------------------------------------------
# section: global anakin version and lib name
# ----------------------------------------------------------------------------
cmake_minimum_required(VERSION ${MIN_CMAKE_V} FATAL_ERROR)

# global anakin version 1.0.0
# global anakin version 1.1.0
set(VERSION_MAJOR "1")
set(VERSION_MINOR "0")
set(VERSION_MINOR "1")
set(VERSION_PATCH "0")
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")



# anakin lib name and global directories
set(anakin_lib_so "anakin")
set(anakin_lib_static "anakin_static")
Expand All @@ -48,6 +48,7 @@ set(ANAKIN_SABER ${ANAKIN_ROOT}/saber)
set(ANAKIN_LITE_SABER ${ANAKIN_SABER}/lite)
set(ANAKIN_UNIT_TEST ${ANAKIN_ROOT}/test)
set(ANAKIN_EXAMPLES ${ANAKIN_ROOT}/examples)
set(ANAKIN_SGX ${ANAKIN_ROOT}/sgx)


# ----------------------------------------------------------------------------
Expand All @@ -59,27 +60,39 @@ anakin_option(ANAKIN_TYPE_FP32 "define the FP32 for data precision." YES)
anakin_option(ANAKIN_TYPE_FP16 "define the FP16 for data precision." NO)
anakin_option(ANAKIN_TYPE_INT8 "define the INT8 for data precision." NO)

#select the plantform to build
#select the platform to build
anakin_option(USE_GPU_PLACE "Select the build mode for GPU place." YES)
anakin_option(USE_X86_PLACE "Select the build mode for X86 place." YES)
anakin_option(USE_ARM_PLACE "Select the build mode for ARM place." NO)
anakin_option(USE_BM_PLACE "Select the build mode for BM place." NO)

# plantfrom details
anakin_option(USE_SGX "Enbale Anakin to run in Intel SGX secure enclave." NO)
anakin_option(USE_MLU_PLACE "Select the build mode for MLU place." NO)

if(USE_SGX)
if(NOT USE_X86_PLACE OR USE_GPU_PLACE)
set(USE_SGX NO)
endif()
endif()

# platform details
anakin_option(NVIDIA_GPU "Use NVIDIA GPU place." YES if USE_GPU_PLACE)
anakin_option(AMD_GPU "Use AMD GPU place." NO if USE_GPU_PLACE AND NOT NVIDIA_GPU)
anakin_option(TARGET_ANDROID "build for android" YES if USE_ARM_PLACE)
anakin_option(TARGET_IOS "not supported now" YES if USE_ARM_PLACE AND NOT TARGET_ANDROID)

# compile options for Cambricon MLU place
anakin_option(USE_MLU "Use MLU libs." YES if USE_MLU_PLACE)
anakin_option(USE_BANG "Use Bang." NO)

# compile options for NVIDIA_GPU place
anakin_option(USE_CUDA "Use Cuda libs." YES if NVIDIA_GPU)
anakin_option(USE_CUBLAS "Use Cublas libs." YES if USE_CUDA)
anakin_option(USE_CURAND "Use Curand libs." YES if USE_CUDA)
anakin_option(USE_CUFFT "Use CuFFT libs." YES if USE_CUDA)
anakin_option(USE_CUDNN "Use Cudnn libs." YES if USE_CUDA)
anakin_option(USE_TENSORRT "Use tensorrt for inference." NO)
anakin_option(BUILD_CROSS_PLANTFORM "Build anakin lib for any nvidia device plantform." YES if USE_CUDA)
anakin_option(BUILD_FAT_BIN "Build anakin cuda fat-bin lib for all device plantform" NO if BUILD_CROSS_PLANTFORM)
anakin_option(BUILD_CROSS_PLANTFORM "Build anakin lib for any nvidia device platform." YES if USE_CUDA)
anakin_option(BUILD_FAT_BIN "Build anakin cuda fat-bin lib for all device platform" YES if BUILD_CROSS_PLANTFORM)

if (NOT DEFINED AK_OUTPUT_PATH)
set(AK_OUTPUT_PATH "output")
Expand All @@ -91,7 +104,9 @@ if((NOT BUILD_FAT_BIN) AND (NOT BUILD_CROSS_PLANTFORM) AND USE_CUDA)
endif()

if(USE_X86_PLACE)
if(NOT DEFINED BUILD_X86_TARGET)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(BUILD_X86_ARCH "clang_native")
elseif(NOT DEFINED BUILD_X86_TARGET)
set(BUILD_X86_ARCH "native")
anakin_get_cpu_arch(BUILD_X86_ARCH)
else()
Expand All @@ -105,27 +120,31 @@ anakin_option(BUILD_CUBIN "BUILD with the -cubin option in Device mode" NO if US
anakin_option(COMPILE_PTX "Returns a list of PTX files generated from src." NO if USE_CUDA)

# common build options
anakin_option(ENABLE_DEBUG "Enable DEBUG(default) mode." YES)
anakin_option(ENABLE_DEBUG "Enable DEBUG(default) mode." NO)
anakin_option(RECORD_TENSOR_IN_NET "Enable Tensor Recored in DEBUG mode." NO)
anakin_option(ENABLE_VERBOSE_MSG "Enable verbose=1 : compile msg during make." NO)
anakin_option(DISABLE_ALL_WARNINGS "Disable all the warning msg during compile." YES)
anakin_option(ENABLE_NOISY_WARNINGS "Enable noisy warning msg during compile." NO if DISABLE_ALL_WARNINGS)
anakin_option(ENABLE_MIN_DEPENDENCY "Enable minimum dependency of third party library" NO)

# using 3rd party libs
# SGX options
anakin_option(SGX_SIM_MODE "Build Anakin to run in software-emulated SGX mode." YES if ENABLE_DEBUG)

# using 3rd party libs
anakin_option(USE_LOGGER "Build native logger components." YES)
anakin_option(USE_GLOG "Build Glog components." NO if NOT USE_LOGGER)
anakin_option(USE_PROTOBUF "Build Google protobuf components." YES)
anakin_option(USE_NANOPB "Use nanopb, a light-weight C implementation of protobuf" YES if USE_SGX)
anakin_option(USE_PROTOBUF "Build Google protobuf components." YES if NOT USE_NANOPB)
anakin_option(USE_OPENCV "Use static opencv libs." NO)
anakin_option(USE_BOOST "Use static BOOST libs." NO)
anakin_option(USE_OPENMP "Use Openmp when in android environment." YES if TARGET_ANDROID)
anakin_option(USE_OPENMP "Use Openmp when in android environment." YES if TARGET_ANDROID OR (USE_X86_PLACE AND NOT USE_SGX))
anakin_option(USE_GTEST "Use googletest libs." NO if BUILD_WITH_UNIT_TEST)
anakin_option(USE_PYTHON "Generate py wrappers." NO)
anakin_option(USE_OPENCL "Use OpenCL ." YES if AMD_GPU)
anakin_option(USE_GFLAGS "Build Google gflags components." NO)
anakin_option(USE_MKL "Use mkl libs." NO if USE_X86_PLACE)
anakin_option(USE_MKLML "Use MKLML libs." YES if USE_X86_PLACE)
anakin_option(USE_MKL "Use mkl libs." YES if USE_SGX)
anakin_option(USE_MKLML "Use MKLML libs." YES if USE_X86_PLACE AND NOT USE_SGX)
anakin_option(USE_XBYAK "Use XBYAK libs." YES if USE_X86_PLACE)
anakin_option(USE_OPENMP "Use Openmp when in android environment." YES if TARGET_ANDROID)

# build components
anakin_option(BUILD_WITH_UNIT_TEST "Build anakin unit test components." YES)
Expand All @@ -139,12 +158,12 @@ anakin_option(BUILD_LITE "Build anakin lite components." NO if BUILD_WITH_FRAMEW
anakin_option(BUILD_EXAMPLES "build detection and classification examples" NO)

# build target
anakin_option(BUILD_SHARED "Build anakin shared lib." YES)
anakin_option(BUILD_SHARED "Build anakin shared lib." YES if NOT (USE_SGX OR BUILD_WITH_STATIC))
anakin_option(BUILD_STATIC "Build anakin static lib." YES if NOT BUILD_SHARED)

anakin_option(ENABLE_OP_TIMER "Enable op timer mode." NO)

if(ENABLE_MIN_DEPENDENCY)
anakin_option(ENABLE_OP_TIMER "Enable op timer mode." NO)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND ENABLE_MIN_DEPENDENCY)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--version-script,${ANAKIN_ROOT}/cmake/ak_link.lds")
endif()

Expand All @@ -157,7 +176,7 @@ else()
set(CMAKE_BUILD_TYPE Release FORCE)
endif()

if(USE_LOGGER)
if(USE_LOGGER)
anakin_option(ENABLE_STACKTRACES "If enable local logger with stacktrace." YES if NOT USE_ARM_PLACE)
anakin_option(SUPPORT_PTHREADS "If enable local logger with supporting pthreads. " YES)
endif()
Expand Down Expand Up @@ -189,14 +208,21 @@ if(USE_CUDA)
include(cmake/external/sass.cmake)
endif()

if(USE_MLU)
include(cmake/mlu.cmake)
include(cmake/external/cnrtml.cmake)
endif()

if(USE_X86_PLACE)
if(USE_MKLML)
include(cmake/external/mklml.cmake)
endif()
if(USE_XBYAK)
include(cmake/external/xbyak.cmake)
endif()
#include(cmake/external/mkldnn.cmake)
if(NOT USE_SGX)
include(cmake/external/mkldnn.cmake)
endif()
endif()

if(AMD_GPU)
Expand All @@ -208,19 +234,18 @@ include(cmake/gather.cmake)


# ----------------------------------------------------------------------------
# section: build and install anakin
# section: build and install anakin
# ----------------------------------------------------------------------------
# add source sub_directory whick holds the cmake build module
# fetch files of model_parser
add_subdirectory(${ANAKIN_SABER})

if(BUILD_WITH_FRAMEWORK)
add_subdirectory(${ANAKIN_MODEL_PARSER})
add_subdirectory(${ANAKIN_FRAMEWORK})
if(BUILD_RPC)
add_subdirectory(${ANAKIN_SERVICE})
if(BUILD_RPC)
add_subdirectory(${ANAKIN_SERVICE})
endif()
if(BUILD_LITE)
if(BUILD_LITE)
add_subdirectory(${ANAKIN_LITE_FRAMEWORK})
endif()
endif()
Expand All @@ -235,6 +260,9 @@ if (BUILD_EXAMPLES)
endif()
endif()

if (USE_SGX)
add_subdirectory(${ANAKIN_SGX})
endif()
anakin_print_statistic()


Expand Down
Loading

0 comments on commit f1bf52a

Please sign in to comment.