[Dart-dev] [9948] DART/trunk/observations/NCEP/prep_bufr/work: the latest scripts i' m using to convert ncep prepbufr
nancy at ucar.edu
nancy at ucar.edu
Thu Mar 3 15:30:57 MST 2016
Revision: 9948
Author: nancy
Date: 2016-03-03 15:30:57 -0700 (Thu, 03 Mar 2016)
Log Message:
-----------
the latest scripts i'm using to convert ncep prepbufr
files to the ascii intermediates. the multi_parallel.lsf
script actually runs 16 conversion programs in parallel
for real. before i was just backgrounding 32 tasks on
2 nodes and assuming the jobs would spread out. turns out
no - it doesn't work that way. this script uses only a
single node but seems to run faster; it uses mpirun with
a command script that is supposed to run each serial task
on a different cpu on the node. it also uses advance_time
so it can roll over month and year boundaries now.
the prepbufr.csh script should be converted to using
advance_time so it doesn't have to do a bunch of ugly
time math inside the script. next time i've got energy
to tackle it, i will.
Added Paths:
-----------
DART/trunk/observations/NCEP/prep_bufr/work/multi_parallel.lsf
DART/trunk/observations/NCEP/prep_bufr/work/run_one_prepbufr.csh
-------------- next part --------------
Added: DART/trunk/observations/NCEP/prep_bufr/work/multi_parallel.lsf
===================================================================
--- DART/trunk/observations/NCEP/prep_bufr/work/multi_parallel.lsf (rev 0)
+++ DART/trunk/observations/NCEP/prep_bufr/work/multi_parallel.lsf 2016-03-03 22:30:57 UTC (rev 9948)
@@ -0,0 +1,153 @@
+#!/bin/csh
+#
+# DART software - Copyright 2004 - 2013 UCAR. This open source software is
+# provided by UCAR, "as is", without charge, subject to all terms of use at
+# http://www.image.ucar.edu/DAReS/DART/DART_download
+#
+# DART $Id$
+#
+# this one is trying to roll over month boundaries. it requires
+# advance_time in the current dir., which requires utilities_nml
+# in the input.nml file (it can be an empty namelist).
+# this one also tries to do N conversions in parallel.
+#
+# Driver script for the parallel version. Submit this script
+# to your batch system and it will invoke the 'prepbufr.csh'
+# script once for each conversion day.
+#
+#--------------------------------------------------------------
+# DESCRIPTION:
+#
+# This script is used to generate daily (3:01Z to 3:00Z of next day)
+# decoded NCEP reanalysis PREPBUFR text/ascii data.
+#
+#--------------------------------------------------------------
+
+#BSUB -o para.out
+#BSUB -e para.err
+#BSUB -J multiprep
+#BSUB -q geyser
+#BSUB -W 6:05
+#BSUB -P P86850054
+#BSUB -n 16
+
+# USER SETTINGS HERE
+
+# Set year, month, days for to pass as args to prepbufr.csh
+set start_year = 2015
+set start_month = 10
+set start_day = 30
+
+set end_year = 2015
+set end_month = 12
+set end_day = 30
+
+# should be less than 16 and match the -n X setting
+# on the BSUB line above
+set njobs = 16
+
+# END USER SETTINGS
+
+echo job started at `date`
+
+# very important! must set this to run multiple scripts at once
+setenv MP_PGMMODEL mpmd
+
+# try hyperthreading?
+#unsetenv MP_PE_AFFINITY
+#setenv MP_TASK_AFFINITY cpu
+
+# convert the start and stop times to gregorian days, so we can
+# compute total number of days including rolling over month and
+# year boundaries. make sure all values have leading 0s if they
+# are < 10. do the end time first so we can use the same values
+# to set the initial day while we are doing the total day calc.
+
+# the output of advance time with the -g input is:
+# gregorian_day_number seconds
+# use $var[1] to return just the day number
+
+set mon2=`printf %02d $end_month`
+set day2=`printf %02d $end_day`
+set end_d=(`echo ${end_year}${mon2}${day2}00 0 -g | ./advance_time`)
+
+set mon2=`printf %02d $start_month`
+set day2=`printf %02d $start_day`
+set start_d=(`echo ${start_year}${mon2}${day2}00 0 -g | ./advance_time`)
+
+# the output of this call is a string YYYYMMDDHH
+# see below for help in how to easily parse this up into words
+set curday=`echo ${start_year}${mon2}${day2}00 0 | ./advance_time`
+
+# how many total days are going to be processed (for the loop counter)
+# note that the parens below are necessary; otherwise the computation
+# does total = end - (start+1), or total = end - start - 1, which is
+# not how elementary math is supposed to work.
+@ totaldays = ( $end_d[1] - $start_d[1] ) + 1
+
+# loop over each day
+set d=1
+while ( $d <= $totaldays )
+
+ rm -f cmdfile
+
+ set j=1
+ while ( $j <= $njobs && $d <= $totaldays)
+
+ # parse out the parts from a string which is YYYYMMDDHH
+ # use cut with the byte option to pull out columns 1-4, 5-6, and 7-8
+ # then bc to strip off leading blanks
+ set year=`echo $curday | cut -b1-4`
+ set month=`echo $curday | cut -b5-6`
+ set day=`echo $curday | cut -b7-8`
+
+ # numeric month/day (no leading 0)
+ set nmonth=`echo $month | bc`
+ set nday=`echo $day | bc`
+
+ # status/debug - comment in or out as desired.
+ echo starting processing for ${year} ${nmonth} ${nday}
+
+ # Subdirectory base name.
+ set tdir = workdir_${year}_${month}_${day}
+
+ echo starting day $day
+ echo "csh run_one_prepbufr.csh $tdir $year $nmonth $nday" >> cmdfile
+
+ # advance the day; the output is YYYYMMDD00
+ set curday=`echo ${year}${month}${day}00 +1d | ./advance_time`
+
+ # advance the loop counter
+ @ d += 1
+
+ # advance the concurrent job counter
+ @ j += 1
+ end
+
+ # avoid echoing the filename by making wc read stdin
+ set j=`cat cmdfile | wc -l`
+ while ( $j < $njobs )
+ echo "date " >> cmdfile
+ @ j += 1
+ end
+
+ echo running jobs:
+ cat cmdfile
+
+ mpirun.lsf -cmdfile cmdfile
+end
+
+# there should not be any non-empty dirs if all went well
+# rmdir will fail if the dir isn't empty
+rmdir workdir_*
+ls -l workdir_*
+
+echo job ended at `date`
+
+exit 0
+
+# <next few lines under version control, do not edit>
+# $URL$
+# $Revision$
+# $Date$
+
Property changes on: DART/trunk/observations/NCEP/prep_bufr/work/multi_parallel.lsf
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author HeadURL Id
Added: svn:eol-style
+ native
Added: DART/trunk/observations/NCEP/prep_bufr/work/run_one_prepbufr.csh
===================================================================
--- DART/trunk/observations/NCEP/prep_bufr/work/run_one_prepbufr.csh (rev 0)
+++ DART/trunk/observations/NCEP/prep_bufr/work/run_one_prepbufr.csh 2016-03-03 22:30:57 UTC (rev 9948)
@@ -0,0 +1,21 @@
+#!/bin/csh
+
+
+# run a single instance of prepbufr.
+# requires several arguments:
+# 1. thedirectory to cd into first.
+# 2. year
+# 3. month
+# 4. day
+
+
+mkdir $1
+cd $1
+cp -f ../prepbufr.csh .
+cp -f ../input.nml .
+./prepbufr.csh $2 $3 $4 $4
+rm input.nml
+rm prepbufr.csh
+cd ..
+
+exit 0
Property changes on: DART/trunk/observations/NCEP/prep_bufr/work/run_one_prepbufr.csh
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author HeadURL Id
Added: svn:eol-style
+ native
More information about the Dart-dev
mailing list