CMakeLists.txt 4.5 KB
Newer Older
Z
zhangjinchao01 已提交
1 2
# gserver pacakge unittests

3 4
add_simple_unittest(test_LinearChainCRF)
add_simple_unittest(test_RecurrentLayer)
Z
zhangjinchao01 已提交
5

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

10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
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 已提交
30
gserver_test(test_MaxPoolingWithMaskOutput)
Z
zhangjinchao01 已提交
31

T
tensor-tang 已提交
32
########## test_MKLDNN layers and activations ##########
T
tensor-tang 已提交
33
if(WITH_MKLDNN)
34 35 36
    add_unittest_without_exec(test_MKLDNN
        test_MKLDNN.cpp
        MKLDNNTester.cpp
T
tensor-tang 已提交
37
        LayerGradUtil.cpp)
38 39 40 41
    add_test(NAME test_MKLDNN
        COMMAND .set_python_path.sh -d ${PADDLE_SOURCE_DIR}/python
            ${CMAKE_CURRENT_BINARY_DIR}/test_MKLDNN
            WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}/paddle)
T
tensor-tang 已提交
42 43
endif()

Z
zhangjinchao01 已提交
44 45 46
############## test_PyDataProvider ########################
if(WITH_PYTHON)
    add_unittest_without_exec(test_PyDataProvider
47
        test_PyDataProvider.cpp)
Z
zhangjinchao01 已提交
48 49

    add_test(NAME test_PyDataProvider
50 51
        COMMAND .set_python_path.sh -d ./gserver/tests:${PADDLE_SOURCE_DIR}/python/ ${CMAKE_CURRENT_BINARY_DIR}/test_PyDataProvider
        WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}/paddle)
Z
zhangjinchao01 已提交
52 53
endif()

54
############### test_WarpCTCLayer #######################
55
if(NOT WITH_DOUBLE AND NOT MOBILE_INFERENCE)
56
    add_unittest_without_exec(test_WarpCTCLayer
57
        test_WarpCTCLayer.cpp)
58 59

    add_test(NAME test_WarpCTCLayer
L
liaogang 已提交
60
        COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_WarpCTCLayer --warpctc_dir=${WARPCTC_LIB_DIR}
61
        WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}/paddle)
62 63
endif()

H
hedaoyuan 已提交
64
if(NOT MOBILE_INFERENCE)
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
################## test_Evaluator #######################
    add_unittest(test_Evaluator
        test_Evaluator.cpp)
      
############### test_RecurrentGradientMachine ###############
    # TODO(yuyang18): There is some bug in test_RecurrentGradientMachine
    # I will fix it.
    add_unittest_without_exec(test_RecurrentGradientMachine
        test_RecurrentGradientMachine.cpp)
    add_test(NAME test_RecurrentGradientMachine
        COMMAND .set_python_path.sh -d
                ${PADDLE_SOURCE_DIR}/python:${PADDLE_SOURCE_DIR}/paddle/gserver/tests
                ${CMAKE_CURRENT_BINARY_DIR}/test_RecurrentGradientMachine
        WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}/paddle)
      
############### test_NetworkCompare ###############
H
hedaoyuan 已提交
81 82 83 84 85 86 87 88 89 90 91
    add_unittest_without_exec(test_NetworkCompare
        test_NetworkCompare.cpp)
    if(WITH_GPU)
        add_test(NAME test_NetworkCompare
            COMMAND .set_python_path.sh -d ${PADDLE_SOURCE_DIR}/python ${CMAKE_CURRENT_BINARY_DIR}/test_NetworkCompare --use_gpu=true
            WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}/paddle)
    else()
        add_test(NAME test_NetworkCompare
            COMMAND .set_python_path.sh -d ${PADDLE_SOURCE_DIR}/python ${CMAKE_CURRENT_BINARY_DIR}/test_NetworkCompare --use_gpu=false
            WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}/paddle)
    endif()
Z
zhangjinchao01 已提交
92 93 94 95 96 97 98
endif()


add_unittest_without_exec(test_PyDataProvider2
        test_PyDataProvider2.cpp)

add_test(NAME test_PyDataProvider2
99 100
   COMMAND .set_python_path.sh -d ${PADDLE_SOURCE_DIR}/paddle/gserver/tests:${PADDLE_SOURCE_DIR}/python ${CMAKE_CURRENT_BINARY_DIR}/test_PyDataProvider2
        WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}/paddle
Z
zhangjinchao01 已提交
101
)
102 103 104 105 106 107 108 109 110 111 112 113

################# test_CompareSparse ##################
add_unittest_without_exec(test_CompareSparse
    test_CompareSparse.cpp)
if(NOT ON_TRAVIS)
  add_test(NAME test_CompareSparse
    COMMAND ${PADDLE_SOURCE_DIR}/paddle/.set_python_path.sh -d
          ${PADDLE_SOURCE_DIR}/python:${PADDLE_SOURCE_DIR}/paddle/gserver/tests
              ./.set_port.sh -p port -n 6
                  ${CMAKE_CURRENT_BINARY_DIR}/test_CompareSparse
    WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}/paddle/)
endif()
114 115 116 117 118 119 120 121 122

################ test_CompareTwoNets ######################
add_unittest_without_exec(test_CompareTwoNets
    test_CompareTwoNets.cpp)
add_test(NAME test_CompareTwoNets
  COMMAND ${PADDLE_SOURCE_DIR}/paddle/.set_python_path.sh -d
        ${PADDLE_SOURCE_DIR}/python:${PADDLE_SOURCE_DIR}/paddle/gserver/tests
        ${CMAKE_CURRENT_BINARY_DIR}/test_CompareTwoNets
    WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}/paddle/)