CMakeLists.txt 3.1 KB
Newer Older
Z
zhangjinchao01 已提交
1
# gserver pacakge unittests
2 3
add_simple_unittest(test_LinearChainCRF)
add_simple_unittest(test_RecurrentLayer)
Z
zhangjinchao01 已提交
4

5 6
if(NOT MOBILE_INFERENCE)
  add_simple_unittest(test_MultinomialSampler)
H
hedaoyuan 已提交
7
endif()
Z
zhangjinchao01 已提交
8

9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
function(gserver_test TARGET)
  add_unittest_without_exec(${TARGET}
      ${TARGET}.cpp
      LayerGradUtil.cpp)
  add_test(NAME ${TARGET}
      COMMAND ${TARGET})
endfunction()

gserver_test(test_LayerGrad)
gserver_test(test_CRFLayerGrad)
gserver_test(test_CrossEntropyOverBeamGrad)
gserver_test(test_SeqSliceLayerGrad)
gserver_test(test_ActivationGrad)
gserver_test(test_ConvTrans)
gserver_test(test_PriorBox)
gserver_test(test_DetectionOutput)
gserver_test(test_ConvUnify)
gserver_test(test_BatchNorm)
gserver_test(test_KmaxSeqScore)
gserver_test(test_Expand)
X
xzl 已提交
29
gserver_test(test_MaxPoolingWithMaskOutput)
Z
zhangjinchao01 已提交
30

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
set(PYTHON_PATH 
   ${PADDLE_SOURCE_DIR}/paddle/.set_python_path.sh -d 
   ${PADDLE_SOURCE_DIR}/python/:${PADDLE_SOURCE_DIR}/paddle/gserver/tests)
function(gserver_test2 TARGET)
  add_unittest_without_exec(${TARGET} ${TARGET}.cpp)
  add_test(NAME ${TARGET}
    COMMAND ${PYTHON_PATH} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}
      WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}/paddle/)
endfunction()

gserver_test2(test_CompareTwoNets)
gserver_test2(test_PyDataProvider2)
if(WITH_PYTHON)
    gserver_test2(test_PyDataProvider)
endif()
if(NOT MOBILE_INFERENCE)
    # TODO(yuyang18): There is some bug in test_RecurrentGradientMachine, I will fix it.
    gserver_test2(test_RecurrentGradientMachine)
endif()

T
tensor-tang 已提交
51
########## test_MKLDNN layers and activations ##########
T
tensor-tang 已提交
52
if(WITH_MKLDNN)
53 54 55
    add_unittest_without_exec(test_MKLDNN
        test_MKLDNN.cpp
        MKLDNNTester.cpp
T
tensor-tang 已提交
56
        LayerGradUtil.cpp)
57
    add_test(NAME test_MKLDNN
58
        COMMAND ${PYTHON_PATH} ${CMAKE_CURRENT_BINARY_DIR}/test_MKLDNN
59
            WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}/paddle)
T
tensor-tang 已提交
60 61
endif()

62
############### test_WarpCTCLayer #######################
63
if(NOT WITH_DOUBLE AND NOT MOBILE_INFERENCE)
64
    add_unittest_without_exec(test_WarpCTCLayer
65
        test_WarpCTCLayer.cpp)
66
    add_test(NAME test_WarpCTCLayer
L
liaogang 已提交
67
        COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_WarpCTCLayer --warpctc_dir=${WARPCTC_LIB_DIR}
68
        WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}/paddle)
69 70
endif()

H
hedaoyuan 已提交
71
if(NOT MOBILE_INFERENCE)
72 73 74 75 76
################## test_Evaluator #######################
    add_unittest(test_Evaluator
        test_Evaluator.cpp)
      
############### test_NetworkCompare ###############
H
hedaoyuan 已提交
77 78 79
    add_unittest_without_exec(test_NetworkCompare
        test_NetworkCompare.cpp)
    if(WITH_GPU)
80
        set(use_gpu true)
H
hedaoyuan 已提交
81
    else()
82
        set(use_gpu false)
H
hedaoyuan 已提交
83
    endif()
84 85 86
    add_test(NAME test_NetworkCompare
        COMMAND ${PYTHON_PATH} ${CMAKE_CURRENT_BINARY_DIR}/test_NetworkCompare --use_gpu=${use_gpu}
        WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}/paddle)
Z
zhangjinchao01 已提交
87 88
endif()

89 90 91 92 93
################# test_CompareSparse ##################
add_unittest_without_exec(test_CompareSparse
    test_CompareSparse.cpp)
if(NOT ON_TRAVIS)
  add_test(NAME test_CompareSparse
94 95
    COMMAND ${PYTHON_PATH} ./.set_port.sh -p port -n 6
            ${CMAKE_CURRENT_BINARY_DIR}/test_CompareSparse
96 97
    WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}/paddle/)
endif()