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

fix memory share from system in graph stream analysis. #289

Open
wants to merge 17 commits into
base: developing
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ set(ANAKIN_FRAMEWORK ${ANAKIN_ROOT}/framework)
set(ANAKIN_LITE_FRAMEWORK ${ANAKIN_FRAMEWORK}/lite)
set(ANAKIN_UTILS ${ANAKIN_ROOT}/utils)
set(ANAKIN_THIRD_PARTY_PATH ${ANAKIN_ROOT}/third-party)
set(ANAKIN_TEMP_THIRD_PARTY_PATH ${CMAKE_BINARY_DIR}/third-party)
set(ANAKIN_MODEL_PARSER ${ANAKIN_FRAMEWORK}/model_parser)
set(ANAKIN_SERVICE ${ANAKIN_FRAMEWORK}/service)
set(ANAKIN_SABER ${ANAKIN_ROOT}/saber)
set(ANAKIN_LITE_SABER ${ANAKIN_SABER}/lite)
set(ANAKIN_UNIT_TEST ${ANAKIN_ROOT}/test)
Expand Down Expand Up @@ -91,7 +93,7 @@ anakin_option(COMPILE_PTX "Returns a list of PTX files generated from src." NO i


# common build options
anakin_option(ENABLE_DEBUG "Enable DEBUG(default) mode." NO)
anakin_option(ENABLE_DEBUG "Enable DEBUG(default) mode." YES)
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)
Expand All @@ -116,6 +118,8 @@ anakin_option(BUILD_WITH_UNIT_TEST "Build anakin unit test components." YES)

anakin_option(BUILD_LITE "Build anakin lite components." NO)

anakin_option(BUILD_RPC "Build anakin rpc service components." YES)

# build examples
anakin_option(BUILD_EXAMPLES "build detection and classification examples" NO)

Expand Down Expand Up @@ -164,7 +168,6 @@ if(USE_CUDA)
endif()

if(USE_X86_PLACE)
set(ANAKIN_TEMP_THIRD_PARTY_PATH ${CMAKE_BINARY_DIR}/third-party)
if(USE_MKLML)
include(cmake/external/mklml.cmake)
endif()
Expand All @@ -185,6 +188,9 @@ include(cmake/gather.cmake)
# fetch files of model_parser
add_subdirectory(${ANAKIN_MODEL_PARSER})
add_subdirectory(${ANAKIN_SABER})
if(BUILD_RPC)
add_subdirectory(${ANAKIN_SERVICE})
endif()
add_subdirectory(${ANAKIN_FRAMEWORK})

if(BUILD_WITH_UNIT_TEST)
Expand All @@ -201,6 +207,3 @@ endif()

anakin_print_statistic()


#set(executable_output_path ${PROJECT_BINARY_DIR}/unit_test)

