[Dart-dev] [3587] DART/trunk/models/MITgcm_ocean/shell_scripts/runme_filter: Automatically determines number of ensemble members from the input.nml

nancy at ucar.edu nancy at ucar.edu
Wed Aug 27 14:04:02 MDT 2008


An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20080827/1931c128/attachment.html
-------------- next part --------------
Modified: DART/trunk/models/MITgcm_ocean/shell_scripts/runme_filter
===================================================================
--- DART/trunk/models/MITgcm_ocean/shell_scripts/runme_filter	2008-08-27 15:05:37 UTC (rev 3586)
+++ DART/trunk/models/MITgcm_ocean/shell_scripts/runme_filter	2008-08-27 20:04:02 UTC (rev 3587)
@@ -71,9 +71,9 @@
 
 set parallel_model = "true"
 
-# determine the number of ensemble members from input.nml 
-# unfortunately, it may exist in more than one place.
-# could try to parse out the filter_nml string and see which 
+# Determine the number of ensemble members from input.nml,
+# it may exist in more than one place.
+# Parse out the filter_nml string and see which 
 # one is immediately after it ...
 
 if ( ! -e input.nml ) then
@@ -82,7 +82,8 @@
    exit 1
 endif
 
-set num_ens = 20
+set ENSEMBLESTRING = `grep -A 42 filter_nml input.nml | grep ens_size`
+set NUM_ENS = `echo $ENSEMBLESTRING[3] | sed -e "s#,##"`
 
 # A common strategy for the beginning is to check for the existence of
 # some variables that get set by the different queuing mechanisms.
@@ -137,7 +138,7 @@
           # of processors this job is using.
 
           echo "calling model advance now:"
-          ./advance_model.csh 0 ${num_ens} filter_control00000
+          ./advance_model.csh 0 ${NUM_ENS} filter_control00000 || exit 9
 
           echo "restarting filter."
           mpirun.lsf ./wakeup_filter
@@ -205,7 +206,7 @@
           # of processors this job is using.
 
           echo "calling model advance now:"
-          ./advance_model.csh 0 ${num_ens} filter_control00000
+          ./advance_model.csh 0 ${NUM_ENS} filter_control00000 || exit 9
 
           echo "restarting filter."
           mpirun ./wakeup_filter
@@ -243,42 +244,39 @@
     #echo "node3:2" >> $MYNODEFILE
     #echo "node1:2" >> $MYNODEFILE
 
-    # Ibrahim ... check value of MPIRUN and MYNODEFILE 
+#   for compas
+    setenv NUM_PROCS `cat nodelist-pgi | wc -l`
+    set MPIRUN = /opt/mpich/myrinet/pgi/bin/mpirun
+    set MPICMD = $MPIRUN -np $NUM_PROCS -nolocal -machinefile nodelist-pgi
 
-    setenv NUM_PROCS `cat nodelist | wc -l`
-    set MYNODEFILE = nodelist
-#   for atlas
+#   for atlas-pgi
+    setenv NUM_PROCS `cat nodelist-pgi | wc -l`
     set MPIRUN = /share/apps/mpich1/pgi/bin/mpirun
-#   for compas
-#   set MPIRUN = /opt/mpich/myrinet/pgi/bin/mpirun
+    set MPICMD = $MPIRUN -np $NUM_PROCS -nolocal -machinefile nodelist-pgi
 
-    echo "running with $NUM_PROCS nodes specified from $MYNODEFILE"
+#   for atlas-gfortran
+    set MPIRUN = /share/apps/openmpi/gfortran/bin/mpirun
+    set MPICMD = $MPIRUN --hostfile nodelist-gfortran --mca mtl mx --mca pml cm -np 72
 
-    # each filter task advances the ensembles, each running on 1 proc.
-    if ( "$parallel_model" == "false" ) then
+    echo "MPICMD = ${MPICMD}"
 
-       $MPIRUN -np $NUM_PROCS -nolocal -machinefile $MYNODEFILE ./filter
-
-    else
-
     # filter runs in parallel until time to do a model advance,
     # and then this script starts up the mitgcmuv jobs, each one
     # running in parallel. then it runs wakeup_filter to wake
     # up filter so it can continue.
 
-      \rm -f model_to_filter.lock filter_to_model.lock
-      mkfifo model_to_filter.lock filter_to_model.lock
+    \rm -f model_to_filter.lock filter_to_model.lock
+    mkfifo model_to_filter.lock filter_to_model.lock
 
-      set filterhome = ~/.filter$$
-      if ( ! -e $filterhome) mkdir $filterhome
+    set filterhome = ~/.filter$$
+    if ( ! -e $filterhome) mkdir $filterhome
 
-      # this starts filter but also returns control back to
-      # this script immediately.
+    # this starts filter but also returns control back to
+    # this script immediately.
 
-      (setenv HOME $filterhome; \
-       $MPIRUN -np $NUM_PROCS -nolocal -machinefile $MYNODEFILE ./filter) &
+    (setenv HOME $filterhome; ${MPICMD} ./filter) &
 
-      while ( -e filter_to_model.lock )
+    while ( -e filter_to_model.lock )
 
         set todo=`cat < filter_to_model.lock`
         echo "todo received, value = ${todo}"
@@ -296,10 +294,10 @@
           # of processors this job is using.
 
           echo "calling model advance now:"
-          ./advance_model.csh 0 ${num_ens} filter_control00000
+          ./advance_model.csh 0 ${NUM_ENS} filter_control00000 || exit 9
 
           echo "restarting filter."
-          $MPIRUN -np $NUM_PROCS -nolocal -machinefile $MYNODEFILE ./wakeup_filter
+          ${MPICMD} ./wakeup_filter
 
         else
 
@@ -308,13 +306,12 @@
 
         endif
 
-      end
+    end
 
-      echo "filter finished, removing pipes."
-      \rm -f model_to_filter.lock filter_to_model.lock
+    echo "filter finished, removing pipes."
+    \rm -f model_to_filter.lock filter_to_model.lock
 
-      if ( -d $filterhome) rmdir $filterhome
-    endif
+    if ( -d $filterhome) rmdir $filterhome
 
 endif
 


More information about the Dart-dev mailing list