From 371d1f3bdbbacbf3297ccf2ab3192bb769a34742 Mon Sep 17 00:00:00 2001 From: Ben Bartlett Date: Thu, 7 Oct 2021 12:13:31 -0700 Subject: [PATCH] update to Parallel_Meep.md for missing chunk layout file --- doc/docs/Parallel_Meep.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/docs/Parallel_Meep.md b/doc/docs/Parallel_Meep.md index 3a4452179..d430ad9ac 100644 --- a/doc/docs/Parallel_Meep.md +++ b/doc/docs/Parallel_Meep.md @@ -239,10 +239,13 @@ import meep as mp from meep.chunk_balancer import ChunkBalancer from meep.timing_measurements import MeepTimingMeasurements import pickle +import os.path -# Fetch chunk layout from a previous run -with open("path/to/chunk_layout.pkl", "rb") as f: - chunk_layout = pickle.load(f) +# Fetch chunk layout from a previous run if it exists +if os.path.exists("path/to/chunk_layout.pkl"): + chunk_layout = pickle.load(open("path/to/chunk_layout.pkl", "rb")) +else: + chunk_layout = None sim = mp.Simulation(..., chunk_layout=chunk_layout) sim.init_sim()