CMakeLists.txt 3.2 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)
30
gserver_test(test_Upsample)
Z
zhangjinchao01 已提交
31

32 33 34
set(PYTHON_PATH 
   ${PADDLE_SOURCE_DIR}/paddle/.set_python_path.sh -d 
   ${PADDLE_SOURCE_DIR}/python/:${PADDLE_SOURCE_DIR}/paddle/gserver/tests)
35
function(gserver_test_with_python TARGET)
36 37 38 39 40 41
  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()

42
gserver_test_with_python(test_PyDataProvider2)
43
if(WITH_PYTHON)
44
    gserver_test_with_python(test_PyDataProvider)
45 46
endif()
if(NOT MOBILE_INFERENCE)
47
    gserver_test_with_python(test_CompareTwoNets)
48
    # TODO(yuyang18): There is some bug in test_RecurrentGradientMachine, I will fix it.
49
    gserver_test_with_python(test_RecurrentGradientMachine)
50 51
endif()

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

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

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

L
Luo Tao 已提交
89
    ############ test_CompareSparse ################
90 91 92 93
    add_unittest_without_exec(test_CompareSparse
        test_CompareSparse.cpp)
    if(NOT ON_TRAVIS)
      add_test(NAME test_CompareSparse
L
Luo Tao 已提交
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()
98
endif()