From e2f48becdd5671c51416453bb420beb388e0792e Mon Sep 17 00:00:00 2001
From: voigta80 <aiko.voigt@univie.ac.at>
Date: Sun, 12 Jun 2022 11:17:19 +0200
Subject: [PATCH] Small changes to becnhmarking LOG files

---
 ...G.benchmark_3d.run.774657.o_keep4reference | 32 ++++++++
 ...rkx_fullgraph.run.747768.o_keep4reference} |  0
 benchmarks/levante/benchmark_3d.run           | 10 +--
 .../levante/benchmark_3d_10timesteps.py       | 75 +++++++++++++++++++
 4 files changed, 112 insertions(+), 5 deletions(-)
 create mode 100644 benchmarks/levante/LOG.benchmark_3d.run.774657.o_keep4reference
 rename benchmarks/levante/{LOG.benchmark_alternative_networkx_fullgraph.run.747768.o => LOG.benchmark_alternative_networkx_fullgraph.run.747768.o_keep4reference} (100%)
 create mode 100644 benchmarks/levante/benchmark_3d_10timesteps.py

diff --git a/benchmarks/levante/LOG.benchmark_3d.run.774657.o_keep4reference b/benchmarks/levante/LOG.benchmark_3d.run.774657.o_keep4reference
new file mode 100644
index 0000000..24bd80e
--- /dev/null
+++ b/benchmarks/levante/LOG.benchmark_3d.run.774657.o_keep4reference
@@ -0,0 +1,32 @@
+Working with /sw/spack-levante/mambaforge-4.11.0-0-Linux-x86_64-sobz6z/bin/python3
+                                         
+-----------------------------------------
+Working on resolution of R10000m
+Start cell: 264617 Search radius: 851
+ 
+Time to read in 1 time step of data, including moving it onto the 3d x lev cubulated grid; done for 48 time steps
+Mean: 0:00:37.790904 Min: 0:00:36.854732 Max: 0:00:38.395997
+ 
+Time to do 3d connected component labeling with vertex connectivity for 1 time step; done for 48 time steps
+Mean: 0:06:06.647231 Min: 0:05:47.607184 Max: 0:06:26.261884
+ 
+Time to do 3d connected component labeling with edge connectivity for 1 time step; done for 48 time steps
+Mean: 0:10:25.109824 Min: 0:09:42.041926 Max: 0:11:21.031920
+-----------------------------------------
+                                         
+                                         
+-----------------------------------------
+Working on resolution of R10000m
+Start cell: 264617 Search radius: 851
+ 
+Time to read in 1 time step of data, including moving it onto the 3d x lev cubulated grid; done for 48 time steps
+Mean: 0:00:37.753456 Min: 0:00:37.042033 Max: 0:00:38.651186
+ 
+Time to do 3d connected component labeling with vertex connectivity for 1 time step; done for 48 time steps
+Mean: 0:06:08.706686 Min: 0:05:45.710407 Max: 0:06:26.488845
+ 
+Time to do 3d connected component labeling with edge connectivity for 1 time step; done for 48 time steps
+Mean: 0:10:25.774384 Min: 0:09:34.235645 Max: 0:11:17.364959
+-----------------------------------------
+                                         
+slurmstepd: error: *** JOB 774657 ON l40311 CANCELLED AT 2022-06-12T08:51:18 DUE TO TIME LIMIT ***
diff --git a/benchmarks/levante/LOG.benchmark_alternative_networkx_fullgraph.run.747768.o b/benchmarks/levante/LOG.benchmark_alternative_networkx_fullgraph.run.747768.o_keep4reference
similarity index 100%
rename from benchmarks/levante/LOG.benchmark_alternative_networkx_fullgraph.run.747768.o
rename to benchmarks/levante/LOG.benchmark_alternative_networkx_fullgraph.run.747768.o_keep4reference
diff --git a/benchmarks/levante/benchmark_3d.run b/benchmarks/levante/benchmark_3d.run
index ebb1ce4..ab79b28 100755
--- a/benchmarks/levante/benchmark_3d.run
+++ b/benchmarks/levante/benchmark_3d.run
@@ -25,10 +25,10 @@ echo "Working with" ${MYPYTHON}
 #   $MYPYTHON benchmark_3d.py R40000m 18494 210
 #done
 #
-for i in {1..10}; do
-   $MYPYTHON benchmark_3d.py R20000m 69220 423
-done
+#for i in {1..10}; do
+#   $MYPYTHON benchmark_3d.py R20000m 69220 423
+#done
 
-for i in {1..1}; do
-   $MYPYTHON benchmark_3d.py R10000m 264617 851
+for i in {1..10}; do
+   $MYPYTHON benchmark_3d_10timesteps.py R10000m 264617 851
 done