1 change: 1 addition & 0 deletions cmake/compiler_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ if(USE_CUDA)
anakin_add_compile_option(-G NVCC)
anakin_add_compile_option(-g NVCC)
anakin_add_compile_option(-std=c++11 NVCC)
anakin_add_compile_option("--default-stream per-thread" NVCC)
anakin_add_compile_option(-Wno-deprecated-gpu-targets NVCC) # suppress warning by architectures are deprecated (2.0,2.1)
else()
anakin_add_compile_option("-Xcompiler -fPIC" NVCC)
Expand Down
5 changes: 4 additions & 1 deletion cmake/cuda.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ endmacro()
# ----------------------------------------------------------------------------
macro(anakin_find_cudnn)
set(CUDNN_ROOT "" CACHE PATH "CUDNN root dir.")
find_path(CUDNN_INCLUDE_DIR cudnn.h PATHS ${CUDNN_ROOT} ${CUDNN_ROOT}/include
find_path(CUDNN_INCLUDE_DIR cudnn.h PATHS ${CUDNN_ROOT}
$ENV{CUDNN_ROOT}
$ENV{CUDNN_ROOT}/include
$ENV{CUDNN_INCLUDE_DIR}
Expand Down Expand Up @@ -147,6 +147,9 @@ macro(anakin_find_cuda)
if(USE_CURAND)
list(APPEND ANAKIN_LINKER_LIBS ${CUDA_curand_LIBRARY})
endif()
if(BUILD_RPC)
list(APPEND ANAKIN_LINKER_LIBS ${CUDA_INCLUDE_DIRS}/../lib64/stubs/libnvidia-ml.so)
endif()
list(APPEND ANAKIN_LINKER_LIBS ${CUDA_CUDART_LIBRARY})
else()
message(FATAL_ERROR "Cuda SHARED lib Could not found !")
Expand Down
4 changes: 0 additions & 4 deletions cmake/external/mklml.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#===============================================================================
anakin_find_mklml()
if(MKLML_FOUND)
return()
endif()

# download mklml package is only for iomp so far
include(ExternalProject)
Expand Down
39 changes: 26 additions & 13 deletions cmake/find_modules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -235,19 +235,18 @@ macro(anakin_find_gtest)
endif()
endmacro()


macro(anakin_find_gflags)
set(GFLAGS_INCLUDE_DIR ${ANAKIN_ROOT}/third-party/gflags/include)
find_library(GFLAGS_LIBRARY NAMES libgflags.so
PATHS ${GFLAGS_INCLUDE_DIR}/../lib
DOC "library path for gflags.")
if(GFLAGS_INCLUDE_DIR AND GFLAGS_LIBRARY)
set(GFLAGS_FOUND TRUE)
endif()
if(GFLAGS_FOUND)
message(STATUS "Found gflags in ${GFLAGS_INCLUDE_DIR}")
include_directories(${GFLAGS_INCLUDE_DIR})
list(APPEND ANAKIN_LINKER_LIBS ${GFLAGS_LIBRARY})
macro(anakin_find_google_flags)
set(GFLAGS_ROOT_DIR "/usr/include" CACHE PATH "gflags path")
find_path(GFLAGS_INCLUDE_DIRS gflags/gflags.h PATHS ${GFLAGS_ROOT_DIR})

find_library(GFLAGS_LIBRARIES NAMES libgflags.so
PATHS ${GFLAGS_ROOT_DIR}/../lib64
DOC "library path for gflags.")
if(GFLAGS_INCLUDE_DIRS AND GFLAGS_LIBRARIES)
include_directories(SYSTEM ${GFLAGS_INCLUDE_DIRS})
list(APPEND ANAKIN_DEMO_LIBRARIES ${GFLAGS_LIBRARIES})
else()
message(SEND_ERROR "Could not found gflags !")
endif()
endmacro()

Expand Down Expand Up @@ -328,6 +327,20 @@ macro(anakin_find_protobuf)
endif()
endmacro()

macro(anakin_find_baidu_rpc)
set(BAIDU_RPC_ROOT "/usr/local/" CACHE PATH "baidu rpc root dir")
find_path(RPC_INCLUDE_DIR server.h PATHS ${BAIDU_RPC_ROOT}/include/brpc/ $ENV{BAIDU_RPC_ROOT}/include/brpc/)
find_library(RPC_LIBRARY NAMES libbrpc.so
PATHS ${BAIDU_RPC_ROOT}/lib $ENV{BAIDU_RPC_ROOT}/include/brpc/
DOC "library path for baidu rpc.")
if(RPC_INCLUDE_DIR AND RPC_LIBRARY)
include_directories(${BAIDU_RPC_ROOT}/include)
list(APPEND ANAKIN_LINKER_LIBS ${RPC_LIBRARY})
else()
message(SEND_ERROR "Could not found baidu-rpc !")
endif()
endmacro()

macro(anakin_find_openmp)
find_package(OpenMP REQUIRED)
if(OPENMP_FOUND OR OpenMP_CXX_FOUND)
Expand Down
6 changes: 5 additions & 1 deletion cmake/gather.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ if(USE_PROTOBUF)
anakin_protos_processing()
endif()

if(BUILD_RPC)
anakin_find_baidu_rpc()
endif()

if (USE_GFLAGS)
anakin_find_gflags()
anakin_find_google_flags()
endif()

if(USE_MKL)
Expand Down
72 changes: 40 additions & 32 deletions cmake/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -239,31 +239,26 @@ endfunction()
# ----------------------------------------------------------------------------
# section: generate the protobuf .h and .cpp files.
# ----------------------------------------------------------------------------
function(anakin_protos_processing)
set(PROTO_SRC_PATH ${ANAKIN_MODEL_PARSER}/proto)
set(__working_dir ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PROTO_TEMP/)

anakin_fetch_files_with_suffix(${PROTO_SRC_PATH} "proto" PROTO_SRC_FILES)
foreach(__file ${PROTO_SRC_FILES})
exec_program(${PROTOBUF_PROTOC_EXECUTABLE} ${__working_dir} ARGS " -I=${PROTO_SRC_PATH} --cpp_out=. ${__file}"
OUTPUT_VARIABLE OUTPUT
RETURN_VALUE VALUE)
if(NOT VALUE)
anakin_fetch_files_with_suffix(${__working_dir} "h" PROTO_GENERATE_H)
# get *.cpp or *.cc
anakin_fetch_files_with_suffix(${__working_dir} "c*" PROTO_GENERATE_C)
foreach(__include_file ${PROTO_GENERATE_H})
exec_program(mv ARGS ${__include_file} ${PROTO_SRC_PATH}
OUTPUT_VARIABLE __out
RETURN_VALUE __value)
endforeach()
foreach(__src_file ${PROTO_GENERATE_C})
if(POLICY CMP0007)
cmake_policy(PUSH)
cmake_policy(SET CMP0007 NEW)
endif()
string(REPLACE "." ";" SRC_LIST ${__src_file})
list(GET SRC_LIST -1 __src_file_name_suffix)
function(anakin_gen_pb proto_src_path)
set(__working_dir ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PROTO_TEMP/)
foreach(__proto_file ${ARGN})
exec_program(${PROTOBUF_PROTOC_EXECUTABLE} ${__working_dir} ARGS " -I=${proto_src_path} --cpp_out=. ${__proto_file}"
OUTPUT_VARIABLE OUTPUT RETURN_VALUE VALUE)
if(NOT VALUE)
anakin_fetch_files_with_suffix(${__working_dir} "h" PROTO_GENERATE_H)
# get *.cpp or *.cc
anakin_fetch_files_with_suffix(${__working_dir} "c*" PROTO_GENERATE_C)
foreach(__include_file ${PROTO_GENERATE_H})
exec_program(mv ARGS ${__include_file} ${proto_src_path}
OUTPUT_VARIABLE __out RETURN_VALUE __value)
endforeach()
foreach(__src_file ${PROTO_GENERATE_C})
if(POLICY CMP0007)
cmake_policy(PUSH)
cmake_policy(SET CMP0007 NEW)
endif()
string(REPLACE "." ";" SRC_LIST ${__src_file})
list(GET SRC_LIST -1 __src_file_name_suffix)
list(GET SRC_LIST -3 __src_file_name)

string(REPLACE "/" ";" SRC_LIST_PATH ${__src_file_name})
Expand All @@ -274,18 +269,31 @@ function(anakin_protos_processing)
else()
set(__full_src_filename "${__pure_src_file_name}.pb.cc")
endif()
#message(STATUS " first ---> ${__working_dir}${__full_src_filename} ${ANAKIN_ROOT}/src/${__pure_src_file_name}.pb.cpp")
exec_program(mv ARGS " ${__working_dir}${__full_src_filename} ${PROTO_SRC_PATH}/${__pure_src_file_name}.pb.cpp"
exec_program(mv ARGS " ${__working_dir}${__full_src_filename} ${proto_src_path}/${__pure_src_file_name}.pb.cpp"
OUTPUT_VARIABLE __out
RETURN_VALUE __value)
if(POLICY CMP0007)
cmake_policy(POP)
endif()
endforeach()
else()
message(FATAL_ERROR "anakin_protos_processing : ${__file} \n error msg: ${OUTPUT}")
endif()
endforeach()
endforeach()
else()
message(FATAL_ERROR "anakin_gen_bp: ${__file} \n error msg: ${OUTPUT}")
endif()
endforeach()
endfunction()

function(anakin_protos_processing)
set(PROTO_SRC_PATH ${ANAKIN_MODEL_PARSER}/proto)
set(SERVICE_API_SRC_PATH ${ANAKIN_SERVICE}/api)

set(__working_dir ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PROTO_TEMP/)

anakin_fetch_files_with_suffix(${PROTO_SRC_PATH} "proto" PROTO_SRC_FILES)
anakin_fetch_files_with_suffix(${SERVICE_API_SRC_PATH} "proto" SERVICE_API_PROTO_SRC_FILES)
anakin_gen_pb(${PROTO_SRC_PATH} ${PROTO_SRC_FILES})
if(BUILD_RPC)
anakin_gen_pb(${SERVICE_API_SRC_PATH} ${SERVICE_API_PROTO_SRC_FILES})
endif()
endfunction()

# ----------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,3 @@ if(UNIX OR APPLE)
PATTERN "*.inl")
endif()
endif()
install(FILES ${CMAKE_BINARY_DIR}/anakin_config.h DESTINATION ${PROJECT_SOURCE_DIR}/output/)
Loading