|
|
@ -1,13 +1,26 @@
|
|
|
|
|
|
|
|
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
if(WITH_TESTING)
|
|
|
|
if(WITH_TESTING)
|
|
|
|
include(tests/test.cmake) # some generic cmake funtion for inference
|
|
|
|
include(tests/test.cmake) # some generic cmake funtion for inference
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
set(FLUID_CORE_MODULES proto_desc memory lod_tensor executor data_feed_proto)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO(panyx0718): Should this be called paddle_fluid_inference_api_internal?
|
|
|
|
# TODO(panyx0718): Should this be called paddle_fluid_inference_api_internal?
|
|
|
|
cc_library(paddle_fluid_api
|
|
|
|
cc_library(paddle_fluid_api
|
|
|
|
SRCS io.cc
|
|
|
|
SRCS io.cc
|
|
|
|
DEPS ${FLUID_CORE_MODULES} ${GLOB_OP_LIB} ${GLOB_OPERATOR_DEPS})
|
|
|
|
DEPS paddle_framework ${GLOB_OP_LIB} ${GLOB_OPERATOR_DEPS})
|
|
|
|
|
|
|
|
|
|
|
|
# analysis and tensorrt must be added before creating static library,
|
|
|
|
# analysis and tensorrt must be added before creating static library,
|
|
|
|
# otherwise, there would be undefined reference to them in static library.
|
|
|
|
# otherwise, there would be undefined reference to them in static library.
|
|
|
@ -25,19 +38,9 @@ if (WITH_LITE)
|
|
|
|
add_subdirectory(lite)
|
|
|
|
add_subdirectory(lite)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# fluid_modules exclude API-interface of inference/api and inference/capi
|
|
|
|
get_property(fluid_modules GLOBAL PROPERTY FLUID_MODULES)
|
|
|
|
get_property(fluid_modules GLOBAL PROPERTY FLUID_MODULES)
|
|
|
|
get_property(cuda_modules GLOBAL PROPERTY CUDA_MODULES)
|
|
|
|
get_property(cuda_modules GLOBAL PROPERTY CUDA_MODULES)
|
|
|
|
get_property(fluid_third_partys GLOBAL PROPERTY FLUID_THRID_PARTYS)
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
|
|
|
|
list(APPEND fluid_third_partys gflags glog protobuf cblas)
|
|
|
|
|
|
|
|
endif(WIN32)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# paddle_fluid_origin exclude inference api interface
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
|
|
|
|
sep_library(paddle_fluid_origin DEPS ${fluid_modules} paddle_fluid_api)
|
|
|
|
|
|
|
|
else(WIN32)
|
|
|
|
|
|
|
|
cc_library(paddle_fluid_origin DEPS ${fluid_modules} paddle_fluid_api)
|
|
|
|
|
|
|
|
endif(WIN32)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_subdirectory(api)
|
|
|
|
add_subdirectory(api)
|
|
|
|
add_subdirectory(capi)
|
|
|
|
add_subdirectory(capi)
|
|
|
@ -54,47 +57,35 @@ if(NOT ON_INFER)
|
|
|
|
return()
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
if(WITH_MKLDNN)
|
|
|
|
# Create static inference library if needed
|
|
|
|
set(mkldnn_quantizer_src ${CMAKE_CURRENT_SOURCE_DIR}/api/mkldnn_quantizer.cc)
|
|
|
|
# All static libs in inference/api
|
|
|
|
set(mkldnn_quantizer_cfg mkldnn_quantizer_config)
|
|
|
|
set(STATIC_INFERENCE_API paddle_inference_api analysis_predictor zero_copy_tensor reset_tensor_array
|
|
|
|
|
|
|
|
analysis_config paddle_pass_builder activation_functions ${mkldnn_quantizer_cfg})
|
|
|
|
|
|
|
|
create_static_lib(paddle_fluid ${fluid_modules} ${STATIC_INFERENCE_API})
|
|
|
|
|
|
|
|
if(NOT APPLE)
|
|
|
|
|
|
|
|
# TODO(liuyiqu: Temporarily disable the link flag because it is not support on Mac.
|
|
|
|
|
|
|
|
set(LINK_FLAGS "-Wl,--retain-symbols-file ${CMAKE_CURRENT_SOURCE_DIR}/paddle_fluid.sym")
|
|
|
|
|
|
|
|
set_target_properties(paddle_fluid PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
set(STATIC_INFERENCE_APIS paddle_fluid_api paddle_inference_api analysis_predictor)
|
|
|
|
if(ANAKIN_FOUND)
|
|
|
|
if (ANAKIN_FOUND)
|
|
|
|
|
|
|
|
set(ANAKIN_SHARED_INFERENCE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/api/api_anakin_engine.cc)
|
|
|
|
set(ANAKIN_SHARED_INFERENCE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/api/api_anakin_engine.cc)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
set(SHARED_INFERENCE_SRCS
|
|
|
|
set(SHARED_INFERENCE_SRCS
|
|
|
|
io.cc ${CMAKE_CURRENT_SOURCE_DIR}/../framework/data_feed.cc ${CMAKE_CURRENT_SOURCE_DIR}/../framework/data_set.cc ${CMAKE_CURRENT_SOURCE_DIR}/../framework/data_feed_factory.cc ${CMAKE_CURRENT_SOURCE_DIR}/../framework/dataset_factory.cc ${CMAKE_CURRENT_SOURCE_DIR}/api/api.cc ${CMAKE_CURRENT_SOURCE_DIR}/api/api_impl.cc
|
|
|
|
io.cc
|
|
|
|
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../framework/data_feed.cc
|
|
|
|
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../framework/data_feed_factory.cc
|
|
|
|
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../framework/dataset_factory.cc
|
|
|
|
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/api/api.cc
|
|
|
|
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/api/api_impl.cc
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/api/analysis_predictor.cc
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/api/analysis_predictor.cc
|
|
|
|
${mkldnn_quantizer_src}
|
|
|
|
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/api/details/zero_copy_tensor.cc
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/api/details/zero_copy_tensor.cc
|
|
|
|
|
|
|
|
${mkldnn_quantizer_src_file}
|
|
|
|
${ANAKIN_SHARED_INFERENCE_SRCS})
|
|
|
|
${ANAKIN_SHARED_INFERENCE_SRCS})
|
|
|
|
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
# Create shared inference library defaultly
|
|
|
|
sep_library(paddle_fluid DEPS ${fluid_modules} ${STATIC_INFERENCE_APIS} zero_copy_tensor reset_tensor_array
|
|
|
|
cc_library(paddle_fluid_shared SHARED SRCS ${SHARED_INFERENCE_SRCS}
|
|
|
|
analysis_config ${mkldnn_quantizer_cfg} paddle_pass_builder)
|
|
|
|
DEPS ${fluid_modules} analysis_predictor)
|
|
|
|
else(WIN32)
|
|
|
|
|
|
|
|
cc_library(paddle_fluid DEPS ${fluid_modules} ${STATIC_INFERENCE_APIS}
|
|
|
|
|
|
|
|
zero_copy_tensor reset_tensor_array analysis_config ${mkldnn_quantizer_cfg} paddle_pass_builder)
|
|
|
|
|
|
|
|
endif(WIN32)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(NOT APPLE)
|
|
|
|
|
|
|
|
# TODO(liuyiqu: Temporarily disable the link flag because it is not support on Mac.
|
|
|
|
|
|
|
|
set(LINK_FLAGS "-Wl,--retain-symbols-file ${CMAKE_CURRENT_SOURCE_DIR}/paddle_fluid.sym")
|
|
|
|
|
|
|
|
set_target_properties(paddle_fluid PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Create shared library
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
|
|
|
|
sep_library(paddle_fluid_shared SHARED SRCS ${SHARED_INFERENCE_SRCS}
|
|
|
|
|
|
|
|
DEPS ${fluid_modules} paddle_fluid_api reset_tensor_array
|
|
|
|
|
|
|
|
analysis_config ${mkldnn_quantizer_cfg} paddle_pass_builder)
|
|
|
|
|
|
|
|
else(WIN32)
|
|
|
|
|
|
|
|
cc_library(paddle_fluid_shared SHARED SRCS ${SHARED_INFERENCE_SRCS}
|
|
|
|
|
|
|
|
DEPS ${fluid_modules} paddle_fluid_api reset_tensor_array
|
|
|
|
|
|
|
|
analysis_config ${mkldnn_quantizer_cfg} paddle_pass_builder)
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get_property(os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES)
|
|
|
|
get_property(os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES)
|
|
|
|
target_link_libraries(paddle_fluid_shared ${os_dependency_modules})
|
|
|
|
target_link_libraries(paddle_fluid_shared ${os_dependency_modules})
|
|
|
|