diff --git a/benchmarks/levante/benchmark_3d_10timesteps.py b/benchmarks/levante/benchmark_3d_10timesteps.py
new file mode 100644
index 0000000..6cab7cf
--- /dev/null
+++ b/benchmarks/levante/benchmark_3d_10timesteps.py
@@ -0,0 +1,75 @@
+# Perform benchmarking of 3d cloud data given a previously computed cubulation
+
+# parse command line parameters
+import sys
+resol      = sys.argv[1]
+startcell  = int(sys.argv[2])
+searchrad  = int(sys.argv[3])
+
+# gridfile including path
+gridfile = '/work/bb1018/from_Mistral/bb1018/b380459/NAWDEX/grids/icon-grid_nawdex_78w40e23n80n_'+resol+'.nc'
+
+# load other needed packages
+import cc3d
+sys.path.append('/home/b/b380459/tricco/')
+import tricco
+import datetime
+
+print('                                         ')
+print('-----------------------------------------')
+print('Working on resolution of', resol)
+print('Start cell:', startcell, 'Search radius:', searchrad)
+
+# load previously computed cubulation
+import numpy as np
+cubulpath = '/scratch/b/b380459/tricco_output/'
+cubulfile = cubulpath+'/icon-grid_nawdex_78w40e23n80n_'+resol+'_cubulation_start'+str(startcell)+'_radius'+str(searchrad)+'.npy'
+cubulation = np.load(cubulfile, allow_pickle=True)
+
+# read in cloud data
+
+# cloud file depends on resolution
+datapath={'R80000m': '/work/bb1018/from_Mistral/bb1018/b380459/NAWDEX/ICON_OUTPUT_NWP/nawdexnwp-80km-mis-0001/',
+          'R40000m': '/work/bb1018/from_Mistral/bb1018/b380459/NAWDEX/ICON_OUTPUT_NWP/nawdexnwp-40km-mis-0001/',
+          'R20000m': '/work/bb1018/from_Mistral/bb1018/b380459/NAWDEX/ICON_OUTPUT_NWP/nawdexnwp-20km-mis-0001/',
+          'R10000m': '/work/bb1018/from_Mistral/bb1018/b380459/NAWDEX/ICON_OUTPUT_NWP/nawdexnwp-10km-mis-0001/'}
+datafile={'R80000m': 'nawdexnwp-80km-mis-0001_2016092200_3dcloud_DOM01_ML_',
+          'R40000m': 'nawdexnwp-40km-mis-0001_2016092200_3dcloud_DOM01_ML_',
+          'R20000m': 'nawdexnwp-20km-mis-0001_2016092200_3dcloud_DOM01_ML_',
+          'R10000m': 'nawdexnwp-10km-mis-0001_2016092200_3dcloud_DOM01_ML_'}
+
+dtime_dat = list()
+dtime_ver = list()
+dtime_edg = list()
+# loop over 10 timesteps
+for time in range(10,21):
+    # read in data
+    begin_time = datetime.datetime.now()
+    field, field_cube = tricco.prepare_field_lev(model='ICON', path=datapath[resol], 
+                            file=datafile[resol]+'00'+str(time)+'.nc',
+                            var='clc', threshold=85.0, cubulation=cubulation)
+    end_time = datetime.datetime.now()
+    dtime_dat.append(end_time-begin_time)
+    # perform connected component analysis for vertex connectivity
+    begin_time = datetime.datetime.now()
+    _ = tricco.compute_connected_components_3d(cubulation, field_cube, connectivity = 'vertex')
+    end_time = datetime.datetime.now()
+    dtime_ver.append(end_time-begin_time)
+    # perform connected component analysis for edge connectivity
+    begin_time = datetime.datetime.now()
+    _ = tricco.compute_connected_components_3d(cubulation, field_cube, connectivity = 'edge')
+    end_time = datetime.datetime.now()
+    dtime_edg.append(end_time-begin_time)
+
+print(' ')
+print('Time to read in 1 time step of data, including moving it onto the 3d x lev cubulated grid; done for 48 time steps')
+print('Mean:', np.mean(dtime_dat), 'Min:', np.min(dtime_dat), 'Max:', np.max(dtime_dat))
+print(' ')
+print('Time to do 3d connected component labeling with vertex connectivity for 1 time step; done for 48 time steps')
+print('Mean:', np.mean(dtime_ver), 'Min:', np.min(dtime_ver), 'Max:', np.max(dtime_ver))
+print(' ')
+print('Time to do 3d connected component labeling with edge connectivity for 1 time step; done for 48 time steps')
+print('Mean:', np.mean(dtime_edg), 'Min:', np.min(dtime_edg), 'Max:', np.max(dtime_edg))
+
+print('-----------------------------------------')
+print('                                         ')
-- 
GitLab