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

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

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
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)
Z
zhangjinchao01 已提交
27

T
tensor-tang 已提交
28 29
########## test_Mkldnn layers and activations ##########
if(WITH_MKLDNN)
30 31 32
    add_unittest_without_exec(test_MKLDNN
        test_MKLDNN.cpp
        MKLDNNTester.cpp
T
tensor-tang 已提交
33
        LayerGradUtil.cpp)
34 35 36 37
    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 已提交
38 39
endif()

Z
zhangjinchao01 已提交
40 41 42
############## test_PyDataProvider ########################
if(WITH_PYTHON)
    add_unittest_without_exec(test_PyDataProvider
43
        test_PyDataProvider.cpp)
Z
zhangjinchao01 已提交
44 45

    add_test(NAME test_PyDataProvider
46 47
        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 已提交
48 49
endif()

50 51
############### test_WarpCTCLayer #######################
if(NOT WITH_DOUBLE)
52
    add_unittest_without_exec(test_WarpCTCLayer
53
        test_WarpCTCLayer.cpp)
54 55

    add_test(NAME test_WarpCTCLayer
L
liaogang 已提交
56
        COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_WarpCTCLayer --warpctc_dir=${WARPCTC_LIB_DIR}
57
        WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}/paddle)
58 59
endif()

H
hedaoyuan 已提交
60
if(NOT MOBILE_INFERENCE)
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
################## 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 已提交
77 78 79 80 81 82 83 84 85 86 87
    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 已提交
88 89 90 91 92 93 94
endif()


add_unittest_without_exec(test_PyDataProvider2
        test_PyDataProvider2.cpp)

add_test(NAME test_PyDataProvider2
95 96
   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 已提交
97
)
98 99 100 101 102 103 104 105 106 107 108 109

################# 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()