From 4e975729fc10b92529f692a60dd9fde0f0e64541 Mon Sep 17 00:00:00 2001 From: kosipov Date: Sat, 17 Oct 2026 08:43:47 +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/run=5Fstrong.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lec1/run_strong.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lec1/run_strong.py b/lec1/run_strong.py index 8de8a24..6740725 100644 --- a/lec1/run_strong.py +++ b/lec1/run_strong.py @@ -4,11 +4,11 @@ from mc import estimate_pi_serial from mc_parallel import estimate_pi_parallel N = 20_000_000 if __name__ == "__main__": - t1, _, _ = bench(estimate_pi_serial, N) - print(f"Последовательно: T(1) = {t1:.2f} с") - print(" p T(p), с S(p) E(p)") - for p in [1, 2, 4, 6, 8, 10]: - with ProcessPoolExecutor(max_workers=p) as pool: - tp, _, _ = bench(estimate_pi_parallel, N, pool, p) - s = t1 / tp - print(f"{p:2d} {tp:8.2f} {s:5.2f} {s / p:5.2f}") + t1, _, _ = bench(estimate_pi_serial, N) + print(f"Последовательно: T(1) = {t1:.2f} с") + print(" p T(p), с S(p) E(p)") + for p in [1, 2, 4, 6, 8, 10]: + with ProcessPoolExecutor(max_workers=p) as pool: + tp, _, _ = bench(estimate_pi_parallel, N, pool, p) + s = t1 / tp + print(f"{p:2d} {tp:8.2f} {s:5.2f} {s / p:5.2f}")