From a9dc4afde6b4ad8233237683ac719f494f71c652 Mon Sep 17 00:00:00 2001 From: kosipov Date: Sat, 17 Oct 2026 08:39:41 +0200 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=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 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lec1/simple_run.py diff --git a/lec1/simple_run.py b/lec1/simple_run.py new file mode 100644 index 0000000..afb94be --- /dev/null +++ b/lec1/simple_run.py @@ -0,0 +1,14 @@ +from concurrent.futures import ProcessPoolExecutor +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}")