CMakeLists.txt 3.5 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
function(gserver_test TARGET)
  add_unittest_without_exec(${TARGET}
      ${TARGET}.cpp
      LayerGradUtil.cpp)
  add_test(NAME ${TARGET}
      COMMAND ${TARGET})
endfunction()

17 18 19 20 21
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/concat_dotmul_a.conf
    COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_target(copy_gserver_conf ALL DEPENDS concat_dotmul_a.conf)

22 23 24 25 26 27 28 29 30 31 32 33
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 已提交
34
gserver_test(test_MaxPoolingWithMaskOutput)
35
gserver_test(test_Upsample)
Z
zhangjinchao01 已提交
36

37 38
set(PYTHON_PATH 
   ${PADDLE_SOURCE_DIR}/paddle/.set_python_path.sh -d 
X
Xin Pan 已提交
39
   ${PADDLE_BINARY_DIR}/python/:${PADDLE_BINARY_DIR}/paddle/legacy/gserver/tests)
40
function(gserver_test_with_python TARGET)
41 42 43
  add_unittest_without_exec(${TARGET} ${TARGET}.cpp)
  add_test(NAME ${TARGET}
    COMMAND ${PYTHON_PATH} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}
44
      WORKING_DIRECTORY ${PADDLE_BINARY_DIR}/paddle/)
45 46
endfunction()

47
gserver_test_with_python(test_PyDataProvider2)
48
if(WITH_PYTHON)
49
    gserver_test_with_python(test_PyDataProvider)
50 51
endif()
if(NOT MOBILE_INFERENCE)
52
    gserver_test_with_python(test_CompareTwoNets)
53
    # TODO(yuyang18): There is some bug in test_RecurrentGradientMachine, I will fix it.
54
    gserver_test_with_python(test_RecurrentGradientMachine)
55 56
endif()

T
tensor-tang 已提交
57
########## test_MKLDNN layers and activations ##########
T
tensor-tang 已提交
58
if(WITH_MKLDNN)
59 60 61
    add_unittest_without_exec(test_MKLDNN
        test_MKLDNN.cpp
        MKLDNNTester.cpp
T
tensor-tang 已提交
62
        LayerGradUtil.cpp)
63
    add_test(NAME test_MKLDNN
64
        COMMAND ${PYTHON_PATH} ${CMAKE_CURRENT_BINARY_DIR}/test_MKLDNN
65
            WORKING_DIRECTORY ${PADDLE_BINARY_DIR}/paddle)
T
tensor-tang 已提交
66 67
endif()

68
############### test_WarpCTCLayer #######################
69
if(NOT WITH_DOUBLE AND NOT MOBILE_INFERENCE)
70
    add_unittest_without_exec(test_WarpCTCLayer
71
        test_WarpCTCLayer.cpp)
72
    add_test(NAME test_WarpCTCLayer
L
liaogang 已提交
73
        COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_WarpCTCLayer --warpctc_dir=${WARPCTC_LIB_DIR}
74
        WORKING_DIRECTORY ${PADDLE_BINARY_DIR}/paddle)
75 76
endif()

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

L
Luo Tao 已提交
94
    ############ test_CompareSparse ################
95 96 97 98
    add_unittest_without_exec(test_CompareSparse
        test_CompareSparse.cpp)
    if(NOT ON_TRAVIS)
      add_test(NAME test_CompareSparse
99
        COMMAND ${PYTHON_PATH} ${PADDLE_SOURCE_DIR}/paddle/.set_port.sh -p port -n 6
L
Luo Tao 已提交
100
                ${CMAKE_CURRENT_BINARY_DIR}/test_CompareSparse
101
        WORKING_DIRECTORY ${PADDLE_BINARY_DIR}/paddle/)
102
    endif()
103
endif()