From ec01d35aba20006234928772df702925332554dd Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Thu, 23 Dec 2021 19:54:07 +0100
Subject: [PATCH] Move writing of `node_id_param.json`

Just sparing one test on rank.
---
 Overlap/eddy_graph.f90 | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/Overlap/eddy_graph.f90 b/Overlap/eddy_graph.f90
index c03f5cdb..ae8e04eb 100644
--- a/Overlap/eddy_graph.f90
+++ b/Overlap/eddy_graph.f90
@@ -112,6 +112,10 @@ program eddy_graph
           "eddy_graph: n_proc should be <= n_dates / (max_delta + 1)")
      e_overestim = maxval([(hshp(i)%ishape_last(hshp(i)%d0) + 1, &
           ediff1d(hshp(i)%ishape_last), i = 1, n_shpc)])
+     open(unit, file = "node_id_param.json", status = "replace", &
+          action = "write")
+     write(unit, fmt = *) '{"e_overestim": ', e_overestim, '}'
+     close(unit)
      corner = corner_deg * deg_to_rad
      step = step_deg * deg_to_rad
   end if
@@ -127,13 +131,6 @@ program eddy_graph
   call ezmpi_bcast(n_dates, root = 0)
   call ezmpi_bcast(e_overestim, root = 0)
 
-  if (rank == 0) then
-     open(unit, file = "node_id_param.json", status = "replace", &
-          action = "write")
-     write(unit, fmt = *) '{"e_overestim": ', e_overestim, '}'
-     close(unit)
-  end if
-
   ! Open output files:
   
   call new_unit(unit_isolated)
-- 
GitLab