diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index c71ff47e850cf897fa0488a4149c2e52d0f93013..455741c702623a8e5cd62b840bd560d73f0d0111 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -895,7 +895,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=$(xpu_smi -m 2 | wc -l) + else + CUDA_DEVICE_COUNT=$(nvidia-smi -L | wc -l) + fi testcases=$1 if (( $# > 1 )); then @@ -1173,7 +1177,8 @@ function parallel_test_base_xpu() { ======================================== EOF ut_startTime_s=`date +%s` - ctest -R *xpu + exclusive_tests=$(ctest -N |grep "_xpu") # cases list which would be run exclusively + card_test $exclusive_tests 1 ut_endTime_s=`date +%s` echo "XPU testCase Time: $[ $ut_endTime_s - $ut_startTime_s ]s" if [[ "$EXIT_CODE" != "0" ]]; then diff --git a/python/paddle/fluid/tests/unittests/CMakeLists.txt b/python/paddle/fluid/tests/unittests/CMakeLists.txt index 97a3ebc2135a0649fff88e1a1c14d02dfb7850b1..0b06958b9162d7cb2f59557c63e6d9a37492029e 100644 --- a/python/paddle/fluid/tests/unittests/CMakeLists.txt +++ b/python/paddle/fluid/tests/unittests/CMakeLists.txt @@ -546,6 +546,10 @@ add_subdirectory(sequence) add_subdirectory(dygraph_to_static) add_subdirectory(rnn) +if (WITH_XPU) + add_subdirectory(xpu) +endif() + if (WITH_MKLDNN) add_subdirectory(mkldnn) endif()