From 7c2ef43090ef5b85d3e169c494510785ab86d574 Mon Sep 17 00:00:00 2001 From: kosipov Date: Sat, 17 Oct 2026 08:45:04 +0200 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20lec1/simple=5Frun.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lec1/simple_run.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lec1/simple_run.py b/lec1/simple_run.py index afb94be..07d5b58 100644 --- a/lec1/simple_run.py +++ b/lec1/simple_run.py @@ -3,12 +3,11 @@ from bench import bench from mc_parallel import estimate_pi_parallel N_PER_WORKER = 5_000_000 # объём работы на одного исполнителя if __name__ == "__main__": - print(" p N T(p), с E_weak") - for p in [1, 2, 4, 6, 8, 10]: - n = N_PER_WORKER * p # задача растёт вместе с числом процессов - with ProcessPoolExecutor(max_workers=p) as pool: - tp, _, _ = bench(estimate_pi_parallel, n, pool, p) -9 - if p == 1: - t_base = tp - print(f"{p:2d} {n:10_d} {tp:7.2f} {t_base / tp:6.2f}") + print(" p N T(p), с E_weak") + for p in [1, 2, 4, 6, 8, 10]: + n = N_PER_WORKER * p # задача растёт вместе с числом процессов + with ProcessPoolExecutor(max_workers=p) as pool: + tp, _, _ = bench(estimate_pi_parallel, n, pool, p) + if p == 1: + t_base = tp + print(f"{p:2d} {n:10_d} {tp:7.2f} {t_base / tp:6.2f}")