From eff8e974cb348e088d70b8dd7ddaff68fedc3f3b Mon Sep 17 00:00:00 2001 From: Bo Zhou <2466956298@qq.com> Date: Mon, 19 Aug 2019 11:16:28 +0800 Subject: [PATCH] Unittest in parallel (#135) * upgrade unit test to reduce test time * minor change * fix the bug in unit tests * fix the bug in build.sh * Update build.sh * Update test.sh * fix a potential bug that will hung the test * then * solve the problem in documentation --- .teamcity/Dockerfile | 8 +- .teamcity/build.sh | 52 +++++++--- CMakeLists.txt | 33 +++---- docs/test.sh | 1 + parl/remote/job.py | 14 ++- parl/remote/tests/cluster_monitor_2_test.py | 95 ++++++++++++++++++ parl/remote/tests/cluster_monitor_3_test.py | 96 +++++++++++++++++++ parl/remote/tests/cluster_monitor_test.py | 54 ----------- parl/remote/tests/cluster_test.py | 5 +- .../cluster_multiprocessing_1_test.py} | 54 +---------- .../cluster_multiprocessing_2_test.py | 84 ++++++++++++++++ .../cluster_multiprocessing_test.py | 84 ++++++++++++++++ parl/remote/tests/reset_job_test.py | 23 +---- parl/remote/tests/reset_job_test_alone.py | 85 ++++++++++++++++ 14 files changed, 516 insertions(+), 172 deletions(-) create mode 100644 parl/remote/tests/cluster_monitor_2_test.py create mode 100644 parl/remote/tests/cluster_monitor_3_test.py rename parl/remote/tests/{cluster_multiprocessing_test.py => multiprocessing/cluster_multiprocessing_1_test.py} (60%) create mode 100644 parl/remote/tests/multiprocessing/cluster_multiprocessing_2_test.py create mode 100644 parl/remote/tests/multiprocessing/cluster_multiprocessing_test.py create mode 100644 parl/remote/tests/reset_job_test_alone.py diff --git a/.teamcity/Dockerfile b/.teamcity/Dockerfile index da98d19..3530626 100644 --- a/.teamcity/Dockerfile +++ b/.teamcity/Dockerfile @@ -15,12 +15,6 @@ # A dev image based on paddle production image -FROM parl/parl-test:1.1-cuda9.0-cudnn7-docs +FROM parl/parl-test:cuda9.0-cudnn7-v1 COPY ./requirements.txt /root/ - -# Requirements for python2 -RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r /root/requirements.txt - -# Requirements for python3 -RUN pip3.6 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r /root/requirements.txt diff --git a/.teamcity/build.sh b/.teamcity/build.sh index 7267776..1382e68 100755 --- a/.teamcity/build.sh +++ b/.teamcity/build.sh @@ -21,6 +21,8 @@ function init() { NONE='\033[0m' REPO_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}")/../" && pwd )" + source ~/.bashrc + export PATH="/root/miniconda3/bin:$PATH" } function print_usage() { @@ -56,7 +58,8 @@ function check_style() { } function run_test_with_gpu() { - export FLAGS_fraction_of_gpu_memory_to_use=0.5 + unset CUDA_VISIBLE_DEVICES + export FLAGS_fraction_of_gpu_memory_to_use=0.05 mkdir -p ${REPO_ROOT}/build cd ${REPO_ROOT}/build @@ -66,7 +69,8 @@ function run_test_with_gpu() { Running unit tests with GPU... ======================================== EOF - ctest --output-on-failure + ctest --output-on-failure -j10 + cd ${REPO_ROOT} rm -rf ${REPO_ROOT}/build } @@ -75,13 +79,22 @@ function run_test_with_cpu() { mkdir -p ${REPO_ROOT}/build cd ${REPO_ROOT}/build - cmake .. + if [ $# -eq 1 ];then + cmake .. + else + cmake .. -DIS_TESTING_SERIALLY=ON + fi cat <