From 4d5ddbf106f93901ddab62f0ced57ca395b57e3f Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Wed, 30 Sep 2020 13:00:23 +0800 Subject: [PATCH] add xpu test (#27622) * add xpu test * notest;add kunlun_test * notest;add kunlun_test * notest;test=kunlun * notest;test=kunlun * notest;test=kunlun * notest;test=kunlun * test=kunlun --- paddle/scripts/paddle_build.sh | 54 ++++++++++++++++++- .../fluid/tests/unittests/CMakeLists.txt | 4 ++ .../fluid/tests/unittests/xpu/CMakeLists.txt | 6 +++ ...vation_op.py => test_activation_op_xpu.py} | 0 ...d_op.py => test_elementwise_add_op_xpu.py} | 0 ...est_matmul_op.py => test_matmul_op_xpu.py} | 0 .../{test_mul_op.py => test_mul_op_xpu.py} | 0 7 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 python/paddle/fluid/tests/unittests/xpu/CMakeLists.txt rename python/paddle/fluid/tests/unittests/xpu/{test_activation_op.py => test_activation_op_xpu.py} (100%) rename python/paddle/fluid/tests/unittests/xpu/{test_elementwise_add_op.py => test_elementwise_add_op_xpu.py} (100%) rename python/paddle/fluid/tests/unittests/xpu/{test_matmul_op.py => test_matmul_op_xpu.py} (100%) rename python/paddle/fluid/tests/unittests/xpu/{test_mul_op.py => test_mul_op_xpu.py} (100%) diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 69303013d2..a05761ea6d 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -246,6 +246,7 @@ function cmake_base() { -DWITH_GRPC=${grpc_flag} -DWITH_GLOO=${gloo_flag} -DWITH_LITE=${WITH_LITE:-OFF} + -DWITH_XPU=${WITH_XPU:-OFF} -DLITE_GIT_TAG=develop ======================================== EOF @@ -277,6 +278,7 @@ EOF -DWITH_GRPC=${grpc_flag} \ -DWITH_GLOO=${gloo_flag} \ -DLITE_GIT_TAG=develop \ + -DWITH_XPU=${WITH_XPU:-OFF} \ -DWITH_LITE=${WITH_LITE:-OFF};build_error=$? if [ "$build_error" != 0 ];then exit 7; @@ -895,7 +897,11 @@ function card_test() { case_count $1 $2 ut_startTime_s=`date +%s` # get the CUDA device count - CUDA_DEVICE_COUNT=$(nvidia-smi -L | wc -l) + if [ "${WITH_XPU}" == "ON" ];then + CUDA_DEVICE_COUNT=4 + else + CUDA_DEVICE_COUNT=$(nvidia-smi -L | wc -l) + fi testcases=$1 if (( $# > 1 )); then @@ -1163,6 +1169,41 @@ EOF fi } +function parallel_test_base_xpu() { + mkdir -p ${PADDLE_ROOT}/build + cd ${PADDLE_ROOT}/build + if [ ${WITH_TESTING:-ON} == "ON" ] ; then + cat <