From 0e9008640449b83adf4c3cf8bc12bec3f3d1f3a8 Mon Sep 17 00:00:00 2001 From: kangguangli Date: Tue, 14 Mar 2023 11:16:49 +0800 Subject: [PATCH] [BugFix] fix install_check failure when multi cpu but no gloo (#51482) * fix install_check failure when multi cpu but no gloo * fix: raise error when multi-card check fails --- python/paddle/utils/install_check.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/python/paddle/utils/install_check.py b/python/paddle/utils/install_check.py index 77c0cc6d391..ad88aaaa577 100644 --- a/python/paddle/utils/install_check.py +++ b/python/paddle/utils/install_check.py @@ -272,7 +272,7 @@ def run_check(): device_list = paddle.static.npu_places() else: device_str = "CPU" - device_list = paddle.static.cpu_places(device_count=2) + device_list = paddle.static.cpu_places(device_count=1) device_count = len(device_list) _run_static_single(use_cuda, use_xpu, use_npu) @@ -280,12 +280,13 @@ def run_check(): print("PaddlePaddle works well on 1 {}.".format(device_str)) try: - _run_parallel(device_list) - print( - "PaddlePaddle works well on {} {}s.".format( - device_count, device_str + if len(device_list) > 1: + _run_parallel(device_list) + print( + "PaddlePaddle works well on {} {}s.".format( + device_count, device_str + ) ) - ) print( "PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now." ) @@ -307,3 +308,4 @@ def run_check(): device_str ) ) + raise e -- GitLab