From 8748d90eaf4d069392508efb28d5ff87838a4a59 Mon Sep 17 00:00:00 2001 From: POLCHER Jan <jan.polcher@lmd.jussieu.fr> Date: Tue, 26 May 2020 00:24:23 +0200 Subject: [PATCH] Some small corrections and improved the test for Mallorca --- HydroGrid.py | 2 +- RPPtools.py | 10 ++-- RoutingPreProc.py | 2 +- tests/Mallorca/BuildHTUs_Mallorca.pbs | 52 +++++++++---------- tests/Mallorca/run_EuroSW.def | 26 ++++++++++ tests/Mallorca/{run.def => run_MEDCORDEX.def} | 7 +-- 6 files changed, 58 insertions(+), 41 deletions(-) create mode 100644 tests/Mallorca/run_EuroSW.def rename tests/Mallorca/{run.def => run_MEDCORDEX.def} (80%) diff --git a/HydroGrid.py b/HydroGrid.py index 7c05928..aaa8033 100644 --- a/HydroGrid.py +++ b/HydroGrid.py @@ -77,7 +77,7 @@ class HydroGrid : DEBUG("# Range Lon :"+str(np.min(self.lon))+" -- "+str(np.max(self.lon))) DEBUG("# Range Lat :"+str(np.min(self.lat))+" -- "+str(np.max(self.lat))) # - if not os.path.exists(wfile): + if wfile is None or not os.path.exists(wfile): self.polyll, self.polylist, self.centers, self.radius, self.index = corners(self.lon, self.lat) def select(self, c, r) : diff --git a/RPPtools.py b/RPPtools.py index 31b2053..fb483b8 100644 --- a/RPPtools.py +++ b/RPPtools.py @@ -18,7 +18,7 @@ import time import configparser config=configparser.ConfigParser() config.read("run.def") -saveweights=config.get("OverAll", "SaveWeights", fallback="true") +saveweights=config.get("OverAll", "WeightFile", fallback=None) EarthRadius=config.getfloat("OverAll", "EarthRadius", fallback=6370000.0) # # Logging in MPI : https://groups.google.com/forum/#!topic/mpi4py/SaNzc8bdj6U @@ -75,7 +75,7 @@ def maxradius(cent, lon, lat) : radius=[] for lx, ly in zip(lon, lat) : radius.append(np.sqrt((cent[0]-lx)**2+(cent[1]-ly)**2)) - return max(radius) + return np.max(np.array(radius)) # # Simple routine to dump a field into a file. # @@ -138,7 +138,7 @@ class compweights : # # Only compute the weights if the file does not exist. # - if not os.path.exists(wfile) : + if wfile is None or not os.path.exists(wfile) : INFO("Computing weights") nbpts = len(modelgrid.centers) i = 0 @@ -195,9 +195,9 @@ class compweights : INFO(str(part.rank)+" Area Overlap error : "+str(min(overlaperr))+"-"+str(max(overlaperr))+\ " Nb of Hydro grid overlaping : "+str(min(self.hpts))+"-"+str(max(self.hpts)) ) # - self.dumpweights(wfile, part, modelgrid, hydrogrid) + if wfile is not None : + self.dumpweights(wfile, part, modelgrid, hydrogrid) # - ##self.printtest([15,19], part, modelgrid) # else : # diff --git a/RoutingPreProc.py b/RoutingPreProc.py index 3ebfcc8..2ae1564 100644 --- a/RoutingPreProc.py +++ b/RoutingPreProc.py @@ -21,7 +21,7 @@ nbasmax=config.getint("OverAll", "nbasmax") numop=config.getint("OverAll", "numop", fallback=100) OutGraphFile=config.get("OverAll","GraphFile") DumpHydroSuper=config.getboolean("OverAll","DumpHydroSuper",fallback=False) -wfile=config.get("OverAll","WeightFile",fallback="Weights.nc") +wfile=config.get("OverAll","WeightFile",fallback=None) # import ModelGrid as MG import Partition as PA diff --git a/tests/Mallorca/BuildHTUs_Mallorca.pbs b/tests/Mallorca/BuildHTUs_Mallorca.pbs index dacfbb5..8696452 100644 --- a/tests/Mallorca/BuildHTUs_Mallorca.pbs +++ b/tests/Mallorca/BuildHTUs_Mallorca.pbs @@ -3,7 +3,7 @@ #PBS -N BuildHTUs_Mallorca # #PBS -j oe -#PBS -l nodes=1:ppn=2 +#PBS -l nodes=1:ppn=32 #PBS -l walltime=4:00:00 #PBS -l mem=80gb #PBS -l vmem=80gb @@ -17,42 +17,38 @@ source ../../Environment # # Clean-up # -/bin/rm -f DocumentationInterface *.nc *.txt +/bin/rm -f DocumentationInterface *.txt # -# Force RoutingPreProc to recompute the weights. # -/bin/rm -rf Weights -# -# 1 Proc +# 2 Proc # -mpirun -n 1 python ../../RoutingPreProc.py +/bin/rm -f run.def +cp run_MEDCORDEX.def run.def +mpirun -n 2 python ../../RoutingPreProc.py if [ $? -gt 0 ] ; then - echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" - echo "X Run on 1 Proc failed X" - echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" - exit + echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" + echo "X Run MECORDEX on 2 Proc failed X" + echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" else - echo "============================" - echo "= Run on 1 Proc successful =" - echo "============================" - mv MEDCORDEX_test_graph.nc MEDCORDEX_test_graph_n1.nc - mv MEDCORDEX_test_graph_HydroSuper.nc MEDCORDEX_test_graph_HydroSuper_n1.nc + echo "======================================" + echo "= Run MEDCORDEX on 2 Proc successful =" + echo "======================================" + ls -lt fi # +# More points on 32 proc # -# 2 Proc -# -mpirun -n 2 python ../../RoutingPreProc.py +/bin/rm -f run.def +cp run_EuroSW.def run.def +mpirun -n 32 python ../../RoutingPreProc.py if [ $? -gt 0 ] ; then - echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" - echo "X Run on 2 Proc failed X" - echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" + echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" + echo "X Run EuroSW on 32 Proc failed X" + echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" else - echo "============================" - echo "= Run on 2 Proc successful =" - echo "============================" - mv MEDCORDEX_test_graph.nc MEDCORDEX_test_graph_n2.nc - mv MEDCORDEX_test_graph_HydroSuper.nc MEDCORDEX_test_graph_HydroSuper_n2.nc + echo "====================================" + echo "= Run EuroSW on 32 Proc successful =" + echo "====================================" + ls -lt fi -ls -l diff --git a/tests/Mallorca/run_EuroSW.def b/tests/Mallorca/run_EuroSW.def new file mode 100644 index 0000000..d0186a0 --- /dev/null +++ b/tests/Mallorca/run_EuroSW.def @@ -0,0 +1,26 @@ +[OverAll] +# +# +# +EarthRadius = 6370000. +# +ModelGridFile = /bdd/MEDI/workspaces/polcher/NewRouting/geo_EuroSW.nc +HydroFile = /bdd/MEDI/workspaces/polcher/NewRouting/routing_MED.nc +# Mallorca +WEST_EAST = 2.2, 3.6 +SOUTH_NORTH = 39.20, 40.10 +# +WeightFile = EuroSW_Weights.nc +# +# FORTRAN interface parameters +# +Documentation = true +# +# Configuration for the graph to be generated +# +nbasmax = 35 +# +# Output +# +GraphFile = EuroSW_test_graph.nc +# \ No newline at end of file diff --git a/tests/Mallorca/run.def b/tests/Mallorca/run_MEDCORDEX.def similarity index 80% rename from tests/Mallorca/run.def rename to tests/Mallorca/run_MEDCORDEX.def index 981458b..97ce714 100644 --- a/tests/Mallorca/run.def +++ b/tests/Mallorca/run_MEDCORDEX.def @@ -4,10 +4,10 @@ EarthRadius = 6370000. # ModelGridFile = /bdd/MEDI/workspaces/polcher/NewRouting/geo_MEDCORDEX.nc +HydroFile = /bdd/MEDI/workspaces/polcher/NewRouting/routing_MED.nc # Mallorca WEST_EAST = 2.3, 3.5 SOUTH_NORTH = 39.00, 40.1 -HydroFile = /bdd/MEDI/workspaces/polcher/NewRouting/routing_MED.nc # # FORTRAN interface parameters # @@ -25,8 +25,3 @@ numop = 200 # GraphFile = MEDCORDEX_test_graph.nc # -# Diagnostics -# You need to provide an interval in longitude and Latitude. -# -DiagLon = 3.9, 3.9 -DiagLat = 40.0, 40.0 -- GitLab