CMakeLists.txt 2.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# 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.
#

16 17 18
if(APPLE)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=pessimizing-move")
endif(APPLE)
19

Y
Yiqun Liu 已提交
20 21
add_subdirectory(details)

22
if(WITH_MKLDNN)
23
  set(mkldnn_quantizer_src ${CMAKE_CURRENT_SOURCE_DIR}/mkldnn_quantizer.cc)
24 25
  set(mkldnn_quantizer_cfg mkldnn_quantizer_config)
  cc_library(${mkldnn_quantizer_cfg} SRCS mkldnn_quantizer_config.cc DEPS lod_tensor paddle_pass_builder)
26 27
  set(mkldnn_quantizer_src_file ${mkldnn_quantizer_src} PARENT_SCOPE)
  set(mkldnn_quantizer_cfg ${mkldnn_quantizer_cfg} PARENT_SCOPE)
28 29 30
endif()

cc_library(analysis_config SRCS analysis_config.cc DEPS ${mkldnn_quantizer_cfg} lod_tensor paddle_pass_builder)
31
cc_library(paddle_pass_builder SRCS paddle_pass_builder.cc)
32 33 34 35 36 37 38 39 40 41 42 43

cc_library(paddle_inference_api SRCS api.cc api_impl.cc helper.cc DEPS lod_tensor scope reset_tensor_array 
          analysis_config zero_copy_tensor trainer_desc_proto)

set(inference_deps ${analysis_deps} paddle_inference_api analysis naive_executor ${GLOB_PASS_LIB})

if(WITH_GPU AND TENSORRT_FOUND)
    set(inference_deps ${inference_deps} tensorrt_engine tensorrt_converter)
endif()

cc_library(analysis_predictor SRCS analysis_predictor.cc ${mkldnn_quantizer_src} DEPS ${inference_deps} 
          zero_copy_tensor ir_pass_manager op_compatible_info)
44

45
cc_test(test_paddle_inference_api SRCS api_tester.cc DEPS paddle_inference_api)
X
Xin Pan 已提交
46

47 48 49 50
if(WITH_TESTING)
  inference_base_test(test_api_impl SRCS api_impl_tester.cc DEPS ${inference_deps}
                      ARGS --word2vec_dirname=${WORD2VEC_MODEL_DIR} --book_dirname=${PYTHON_TESTS_DIR}/book)
  set_tests_properties(test_api_impl PROPERTIES DEPENDS test_image_classification)
51
  set_tests_properties(test_api_impl PROPERTIES LABELS "RUN_TYPE=DIST")
52
endif()
Y
Yan Chunwei 已提交
53
cc_test(test_analysis_predictor SRCS analysis_predictor_tester.cc DEPS analysis_predictor benchmark ${inference_deps}
T
Tao Luo 已提交
54
        ARGS --dirname=${WORD2VEC_MODEL_DIR})