[Ncep.list.nems.announce] nems r86845: Low-impact regression test and build system changes:

Samuel.Trahan at noaa.gov Samuel.Trahan at noaa.gov
Tue Jan 17 17:28:05 UTC 2017


...
Message-ID: <587e5426.XqLHwcdC0BhriA/8%Samuel.Trahan at noaa.gov>
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: multipart/mixed;
 boundary="=_587e5426.FSScMzJ5Gp/8PhglyTpo6C6WjdHOvXQfS5qgGfUPkgmLl3G6"

This is a multi-part message in MIME format.

--=_587e5426.FSScMzJ5Gp/8PhglyTpo6C6WjdHOvXQfS5qgGfUPkgmLl3G6
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Friendly NEMS developers,

This is an automated email about a NEMS commit.

Project: nems
URL: https://svnemc.ncep.noaa.gov/projects/nems/trunk
Revision: 86845
Author:   samuel.trahan at noaa.gov
Date:     2017-01-17T17:23:09.072521Z
Message:
Low-impact regression test and build system changes:

1. OldCompsetRun is now at the application level.  This is because it
is almost entirely application-specific code.

2. There are two new shell-include files which load the module command
and purge modules.  These are entirely self-contained; they can be
lifted out of the NEMS repository and used independently:

  src/conf/module-setup.csh.inc  - for csh and tcsh
  src/conf/module-setup.sh.inc   - for ksh, sh, and bash

3. The "configure" script generates two scripts that will load NEMS
modules from src/conf:

  src/conf/modules.nems.csh
  src/conf/modules.nems.sh

Each one sources the corresponding module-setup file, and then loads
the "module.nems" module from src/conf.  This allows tcsh users (hi,
Jordan!) to do this:

  source src/conf/modules.nems.csh

Thus fixing a long-standing bug in NEMS.


See attached file for full differences.


First 4000 bytes of differences:
Index: checkout/tests/rtgen
===================================================================
--- checkout/tests/rtgen	(revision 86251)
+++ checkout/tests/rtgen	(revision 86845)
@@ -674,6 +674,44 @@
     return verbose,baseline_dir,dry_run,baseline,unique_id,temp, \
            inputfile,arglist_nowhite,project,script_mode
 
+########################################################################
+
+def verify_fingerprint(baseline,testgen,logger):
+    if baseline:
+        baseline_fingerprint=os.path.join(
+            testgen.get_string('plat%BASELINE_TEMPLATE'),
+            'REGTEST-FINGERPRINT.md')
+    else:
+        baseline_fingerprint=os.path.join(
+            testgen.get_string('plat%BASELINE'),
+            'REGTEST-FINGERPRINT.md')
+    repo_fingerprint=os.path.join(
+        testgen.get_string('plat%PARMnems'),
+        'REGTEST-FINGERPRINT.md')
+
+    with open(baseline_fingerprint,'r') as base_finger_file:
+        base_finger_dat=base_finger_file.read()
+
+    with open(repo_fingerprint,'r') as repo_finger_file:
+        repo_finger_dat=repo_finger_file.read()
+
+    if repo_finger_dat != base_finger_dat:
+        jlogger.error('You are using the wrong data directory.')
+        jlogger.error('Baseline finger print does not match repo fingerprint.')
+        jlogger.error('  Baseline fingerprint file: %s'%(
+                baseline_fingerprint,))
+        jlogger.error('  Repository fingerprint file: %s'%(
+                repo_fingerprint,))
+        sys.exit(1)
+    else:
+        jlogger.info('Baseline fingerprint matches repo fingerprint. Rejoice.')
+        jlogger.info('  Baseline fingerprint file: %s'%(
+                baseline_fingerprint,))
+        jlogger.info('  Repository fingerprint file: %s'%(
+                repo_fingerprint,))
+
+########################################################################
+
 def main():
     verbose,baseline_dir,dry_run,baseline,unique_id,temp, \
         inputfile,arglist,project,script_mode = \
@@ -745,9 +783,16 @@
                   baseline_dir,inputfile=inputfile,
                   verbose=bool(verbose),dry_run=dry_run,
                   setarith=arith,project=project)
+
+    jlogger.info('Parsing compset descriptions.')
+    testgen.parse()
+
+    jlogger.info('Verifying repo fingerprint against data fingerprint.')
+    verify_fingerprint(baseline,testgen,logger)
+
     try:
         jlogger.info('Generating workflow with id %s.'%(repr(unique_id),))
-        testgen.testgen()
+        testgen.generate()
     except ArithKeyError as ake:
         # User specified an invalid set or test.  Give the usage message.
         usage(str(ake))
Index: checkout/tests/rtrewindimpl
===================================================================
--- checkout/tests/rtrewindimpl	(revision 86251)
+++ checkout/tests/rtrewindimpl	(revision 86845)
@@ -36,6 +36,8 @@
                 match="test_"+job
             if task=="build_"+job:
                 match="build_"+job
+            if task==job:
+                match=job
             if match:
                 break
 
Index: checkout/tests/modulecmd/test-modulecmd.pl
===================================================================
--- checkout/tests/modulecmd/test-modulecmd.pl	(nonexistent)
+++ checkout/tests/modulecmd/test-modulecmd.pl	(revision 86845)
@@ -0,0 +1,182 @@
+#! /usr/bin/env perl
+
+use File::Basename;
+use File::Spec;
+use English qw{ RS OS_ERROR };
+use warnings;
+use strict;
+
+my $tmdir=File::Spec->canonpath(File::Spec->rel2abs(dirname(__FILE__)));
+my $confdir=dirname(dirname($tmdir))."/src/conf";
+
+my $salt=rand(1000000);
+
+my $cshinc="$confdir/module-setup.csh.inc";
+my $shinc="$confdir/module-setup.sh.inc";
+my $crontab_bak="crontab-$salt.bak";
+my $crontab_new="crontab-$salt.new";
+
+########################################################################
+
+# Ensure needed files are present
+
+my $bad=0;
+if(!-s "$cshinc") {
+    $bad=1;
+    warn "$cshinc: empty or missing\n"
+}
+if(!


... see attachment for the rest ...

--=_587e5426.FSScMzJ5Gp/8PhglyTpo6C6WjdHOvXQfS5qgGfUPkgmLl3G6
Content-Type: text/plain;
 charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="86845.diff"

Index: checkout/tests/rtgen
===================================================================
--- checkout/tests/rtgen	(revision 86251)
+++ checkout/tests/rtgen	(revision 86845)
@@ -674,6 +674,44 @@
     return verbose,baseline_dir,dry_run,baseline,unique_id,temp, \
            inputfile,arglist_nowhite,project,script_mode
 
+########################################################################
+
+def verify_fingerprint(baseline,testgen,logger):
+    if baseline:
+        baseline_fingerprint=os.path.join(
+            testgen.get_string('plat%BASELINE_TEMPLATE'),
+            'REGTEST-FINGERPRINT.md')
+    else:
+        baseline_fingerprint=os.path.join(
+            testgen.get_string('plat%BASELINE'),
+            'REGTEST-FINGERPRINT.md')
+    repo_fingerprint=os.path.join(
+        testgen.get_string('plat%PARMnems'),
+        'REGTEST-FINGERPRINT.md')
+
+    with open(baseline_fingerprint,'r') as base_finger_file:
+        base_finger_dat=base_finger_file.read()
+
+    with open(repo_fingerprint,'r') as repo_finger_file:
+        repo_finger_dat=repo_finger_file.read()
+
+    if repo_finger_dat != base_finger_dat:
+        jlogger.error('You are using the wrong data directory.')
+        jlogger.error('Baseline finger print does not match repo fingerprint.')
+        jlogger.error('  Baseline fingerprint file: %s'%(
+                baseline_fingerprint,))
+        jlogger.error('  Repository fingerprint file: %s'%(
+                repo_fingerprint,))
+        sys.exit(1)
+    else:
+        jlogger.info('Baseline fingerprint matches repo fingerprint. Rejoice.')
+        jlogger.info('  Baseline fingerprint file: %s'%(
+                baseline_fingerprint,))
+        jlogger.info('  Repository fingerprint file: %s'%(
+                repo_fingerprint,))
+
+########################################################################
+
 def main():
     verbose,baseline_dir,dry_run,baseline,unique_id,temp, \
         inputfile,arglist,project,script_mode = \
@@ -745,9 +783,16 @@
                   baseline_dir,inputfile=inputfile,
                   verbose=bool(verbose),dry_run=dry_run,
                   setarith=arith,project=project)
+
+    jlogger.info('Parsing compset descriptions.')
+    testgen.parse()
+
+    jlogger.info('Verifying repo fingerprint against data fingerprint.')
+    verify_fingerprint(baseline,testgen,logger)
+
     try:
         jlogger.info('Generating workflow with id %s.'%(repr(unique_id),))
-        testgen.testgen()
+        testgen.generate()
     except ArithKeyError as ake:
         # User specified an invalid set or test.  Give the usage message.
         usage(str(ake))
Index: checkout/tests/rtrewindimpl
===================================================================
--- checkout/tests/rtrewindimpl	(revision 86251)
+++ checkout/tests/rtrewindimpl	(revision 86845)
@@ -36,6 +36,8 @@
                 match="test_"+job
             if task=="build_"+job:
                 match="build_"+job
+            if task==job:
+                match=job
             if match:
                 break
 
Index: checkout/tests/modulecmd/test-modulecmd.pl
===================================================================
--- checkout/tests/modulecmd/test-modulecmd.pl	(nonexistent)
+++ checkout/tests/modulecmd/test-modulecmd.pl	(revision 86845)
@@ -0,0 +1,182 @@
+#! /usr/bin/env perl
+
+use File::Basename;
+use File::Spec;
+use English qw{ RS OS_ERROR };
+use warnings;
+use strict;
+
+my $tmdir=File::Spec->canonpath(File::Spec->rel2abs(dirname(__FILE__)));
+my $confdir=dirname(dirname($tmdir))."/src/conf";
+
+my $salt=rand(1000000);
+
+my $cshinc="$confdir/module-setup.csh.inc";
+my $shinc="$confdir/module-setup.sh.inc";
+my $crontab_bak="crontab-$salt.bak";
+my $crontab_new="crontab-$salt.new";
+
+########################################################################
+
+# Ensure needed files are present
+
+my $bad=0;
+if(!-s "$cshinc") {
+    $bad=1;
+    warn "$cshinc: empty or missing\n"
+}
+if(!-s "$shinc") {
+    $bad=1;
+    warn "$shinc: empty or missing\n"
+}
+if($bad) {
+    die "Cannot run script.  See earlier messages for details.\n"
+}
+
+########################################################################
+
+# Read and store the old crontab
+
+open(CRONTAB,"crontab -l |") or die "crontab -l: cannot execute program: $OS_ERROR";
+my $crontab=do {
+    local $RS=undef;
+    <CRONTAB>
+};
+close(CRONTAB) or die "crontab: error reading from crontab: $OS_ERROR";
+
+open(OLDTAB,">$crontab_bak") or die "$crontab_bak: cannot open file: $OS_ERROR";
+print(OLDTAB $crontab) or die "$crontab_bak: error writing: $OS_ERROR";
+close(OLDTAB) or die "$crontab_bak: error closing: $OS_ERROR";
+print STDERR "$crontab_bak: backup of crontab before this script modifies it\n";
+
+########################################################################
+
+# Scan for available shells and generate in-memory test scripts for each
+
+print STDERR "Scan for available shells...\n";
+
+my @shells=qw{ /bin/bash /bin/ksh /bin/sh /bin/csh /bin/tcsh };
+my %tests;
+
+foreach my $shell ( @shells ) {
+    next unless -x "$shell";
+    my $shellbn=basename($shell);
+    my $modfile=$shinc;
+    $modfile=$cshinc if $shell=~/csh/;
+    $tests{$shell} = {
+        resultfile=>"$tmdir/$shellbn-$salt.result",
+        shellfile=>"$tmdir/test-$salt.$shellbn",
+        modfile=>"$modfile",
+        status=>"unknown",
+        script=>"#! $shell
+source $modfile
+module help
+",
+                     };
+}
+
+########################################################################
+
+# Create on-disk test scripts for each shell
+
+print STDERR "Delete old scripts and results...\n";
+foreach my $shell (keys %tests) {
+  foreach my $file (qw{ resultfile shellfile }) {
+    if(-e $tests{$shell}{$file} || -l $tests{$shell}{$file} ) {
+      unlink($tests{$shell}{$file})
+        or die "$tests{$shell}{$file}: cannot delete: $OS_ERROR";
+    }
+  }
+}
+
+# Create new scripts:
+print STDERR "Create new scripts...\n";
+foreach my $shell (keys %tests) {
+  open(SHELLTEST,">$tests{$shell}{shellfile}")
+    or die "$tests{$shell}{shellfile}: cannot open for write: $OS_ERROR";
+  print(SHELLTEST "$tests{$shell}{script}")
+    or die "$tests{$shell}{shellfile}: cannot write: $OS_ERROR";
+  close(SHELLTEST)
+    or die "$tests{$shell}{shellfile}: error closing output file: $OS_ERROR";
+  chmod(0700,$tests{$shell}{shellfile})
+    or die "$tests{$shell}{shellfile}: cannot chmod 0700: $!";
+}
+
+# Create the new crontab:
+print STDERR "Generate new crontab...\n";
+my $in5minutes=time() + 120;
+my $give_up=$in5minutes+120;
+my ($lsec,$lmin,$lhour,$lmday,$lmon, at other)=localtime($in5minutes);
+$lmon++;
+foreach my $shell (keys %tests) {
+  $crontab.="
+# Test module-setup for $shell:
+$lmin $lhour $lmday $lmon * $tests{$shell}{shellfile} > $tests{$shell}{resultfile} 2>&1
+";
+}
+
+# Write the crontab to a temporary file:
+print STDERR "$crontab_new: write crontab to this file\n";
+open(CRONNEW,">$crontab_new") or die "$crontab_new: cannot open for writing: $!";
+print(CRONNEW $crontab) or die "$crontab_new: cannot write: $!";
+close(CRONNEW) or die "$crontab_new: error closing output file: $!";
+
+# Update the crontab:
+print STDERR "crontab $crontab_new: update the crontab...\n";
+system("crontab $crontab_new < /dev/null");
+if($?) {
+  die "crontab $crontab_new: exit $? ($!)";
+}
+
+# Wait for results:
+print STDERR "Wait up to four minutes for results...";
+my $processed=0;
+while(time()<$give_up && $processed<scalar keys %tests) {
+  foreach my $shell (keys %tests) {
+    next if $tests{$shell}{status} ne "unknown";
+    if(! -s $tests{$shell}{resultfile}) {
+      warn "$tests{$shell}{resultfile}: empty or missing\n";
+      next;
+    }
+    my @stat=stat $tests{$shell}{resultfile};
+    if(time()-$stat[9]<20) {
+      warn "$tests{$shell}{resultfile}: not 20 seconds old yet\n";
+      next;
+    }
+
+    $tests{$shell}{status}="FAIL";
+    $processed++;
+
+    open(RESULTFILE,"<$tests{$shell}{resultfile}") or do {
+      warn "$tests{$shell}{resultfile}: cannot open for read: $!";
+      next;
+    };
+
+    while(defined($_=<RESULTFILE>)) {
+      if(/Usage.*odule/) {
+        $tests{$shell}{status}="PASS";
+        last;
+      }
+    }
+
+    close(RESULTFILE) or
+      warn "$tests{$shell}{resultfile}: error closing input file: $!";
+
+    print "$shell: $tests{$shell}{status}\n";
+  }
+  print "tick... processed $processed ... tick ...\n";
+  sleep 3;
+}
+
+#Restore crontab:
+system("crontab $crontab_bak < /dev/null");
+if($?) {
+  die "crontab $crontab_bak: exit $? ($!)";
+}
+
+my $passfail="PASS";
+foreach my $shell (keys %tests) {
+  print "$shell: $tests{$shell}{status}\n";
+  $passfail="FAIL" unless $tests{$shell}{status} eq 'PASS';
+}
+print "RESULT: $passfail\n";

Property changes on: checkout/tests/modulecmd/test-modulecmd.pl
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: checkout/tests
===================================================================
--- checkout/tests	(revision 86251)
+++ checkout/tests	(revision 86845)

Property changes on: checkout/tests
___________________________________________________________________
Modified: svn:externals
## -1 +1 ##
-produtil -r86179 https://svnemc.ncep.noaa.gov/projects/nceplibs/produtil/branches/regtests
+produtil         https://svnemc.ncep.noaa.gov/projects/nceplibs/produtil/branches/regtests
Modified: svn:mergeinfo
## -0,0 +0,2 ##
   Merged /nems/branches/regtests/tests:r86448-86844
   Merged /nems/branches/modulecmd/tests:r86269-86662
Index: checkout/src/configure
===================================================================
--- checkout/src/configure	(revision 86251)
+++ checkout/src/configure	(revision 86845)
@@ -2,6 +2,11 @@
 
 CHOSEN_MODULE="$2"
 
+if [[ ! -d "conf" ]] ; then
+    echo "ERROR: This script must be run from the NEMS/src/conf directory." 1>&2
+    exit 1
+fi
+
 if [[ -z "$CHOSEN_MODULE" ]] ; then 
     echo "WARNING: modulefile was not supplied as the second argument" 1>&2
     echo "If possible, specify a modulefile relative to ../../modulefiles" 1>&2
@@ -10,21 +15,35 @@
 
 # copy_diff_files
 copy_diff_files(){
-  if [[ ! -f $2 ]] ; then
-    set -x
+  if ( ! cmp "$1" "$2" > /dev/null 2>&1 ) ; then
+    set -xue
     cp $1 $2
-    set +x
+    set +xue
   else
-  if [[ `diff $1 $2`"" != "" ]] ; then
-    set -x
-    cp $1 $2
-    set +x
-  else
     echo "confirmed $2"
   fi
-  fi
 }
 
+copy_diff_mod()  {
+    if ( ! cmp "$1" "$2" > /dev/null 2>&1 ) ; then
+	set -xue
+	cp -fp "$1" "$2"
+	set +xue
+    else
+	echo "confirmed $2"
+    fi
+    cat > "$2.sh" <<EOF
+source $( pwd -P )/conf/module-setup.sh.inc
+module use $( pwd -P )/conf
+module load modules.nems
+EOF
+    cat > "$2.csh" <<EOF
+source $( pwd -P )/conf/module-setup.csh.inc
+module use $( pwd -P )/conf
+module load modules.nems
+EOF
+}
+
 #
 # Standard
 #
@@ -34,7 +53,7 @@
      copy_diff_files ../../conf/configure.nems.Theia.intel_nmmb conf/configure.nems
      touch conf/externals.nems
      CHOSEN_MODULE="${CHOSEN_MODULE:-theia/ESMF_700_nmmb}"
-     copy_diff_files "../../modulefiles/$CHOSEN_MODULE" conf/modules.nems
+     copy_diff_mod "../../modulefiles/$CHOSEN_MODULE" conf/modules.nems
      copy_diff_files ESMFVersionDefine_ESMF_NUOPC.h ESMFVersionDefine.h
      set +x
      echo "NEMS/NMMB build on Theia using Intel and ESMF v7.0.0"
@@ -43,7 +62,7 @@
      copy_diff_files ../../conf/configure.nems.Wcoss.intel_nmmb conf/configure.nems
      touch conf/externals.nems
      CHOSEN_MODULE="${CHOSEN_MODULE:-wcoss.phase1/ESMF_700_nmmb}"
-     copy_diff_files "../../modulefiles/$CHOSEN_MODULE" conf/modules.nems
+     copy_diff_mod "../../modulefiles/$CHOSEN_MODULE" conf/modules.nems
      copy_diff_files ESMFVersionDefine_ESMF_NUOPC.h              ESMFVersionDefine.h
      set +x
      echo "NEMS/NMMB build on Wcoss using Intel and ESMF v7.0.0"
@@ -52,7 +71,7 @@
      copy_diff_files ../../conf/configure.nems.Theia.intel_gsm conf/configure.nems
      touch conf/externals.nems
      CHOSEN_MODULE="${CHOSEN_MODULE:-theia/ESMF_700_gsm}"
-     copy_diff_files "../../modulefiles/$CHOSEN_MODULE" conf/modules.nems
+     copy_diff_mod "../../modulefiles/$CHOSEN_MODULE" conf/modules.nems
      copy_diff_files ESMFVersionDefine_ESMF_NUOPC.h ESMFVersionDefine.h
      set +x
      echo "NEMS/GSM build on Theia using Intel and ESMF v7.0.0"
@@ -61,7 +80,7 @@
      copy_diff_files ../../conf/configure.nems.Wcoss.intel_gsm conf/configure.nems
      touch conf/externals.nems
      CHOSEN_MODULE="${CHOSEN_MODULE:-wcoss.phase1/ESMF_700_gsm}"
-     copy_diff_files "../../modulefiles/$CHOSEN_MODULE"      conf/modules.nems
+     copy_diff_mod "../../modulefiles/$CHOSEN_MODULE"      conf/modules.nems
      copy_diff_files ESMFVersionDefine_ESMF_NUOPC.h              ESMFVersionDefine.h
      set +x
      echo "NEMS/GSM build on Wcoss using Intel and ESMF v7.0.0"
@@ -68,10 +87,10 @@
 
 elif [[ $1 = gsm_intel_wcoss_c ]]; then
      set -x
-     copy_diff_files ../../modulefiles/wcoss.cray/intel_gsm conf/configure.nems
+     copy_diff_files ../../conf/configure.nems.Wcoss_C.intel_gsm conf/configure.nems
      touch conf/externals.nems
      CHOSEN_MODULE="${CHOSEN_MODULE:-wcoss.cray/ESMF_700_gsm}"
-     copy_diff_files "../../modulefiles/$CHOSEN_MODULE"      conf/modules.nems
+     copy_diff_mod "../../modulefiles/$CHOSEN_MODULE"      conf/modules.nems
      copy_diff_files ESMFVersionDefine_ESMF_NUOPC.h              ESMFVersionDefine.h
      set +x
      echo "NEMS/GSM build on Wcoss using Intel and ESMF v7.0.0"
@@ -82,7 +101,7 @@
      copy_diff_files ../../conf/configure.nems.Wcoss.intel conf/configure.nems
      copy_diff_files ../../conf/externals.nems.Wcoss conf/externals.nems
      CHOSEN_MODULE="${CHOSEN_MODULE:-wcoss.phase1/ESMF_NUOPC}"
-     copy_diff_files "../../modulefiles/$CHOSEN_MODULE" conf/modules.nems
+     copy_diff_mod "../../modulefiles/$CHOSEN_MODULE" conf/modules.nems
      copy_diff_files ESMFVersionDefine_ESMF_NUOPC.h ESMFVersionDefine.h
      echo "Coupled NEMS build on Wcoss using Intel and ESMF v7.0.0"
 elif [[ $1 = coupled_intel_gaea ]]; then
@@ -89,7 +108,7 @@
      copy_diff_files ../../conf/configure.nems.Gaea.intel conf/configure.nems
      copy_diff_files ../../conf/externals.nems.Gaea conf/externals.nems
      CHOSEN_MODULE="${CHOSEN_MODULE:-gaea/ESMF_NUOPC}"
-     copy_diff_files "../../modulefiles/$CHOSEN_MODULE" conf/modules.nems
+     copy_diff_mod "../../modulefiles/$CHOSEN_MODULE" conf/modules.nems
      copy_diff_files ESMFVersionDefine_ESMF_NUOPC.h ESMFVersionDefine.h
      echo "Coupled NEMS build on Gaea using Intel and ESMF v7.0.0"
 elif [[ $1 = coupled_intel_theia ]]; then
@@ -96,7 +115,7 @@
      copy_diff_files ../../conf/configure.nems.Theia.intel conf/configure.nems
      copy_diff_files ../../conf/externals.nems.Theia conf/externals.nems
      CHOSEN_MODULE="${CHOSEN_MODULE:-theia/ESMF_NUOPC}"
-     copy_diff_files "../../modulefiles/$CHOSEN_MODULE" conf/modules.nems
+     copy_diff_mod "../../modulefiles/$CHOSEN_MODULE" conf/modules.nems
      copy_diff_files ESMFVersionDefine_ESMF_NUOPC.h ESMFVersionDefine.h
      echo "Coupled NEMS build on Theia using Intel and ESMF v7.0.0"
 elif [[ $1 = coupled_intel_yellowstone ]]; then
@@ -103,7 +122,7 @@
      copy_diff_files ../../conf/configure.nems.Yellowstone.intel conf/configure.nems
      copy_diff_files ../../conf/externals.nems.Yellowstone conf/externals.nems
      CHOSEN_MODULE="${CHOSEN_MODULE:-yellowstone/ESMF_NUOPC}"
-     copy_diff_files "../../modulefiles/$CHOSEN_MODULE" conf/modules.nems
+     copy_diff_mod "../../modulefiles/$CHOSEN_MODULE" conf/modules.nems
      copy_diff_files ESMFVersionDefine_ESMF_NUOPC.h ESMFVersionDefine.h
      echo "Coupled NEMS build on Yellowstone using Intel and ESMF v7.0.0"
 elif [[ $1 = coupled_linux_gnu ]]; then
Index: checkout/src/conf/module-setup.sh.inc
===================================================================
--- checkout/src/conf/module-setup.sh.inc	(nonexistent)
+++ checkout/src/conf/module-setup.sh.inc	(revision 86845)
@@ -0,0 +1,70 @@
+# Create a test function for sh vs. bash detection.  The name is
+# randomly generated to reduce the chances of name collision.
+__ms_function_name="setup__test_function__$$"
+eval "$__ms_function_name() { /bin/true ; }"
+
+# Determine which shell we are using
+__ms_ksh_test=$( eval '__text="text" ; if [[ $__text =~ ^(t).* ]] ; then printf "%s" ${.sh.match[1]} ; fi' 2> /dev/null )
+__ms_bash_test=$( eval 'if ( set | grep '$__ms_function_name' | grep -v name > /dev/null 2>&1 ) ; then echo t ; fi ' 2> /dev/null )
+
+if [[ ! -z "$__ms_ksh_test" ]] ; then
+    __ms_shell=ksh
+elif [[ ! -z "$__ms_bash_test" ]] ; then
+    __ms_shell=bash
+else
+    # Not bash or ksh, so assume sh.
+    __ms_shell=sh
+fi
+
+if [[ -d /lfs3 ]] ; then
+    # We are on NOAA Jet
+    if ( ! eval module help > /dev/null 2>&1 ) ; then
+        source /apps/lmod/lmod/init/$__ms_shell
+    fi
+    module purge
+elif [[ -d /scratch3 ]] ; then
+    # We are on NOAA Theia
+    if ( ! eval module help > /dev/null 2>&1 ) ; then
+        source /apps/lmod/lmod/init/$__ms_shell
+    fi
+    module purge
+elif [[ -d /gpfs/hps && -e /etc/SuSE-release ]] ; then
+    # We are on NOAA Luna or Surge
+    if ( ! eval module help > /dev/null 2>&1 ) ; then
+	source /opt/modules/default/init/$__ms_shell
+    fi
+    module use /opt/cray/ari/modulefiles/
+    module use /gpfs/hps/nco/ops/nwprod/lib/modulefiles/
+    module purge
+elif [[ -d /dcom && -d /hwrf ]] ; then
+    # We are on NOAA Tide or Gyre
+    if ( ! eval module help > /dev/null 2>&1 ) ; then
+        source /usrx/local/Modules/default/init/$__ms_shell
+    fi
+    module purge
+elif [[ -d /glade ]] ; then
+    # We are on NCAR Yellowstone
+    if ( ! eval module help > /dev/null 2>&1 ) ; then
+        . /usr/share/Modules/init/$__ms_shell
+    fi
+    module purge
+elif [[ -d /lustre && -d /ncrc ]] ; then
+    # We are on GAEA. 
+    if ( ! eval module help > /dev/null 2>&1 ) ; then
+        # We cannot simply load the module command.  The GAEA
+        # /etc/profile modifies a number of module-related variables
+        # before loading the module command.  Without those variables,
+        # the module command fails.  Hence we actually have to source
+        # /etc/profile here.
+        source /etc/profile
+    fi
+    module purge
+else
+    echo WARNING: UNKNOWN PLATFORM 1>&2
+fi
+
+unset __ms_shell
+unset __ms_ksh_test
+unset __ms_bash_test
+unset $__ms_function_name
+unset __ms_function_name
\ No newline at end of file
Index: checkout/src/conf/module-setup.csh.inc
===================================================================
--- checkout/src/conf/module-setup.csh.inc	(nonexistent)
+++ checkout/src/conf/module-setup.csh.inc	(revision 86845)
@@ -0,0 +1,50 @@
+set __ms_shell=csh
+
+eval "if ( -d / ) set __ms_shell=tcsh"
+
+if ( { test -d /lfs3 } ) then 
+    if ( ! { module help >& /dev/null } ) then
+            source /apps/lmod/lmod/init/$__ms_shell
+    endif
+    module purge
+else if ( { test -d /scratch3 } ) then
+    # We are on NOAA Theia
+    if ( ! { module help >& /dev/null } ) then
+        source /apps/lmod/lmod/init/$__ms_shell
+    endif
+    module purge
+else if ( { test -d /gpfs/hps -a -e /etc/SuSE-release } ) then
+    # We are on NOAA Luna or Surge
+    if ( ! { module help >& /dev/null } ) then
+	source /opt/modules/default/init/$__ms_shell
+    endif
+    module use /opt/cray/ari/modulefiles/
+    module use /gpfs/hps/nco/ops/nwprod/lib/modulefiles/
+    module purge
+else if ( { test -d /dcom -a -d /hwrf } ) then
+    # We are on NOAA Tide or Gyre
+    if ( ! { module help >& /dev/null } ) then
+        source /usrx/local/Modules/default/init/$__ms_shell
+    endif
+    module purge
+else if ( { test -d /glade } ) then
+    # We are on NCAR Yellowstone
+    if ( ! { module help >& /dev/null } ) then
+        source /usr/share/Modules/init/$__ms_shell
+    endif
+    module purge
+else if ( { test -d /lustre -a -d /ncrc } ) then
+    # We are on GAEA. 
+    if ( ! { module help >& /dev/null } ) then
+        # We cannot simply load the module command.  The GAEA
+        # /etc/csh.login modifies a number of module-related variables
+        # before loading the module command.  Without those variables,
+        # the module command fails.  Hence we actually have to source
+        # /etc/csh.login here.
+        source /etc/csh.login
+    endif
+    module purge
+else
+    # Workaround for csh limitation.  Use sh to print to stderr.
+    sh -c 'echo WARNING: UNKNOWN PLATFORM 1>&2'
+endif
Index: checkout/src
===================================================================
--- checkout/src	(revision 86251)
+++ checkout/src	(revision 86845)

Property changes on: checkout/src
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,2 ##
   Merged /nems/branches/regtests/src:r86448-86844
   Merged /nems/branches/modulecmd/src:r86269-86662
Index: checkout/NEMSAppBuilder
===================================================================
--- checkout/NEMSAppBuilder	(revision 86251)
+++ checkout/NEMSAppBuilder	(revision 86845)
@@ -1328,10 +1328,7 @@
         16 40 "Build environment" 
     if [[ "$?" == "0" ]] ; then
       autonote "Load $NEMSDIR/src/conf/modules.nems"
-      module purge
-      module use $NEMSDIR/src/conf
-      module load modules.nems
-#      module unuse $NEMSDIR/src/conf
+      source $NEMSDIR/src/conf/modules.nems.sh
       echo =============================================
       module list
       echo =============================================
Index: checkout/OldCompsetRun
===================================================================
--- checkout/OldCompsetRun	(revision 86251)
+++ checkout/OldCompsetRun	(revision 86845)
@@ -1,835 +1 @@
-#!/bin/bash
-# set -x
-#
-# ---------------------------------------------------------------
-# Script that runs the NOAA Environmental Modeling System (NEMS)
-# through a compset based list of configurations.
-#
-# The NEMSCompsetRun script utilizes the existing NEMS script infrastructure
-# in order to set up the run directory, gsm or nmm input files, and batch
-# scripts.
-#
-#   --> rt_gfs.sh [ here generate lower files from IN files ]
-#       --> gfs_qsub or gfs_msub or gfs_bsub  [ generated from IN files ]
-#           --> gfs_fcst_run [ generated from IN file ]
-#               --> exglobal_fcst_nems.sh
-#                   --> mpirun NEMS.x
-#
-# -- or --
-#
-#   --> rt_nmm.sh [ here generate lower files from IN files ]
-#       --> nmm_run [ generated from IN file ]
-#           --> nmm_qsub or nmm_msub or nmm_bsub  [ generated from IN files ]
-#               --> mpirun NEMS.x
-#
-# ---------------------------------------------------------------
-
-# -- procedures first --
-
-set_defaults ()
-{
-TASKS_dflt=48  ; TPN_dflt=   ; INPES_dflt=05 ; JNPES_dflt=09 ; WTPG_dflt=3
-TASKS_thrd=48  ; TPN_thrd=   ; INPES_thrd=05 ; JNPES_thrd=09 ; WTPG_thrd=3
-TASKS_nest=96  ; TPN_nest=   ; INPES_nest=02 ; JNPES_nest=02 ; WTPG_nest=1
-TASKS_fltr=64  ; TPN_fltr=   ; INPES_fltr=02 ; JNPES_fltr=02 ; WTPG_fltr=1
-TASKS_mvg1=96  ; TPN_mvg1=   ; INPES_mvg1=05 ; JNPES_mvg1=07 ; WTPG_mvg1=1
-TASKS_mvg2=96  ; TPN_mvg2=   ; INPES_mvg2=05 ; JNPES_mvg2=18 ; WTPG_mvg2=2
-}
-
-export_common ()
-{
-set_defaults
-export THRD=1
-export WTPG=$WTPG_dflt
-export WLCLK=10
-export GEFS_ENSEMBLE=0
-export GEN_ENSEMBLE=0
-export WRITE_DOPOST=.false.
-export POST_GRIBVERSION='"grib1"'
-check_executable
-}
-
-export_nmm ()
-{
-export_common
-export INPES=$INPES_dflt ; export JNPES=$JNPES_dflt ; export WTPG=$WTPG_dflt
-export TASKS=$TASKS_dflt ; export TPN=$TPN_dflt
-export GBRG=reg          ; export NEMSI=false       ; export RSTRT=false
-export AFFN=core         ; export NODE=1
-export NCHILD=0          ; export MODE=1-way        ; export WGT=0.0
-export FCSTL=48
-export PCPFLG=false      ; export WPREC=false
-export TS=false
-export RADTN=rrtm        ; export CONVC=bmj         ; export TURBL=myj
-export MICRO=fer_hires   ; export gfsP=false        ; export SPEC_ADV=false
-export SFC_LAYER=gfdl    ; export LAND_SURFACE=gfdlslab
-}
-
-export_gsm ()
-{
-export_common
-export TASKS=32  ; export PE1=32       ; export NSOUT=0       ; export QUILT=.false.
-export NDAYS=2   ; export CP2=.false.  ; export IAER=0        ; export FHRES=180
-export WRTGP=1   ; export FDFI=0       ; export ADIAB=.false. ; export REDUCEDGRID=.true.
-export wave=62   ; export THRD=1       ; unset  NHRS
-export lm=64     ; export lsoil=4         ; export MEMBER_NAMES=c00
-export IDVC=2    ; export THERMODYN_ID=1  ; export SFCPRESS_ID=1 ; export SPECTRALLOOP=2
-export NEMSIOIN=.false.  ; export NEMSIOOUT=.false. ; export rungfstest=.true.
-export SIGIOIN=.true.    ; export SIGIOOUT=.true.   ; export SFCIOOUT=.true.
-export FHSWR=3600        ;  export FHLWR=3600       ; LDFI_SPECT=.true.
-export CDATE=2012010100
-export GOCART_AER2POST=.false.
-export NST_FCST=0  ; export NDSLFV=.false.  ; export IDEA=.false.
-export SLG=.false.
-export A2OI_OUT=.false. ; export NGRID_A2OI=48
-}
-
-export_fim ()
-{
-export_common
-export FIM_USE_NEMS=true
-}
-
-export_nems ()
-{
-export nems_configure=default
-export atm_model=none
-export atm_petlist_bounds="-1 -1"
-export lnd_model=none
-export lnd_petlist_bounds="-1 -1"
-export ice_model=none
-export ice_petlist_bounds="-1 -1"
-export ocn_model=none
-export ocn_petlist_bounds="-1 -1"
-export wav_model=none
-export wav_petlist_bounds="-1 -1"
-export ipm_model=none
-export ipm_petlist_bounds="-1 -1"
-export hyd_model=none
-export hyd_petlist_bounds="-1 -1"
-export med_model=none
-export med_petlist_bounds="-1 -1"
-export atm_coupling_interval_sec=-1
-export ocn_coupling_interval_sec=-1
-export coupling_interval_sec=-1
-export coupling_interval_slow_sec=-1
-export coupling_interval_fast_sec=-1
-}
-
-check_executable ()
-{
-if [ -f ${PATHTR}/exe/NEMS.x ] ; then
-  echo "   The NEMS.x executable IS available."
-else
-  echo "   The NEMS.x executable is NOT available. Must first compile NEMS!"
-  echo "...bailing out!"
-  exit 1    
-fi
-}
-
-# -- component specific setup functions
-
-setup_med_nems_old(){
-  echo "setup_med_nems ... "
-  nemsgrid="nx1"
-  nemsgridinp=""
-  echo "NEMS_GRID = $NEMS_GRID"
-  if [ -n "$NEMS_GRID" ] ; then
-    if [[ $NEMS_GRID = *nx1* ]] ; then
-      nemsgrid="nx1"
-    elif [[ $NEMS_GRID = *mx5* ]] ; then
-      nemsgrid="mx5"
-      nemsgridinp="D"
-    fi
-  fi
-  #echo "NEMSCompsetRun nemsgrid = ${nemsgrid}"
-  #echo "NEMSCompsetRun nemsgridinp = ${nemsgridinp}"
-
-  if [ $SLG = .true. ] ; then
-    MED_INPUT=${DATADIR}/MED_NEMS_SLG_v002/${nemsgrid}${nemsgridinp}
-  else
-    MED_INPUT=${DATADIR}/MED_NEMS_v002/${nemsgrid}${nemsgridinp}
-  fi
-  echo "NEMSCompsetRun setup_med_nems MED_INPUT = ${MED_INPUT}"
-
-  cp -pf ${MED_INPUT}/* ${RUNDIR}
-  echo  "...done."
-}
-
-setup_med_nems(){
-  echo "setup_med_nems ... "
-  VERSION=03
-  SV=${VERSION}.0
-  if [ -n "$V_FILES_MED" ] ; then
-    SV=${V_FILES_MED}
-  fi
-  MED_INPUT=${DATADIR}/MED_NEMS/V${VERSION}/${NEMS_CASE}/${NEMS_GRID}/V${SV}
-  echo "NEMSCompsetRun setup_med_nems MED_INPUT = ${MED_INPUT}"
-  cp -pf ${MED_INPUT}/* ${RUNDIR}
-  echo  "...done."
-}
-
-setup_hycom_GLBT0.72(){
-  echo -n "setup_hycom_GLBT0.72 ... "
-  if [ $MACHINE_ID = gaea ] ; then
-    ln -s /ptmp/HycomGLBT0.72DATA/* ${RUNDIR}/.
-  elif [ $MACHINE_ID = theia ] ; then
-    ln -s ${DATADIR}/HYCOM/GLBT0.72DATA/* ${RUNDIR}/.
-  elif [ $MACHINE_ID = yellowstone ] ; then
-    ln -s ${DATADIR}/HYCOM/GLBT0.72DATA/* ${RUNDIR}/.
-  elif [ $MACHINE_ID = wcoss ] ; then
-    ln -s /ptmp/HycomGLBT0.72DATA/* ${RUNDIR}/.
-  elif [ $MACHINE_ID = linux_gnu ] ; then  
-    ln -s /ptmp/HycomGLBT0.72DATA/* ${RUNDIR}/.
-  else
-    echo "unknown machine ... bailing out"
-    exit 1
-  fi
-  ln -s ${RUNDIR}/blkdat.input.new-Alex ${RUNDIR}/blkdat.input
-  echo  "done."
-}
-
-setup_hycom_Core2-0.72(){
-  echo -n "setup_hycom_Core2-0.72 ... "
-  if [ $MACHINE_ID = gaea ] ; then
-    ln -s /ptmp/Core2-0.72DATA/* ${RUNDIR}/.
-  elif [ $MACHINE_ID = theia ] ; then
-    ln -s ${DATADIR}/HYCOM/Core2-0.72DATA/* ${RUNDIR}/.
-  elif [ $MACHINE_ID = yellowstone ] ; then
-    ln -s ${DATADIR}/HYCOM/Core2-0.72DATA/* ${RUNDIR}/.
-  elif [ $MACHINE_ID = wcoss ] ; then
-    ln -s /ptmp/Core2-0.72DATA/* ${RUNDIR}/.
-  elif [ $MACHINE_ID = linux_gnu ] ; then  
-    ln -s /ptmp/Core2-0.72DATA/* ${RUNDIR}/.
-  else
-    echo "unknown machine ... bailing out"
-    exit 1
-  fi
-  echo  "done."
-}
-
-setup_hycom_Core2-1.6(){
-  echo -n "setup_hycom_Core2-1.6 ... "
-  if [ $MACHINE_ID = gaea ] ; then
-    ln -s /ptmp/Core2-1.6DATA/* ${RUNDIR}/.
-  elif [ $MACHINE_ID = theia ] ; then
-    ln -s ${DATADIR}/HYCOM/Core2-1.6DATA/* ${RUNDIR}/.
-  elif [ $MACHINE_ID = yellowstone ] ; then
-    ln -s ${DATADIR}/HYCOM/Core2-1.6DATA/* ${RUNDIR}/.
-  elif [ $MACHINE_ID = wcoss ] ; then
-    ln -s /ptmp/Core2-1.6DATA/* ${RUNDIR}/.
-  elif [ $MACHINE_ID = linux_gnu ] ; then  
-    ln -s /ptmp/Core2-1.6DATA/* ${RUNDIR}/.
-  else
-    echo "unknown machine ... bailing out"
-    exit 1
-  fi
-  echo  "done."
-}
-
-setup_mom5_old(){
-  ocngrid="nx1"
-  inpversion=""
-  echo "NEMS_GRID = $NEMS_GRID"
-  if [ -n "$NEMS_GRID" ] ; then
-    if [[ $NEMS_GRID = *nx1* ]] ; then
-      ocngrid="nx1"
-    elif [[ $NEMS_GRID = *mx5* ]] ; then
-      ocngrid="mx5"
-      inpversion="C"
-    fi
-  fi
-  #echo "NEMSCompsetRun ocngrid = ${ocngrid}"
-  #echo "NEMSCompsetRun ocn inpversion = ${inpversion}"
-
-  if [ $MACHINE_ID = gaea ] ; then
-    OCN_INPUT=/lustre/f1/unswept/ncep/Gerhard.Theurich/global_box1/INPUT
-  elif [ $MACHINE_ID = theia ] ; then
-    OCN_INPUT=${DATADIR}/MOM/${ocngrid}${inpversion}/INPUT
-  elif [ $MACHINE_ID = yellowstone ] ; then
-    OCN_INPUT=${DATADIR}/MOM/${ocngrid}${inpversion}/INPUT
-  elif [ $MACHINE_ID = wcoss ] ; then
-    OCN_INPUT=${DATADIR}/MOM/${ocngrid}${inpversion}/INPUT
-  fi
-  echo "NEMSCompsetRun setup_mom OCN_INPUT = ${OCN_INPUT}"
-
-  dst_dir="${RUNDIR}"
-  cp -r ${OCN_INPUT}/ ${dst_dir}
-  cp ${OCN_INPUT}/input.nml ${dst_dir}
-#  cp ${OCN_INPUT}/diag_table ${dst_dir}
-  cp ${OCN_INPUT}/diag_table.1hr ${dst_dir}/diag_table
-  if [ $FHOUT = 6 ] ; then
-    cp ${OCN_INPUT}/diag_table.6hr ${dst_dir}/diag_table
-  fi
-  cp ${OCN_INPUT}/field_table ${dst_dir}
-  cp ${OCN_INPUT}/data_table ${dst_dir}
-  mkdir ${dst_dir}/RESTART
-}
-
-setup_mom5(){
-  echo "setup_mom5 ... "
-  VERSION=01
-  SV=${VERSION}.0
-  if [ -n "$V_FILES_MOM5" ] ; then
-    SV=${V_FILES_MOM5}
-  fi
-  if [ -n "$NEMS_GRID" ] ; then
-    if [[ $NEMS_GRID = *mom5%0.5* ]] ; then
-      OCN_GRID=mom5%0.5
-    fi
-  fi
-  OCN_INPUT=${DATADIR}/MOM5/V${VERSION}/${NEMS_CASE}/${OCN_GRID}/V${SV}
-  echo "NEMSCompsetRun setup_mom5 OCN_INPUT = ${OCN_INPUT}"
-  mkdir ${RUNDIR}/INPUT
-  cp -pf ${OCN_INPUT}/* ${RUNDIR}/INPUT
-  cp ${OCN_INPUT}/input.nml ${RUNDIR}
-  cp ${OCN_INPUT}/diag_table.1hr ${RUNDIR}/diag_table
-  if [ $FHOUT = 6 ] ; then
-    cp ${OCN_INPUT}/diag_table.6hr ${RUNDIR}/diag_table
-  fi
-  cp ${OCN_INPUT}/field_table ${RUNDIR}
-  cp ${OCN_INPUT}/data_table ${RUNDIR}
-  mkdir ${RUNDIR}/RESTART
-  echo  "...done."
-}
-
-setup_cice_old(){
-  icegrid="nx1"
-  inpversion=""
-  echo "NEMS_GRID = $NEMS_GRID"
-  if [ -n "$NEMS_GRID" ] ; then
-    if [[ $NEMS_GRID = *nx1* ]] ; then
-      icegrid="nx1"
-    elif [[ $NEMS_GRID = *mx5* ]] ; then
-      icegrid="mx5"
-      inpversion="D"
-    fi
-  fi
-  #echo "NEMSCompsetRun icegrid = ${icegrid}"
-  #echo "NEMSCompsetRun ice inpversion = ${inpversion}"
-
-  if [ $MACHINE_ID = gaea ] ; then
-    ICE_INPUT=/lustre/f1/unswept/ncep/Gerhard.Theurich/lanl_cice_data
-  elif [ $MACHINE_ID = theia ] ; then
-    ICE_INPUT=${DATADIR}/CICE/${icegrid}${inpversion}
-  elif [ $MACHINE_ID = yellowstone ] ; then
-    ICE_INPUT=${DATADIR}/CICE/${icegrid}${inpversion}
-  elif [ $MACHINE_ID = wcoss ] ; then
-    ICE_INPUT=${DATADIR}/CICE/${icegrid}${inpversion}
-  fi
-  echo "NEMSCompsetRun setup_cice ICE_INPUT = ${ICE_INPUT}"
-
-  dst_dir="${RUNDIR}"
-  cp -f ${ICE_INPUT}/* ${dst_dir}
-
-  if [ $SLG = .true. ] ; then
-    cp -f ${ICE_INPUT}/ice_in_${icegrid}_slg ${dst_dir}/ice_in
-  else
-    cp -f ${ICE_INPUT}/ice_in_${icegrid} ${dst_dir}/ice_in
-  fi
-
-  mkdir ${dst_dir}/restart
-  mkdir ${dst_dir}/history
-}
-
-setup_cice(){
-  echo "setup_cice ... "
-  VERSION=01
-  SV=${VERSION}.0
-  if [ -n "$V_FILES_CICE" ] ; then
-    SV=${V_FILES_CICE}
-  fi
-  if [ -n "$NEMS_GRID" ] ; then
-    if [[ $NEMS_GRID = *cice%0.5* ]] ; then
-      ICE_GRID=cice%0.5
-    fi
-  fi
-  ICE_INPUT=${DATADIR}/CICE/V${VERSION}/${NEMS_CASE}/${ICE_GRID}/V${SV}
-  echo "NEMSCompsetRun setup_cice ICE_INPUT = ${ICE_INPUT}"
-  cp -pf ${ICE_INPUT}/* ${RUNDIR}
-  if [ $SLG = .true. ] ; then
-    cp -f ${ICE_INPUT}/ice_in_slg ${RUNDIR}/ice_in
-  else
-    cp -f ${ICE_INPUT}/ice_in ${RUNDIR}/ice_in
-  fi
-  mkdir ${RUNDIR}/restart
-  mkdir ${RUNDIR}/history
-  echo  "...done."
-}
-
-setup_ipe(){
-  # this implementation assumes that IPE is right under ROOTDIR
-  ln -s ${ROOTDIR}/IPE/IPE.inp ${RUNDIR}/.
-  ln -s ${ROOTDIR}/IPE/SMSnamelist ${RUNDIR}/.
-  ln -s ${ROOTDIR}/IPE/coeff_hflux.dat ${RUNDIR}/.
-  ln -s ${ROOTDIR}/IPE/coeff_lflux.dat ${RUNDIR}/.
-  ln -s ${ROOTDIR}/IPE/wei96.cofcnts ${RUNDIR}/.
-  if [ $MACHINE_ID = gaea ] ; then
-    ln -s /lustre/f1/unswept/ncep/Gerhard.Theurich/IPEdata/data/stup* ${RUNDIR}/.
-    ln -s /lustre/f1/unswept/ncep/Gerhard.Theurich/IPEdata/data/ipe_grid ${RUNDIR}/.
-  elif [ $MACHINE_ID = theia ] ; then
-    ln -s /scratch3/NCEPDEV/swpc/noscrub/Naomi.Maruyama/ipe/grid/apex/1/GIP_apex_coords_global_lowres_new20120705 ${RUNDIR}/ipe_grid
-    ln -s /scratch3/NCEPDEV/swpc/noscrub/Naomi.Maruyama/ipe/runs/tmp20150730/trunk/run/1445014793_ipe_theia_intel_parallel_80/stup* ${RUNDIR}/.
-  elif [ $MACHINE_ID = yellowstone ] ; then
-    ln -s /glade/u/home/naomi/work/ipe/IPEDATA/data/stup* ${RUNDIR}/.
-    ln -s /glade/u/home/naomi/work/ipe/IPEDATA/data/ipe_grid ${RUNDIR}/.
-  fi
-}
-
-setup_spaceweather(){
-  if [ $MACHINE_ID = gaea ] ; then
-    ln -s /lustre/f1/unswept/ncep/Gerhard.Theurich/SpaceWeatherResources/data ${RUNDIR}/.
-  elif [ $MACHINE_ID = theia ] ; then
-    ln -s /scratch4/NCEPDEV/nems/noscrub/Gerhard.Theurich/SpaceWeatherResources/data ${RUNDIR}/.
-  elif [ $MACHINE_ID = yellowstone ] ; then
-    ln -s /glade/p/work/theurich/SpaceWeatherResources/data ${RUNDIR}/.
-  fi
-}
-
-# ##############################################################################
-# function: link_wrfhydro
-# 1. Link in every file from the wrfhydro run data directory
-# 2. Static copy of hydro.namelist and namelist.hrldas files
-# ##############################################################################
-
-link_wrfhydro(){
-  echo "${FUNCNAME[0]}"
-  if [ "$#" -ne 1 ]; then
-    echo "  ERROR FUNCTION USAGE: ${FUNCNAME[0]} [Hydro directory]"
-    return 1
-  fi
-
-  local HYDRODIR="$1"
-
-  if [ ! -d "$HYDRODIR" ] ; then
-    echo "  ERROR: Hydro directory is missing: [$HYDRONMLST]"
-    return 1
-  fi
-
-  echo "  Hydro directory: $HYDRODIR"
-  ln -fs "$HYDRODIR/*" ${RUNDIR}/.
-  cp "$HYDRODIR/hydro.namelist" ${RUNDIR}/hydro.namelist
-  cp "$HYDRODIR/namelist.hrldas" ${RUNDIR}/namelist.hrldas
-}
-
-# ##############################################################################
-# function: setup_wrfhydro
-# 1. Copy the hydro.namelist and namelist.hrldas files to the run directory
-# 2. Link hydro input files based on hydro.namelist if the full path
-#    is not specified in namelist file
-# 3. Link parameters files to run directory 
-# 4. Link hrldas input files based on namelist.hrldas if the full path
-#    is not specified in the namelist file
-# ##############################################################################
-
-setup_wrfhydro(){
-  echo "${FUNCNAME[0]}"
-  if [ "$#" -ne 3 ]; then
-    echo "  ERROR FUNCTION USAGE: ${FUNCNAME[0]} [Hydro namelist file] [Parameters directory] [HRLDAS namelist file]"
-    return 1
-  fi
-
-  local HYDRONMLST="$1"
-  local PARAMSDIR="$2"
-  local HRLDASNMLST="$3"
-  local HYDRONMLSTDIR=`dirname "$HYDRONMLST"`
-  local HRLDASNMLSTDIR=`dirname "$HRLDASNMLST"`
-
-  if [ ! -e "$HYDRONMLST" ] ; then
-    echo "  ERROR: Hydro namelist file is missing: [$HYDRONMLST]"
-    return 1
-  fi
-  if [ ! -d "$PARAMSDIR" ] ; then
-    echo "  ERROR: Parameters directory is missing: [$PARAMSDIR]"
-    return 1
-  fi
-  if [ ! -e "$HRLDASNMLST" ] ; then
-    echo "  ERROR: HRLDAS namelist file is missing: [$HRLDASNMLST]"
-    return 1
-  fi
-
-  echo "  Hydro namelist file: $HYDRONMLST"
-  echo "  HRLDAS namelist file: $HRLDASNMLST"
-  echo "  Parameters directory: $PARAMSDIR"
-  cp "$HYDRONMLST" ${RUNDIR}/hydro.namelist
-  cp "$HRLDASNMLST" ${RUNDIR}/namelist.hrldas
-
-  HYDROOPTIONS=( \
-    "GEO_STATIC_FLNM" \
-    "GEO_FINEGRID_FLNM" \
-    "gwbasmskfil")
-
-  for OPTION in "${HYDROOPTIONS[@]}"
-  do
-    local LINK=`grep -i "$OPTION" "$HYDRONMLST" | sed "s/^.*$OPTION[ \t]*=[ \t]*//" | tr -d '"' | tr -d "'"`
-    if [[ ! $LINK == /* ]]; then
-      LINK=${LINK/#.\//""}
-      LINK=${LINK%%\/*}
-      ln -fs "$HYDRONMLSTDIR/$LINK" ${RUNDIR}/.
-      # echo "    Symbolic link created [$OPTION $LINK]"
-    fi
-  done
-
-  PARAMSLIST=( \
-    "CHANPARM.TBL" \
-    "GENPARM.TBL" \
-    "LAKEPARM.TBL" \
-    "SOILPARM.TBL" \
-    "VEGPARM.TBL" \
-    "DISTR_HYDRO_CAL_PARMS.TBL" \
-    "GWBUCKPARM.TBL" \
-    "HYDRO.TBL" \
-    "MPTABLE.TBL" \
-    "RGBRAIN.txt" \
-    "URBPARM.TBL")
-
-  for FILE in "${PARAMSLIST[@]}"
-  do
-    ln -fs "$PARAMSDIR/$FILE" ${RUNDIR}/.
-    # echo "    Symbolic link created [$FILE]"
-  done
-
-  HRLDASOPTIONS=( \
-    "HRLDAS_CONSTANTS_FILE" \
-    "INDIR" \
-    "GEO_STATIC_FLNM")
-
-  for OPTION in "${HRLDASOPTIONS[@]}"
-  do
-    local LINK=`grep -i "$OPTION" "$HRLDASNMLST" | sed "s/^.*$OPTION[ \t]*=[ \t]*//" | tr -d '"' | tr -d "'"`
-    if [[ ! $LINK == /* ]]; then
-      LINK=${LINK/#.\//""}
-      LINK=${LINK%%\/*}
-      ln -fs "$HRLDASNMLSTDIR/$LINK" ${RUNDIR}/.
-      # echo "    Symbolic link created [$OPTION $LINK]"
-    fi
-  done
-}
-
-# ##############################################################################
-# function: link_lis
-# 1. Link in every file from the lis run data directory
-# 2. Static copy of lis.config file
-# ##############################################################################
-
-link_lis(){
-  echo "${FUNCNAME[0]}"
-  if [ "$#" -ne 1 ]; then
-    echo "  ERROR FUNCTION USAGE: ${FUNCNAME[0]} [LIS directory]"
-    return 1
-  fi
-
-  local LISDIR="$1"
-
-  if [ ! -d "$LISDIR" ] ; then
-    echo "  ERROR: LIS directory is missing: [$HYDRONMLST]"
-    return 1
-  fi
-
-  echo "  LIS directory: $LISDIR"
-  ln -fs "$LISDIR/*" ${RUNDIR}/.
-  cp "$LISDIR/lis.config" ${RUNDIR}/lis.config
-}
-
-# ##############################################################################
-# function: setup_lis
-# 1. Copy the lis.config file to the run directory
-# 2. Link input files based on lis.config file if full path
-#    is not specified in lis.config file
-# ##############################################################################
-
-setup_lis(){
-  echo "${FUNCNAME[0]}"
-  if [ "$#" -ne 1 ]; then
-    echo "  ERROR FUNCTION USAGE: ${FUNCNAME[0]} [LIS configuration file]"
-    return 1
-  fi
-
-  local LISCONFIG="$1"
-  local CONFIGDIR=`dirname "$LISCONFIG"`
-
-  if [ ! -e "$LISCONFIG" ] ; then
-    echo "  ERROR: LIS configuration file is missing: [$LISCONFIG]"
-    return 1
-  fi
-
-  echo "  LIS configuration file: $LISCONFIG"
-  cp "$LISCONFIG" ${RUNDIR}/lis.config
-
-  # Here is the array of lis.config options to be linked
-  CONFIGOPTIONS=( \
-    "Forcing variables list file:" \
-    "Model output attributes file:" \
-    "LIS domain and parameter data file:" \
-    "vegetation parameter table:" \
-    "soil parameter table:" \
-    "general parameter table:" \
-    "forcing directory:")
-
-  for OPTION in "${CONFIGOPTIONS[@]}"
-  do
-    local LINK=`grep -i "$OPTION" "$LISCONFIG" | sed "s/^.*$OPTION[ \t]*//" | tr -d '"'`
-    if [[ ! $LINK == /* ]]; then
-      LINK=${LINK/#.\//""}
-      LINK=${LINK%%\/*}
-      ln -fs "$CONFIGDIR/$LINK" ${RUNDIR}/.
-      # echo "    Symbolic link created [$OPTION $LINK]"
-    fi
-  done
-}
-
-setup_ww3Case1(){
-  if [ $MACHINE_ID = theia ] ; then
-    cp -r ${DATADIR}/WW3/Case1_20160412/* ${RUNDIR}/.
-  fi
-}
-
-setup_ww3Case2(){
-  if [ $MACHINE_ID = theia ] ; then
-    cp -r ${DATADIR}/WW3/Case2_20160412/* ${RUNDIR}/.
-  fi
-}
-
-setup_ww3Case3(){
-  if [ $MACHINE_ID = theia ] ; then
-    cp -r ${DATADIR}/WW3/Case3_20160412/* ${RUNDIR}/.
-  fi
-}
-
-setup_ww3Case6(){
-  if [ $MACHINE_ID = theia ] ; then
-    cp -r /scratch4/NCEPDEV/nems/noscrub/Jessica.Meixner/esmf_files/Case6_20160328/* ${RUNDIR}/.
-  fi
-}
-
-# -------------- script main --------------
-
-echo "========================================================================="
-
-# Initialize
-ROOTDIR=`pwd`
-NEMSDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
-export PATHCS=${NEMSDIR}/../oldcompsets             # Path to compsets directory
-export PATHTR=${NEMSDIR}                      # Path to NEMS trunk
-export PATHRT=${NEMSDIR}/oldtests                # Path to NEMS test scripts
-
-# Two variables used by the rt_gfs.sh and rt_nmm.sh scripts
-export CREATE_BASELINE=false
-export BAIL_CONDITION=NONE
-
-# Determine the MACHINE_ID variable, used locally and in rt_gfs.sh
-source $PATHTR/oldtests/detect_machine.sh
-export MACHINE_ID=${MACHINE_ID:-wcoss}
-
-if [ $MACHINE_ID = wcoss ]; then
-  source /usrx/local/Modules/default/init/sh
-  export DATADIR=/climate/noscrub/emc.climpara/NEMS-Data
-
-  # export QUEUE=debug
-  # export QUEUE=dev
-  export QUEUE=devhigh
-  # export ACCNR=dev
-  if [ $pex -eq 2 ] ; then     # pex comes from detect_machine
-   export QUEUE=debug2
-   # export QUEUE=dev2
-   # export ACCNR=dev2
-   export TPN=24
-   #export TASKS=48  ; export PE1=48
-  fi
-  export STMP=/stmpp$pex
-  export PTMP=/ptmpp$pex
-
-  export SCHEDULER=lsf
-  export SIGHDR=/nwprod/exec/global_sighdr
-  export SLG=.false.
-
-  cp $PATHRT/gfs_fcst_run.IN_IBM $PATHRT/gfs_fcst_run.IN
-  cp $PATHRT/gfs_bsub.IN_wcoss $PATHRT/gfs_bsub.IN
-  cp $PATHRT/nmm_conf/nmm_bsub.IN_wcoss $PATHRT/nmm_conf/nmm_bsub.IN
-  export RTPWD=$DATADIR/RT-Baselines
-  export FIXGLOBAL=/global/noscrub/Shrinivas.Moorthi/para_new/para/fix/fix_am
-  export ICS_VERSION=15.0.3
-elif [ $MACHINE_ID = gaea ]; then
-  export DATADIR=/lustre/f1/unswept/ncep/NEMS-Data
-  export CLASS=debug
-  export ACCNR
-  export STMP=/lustre/f1/ncep/$LOGNAME/ptmp
-  export PTMP=/lustre/f1/ncep/$LOGNAME/ptmp
-  export SCHEDULER=moab
-  export SIGHDR=/lustre/f1/unswept/ncep/Shrinivas.Moorthi/para_branch/para_new/sorc/global_sighdr.fd/global_sighdr
-  # -
-  cp $PATHRT/gfs_fcst_run.IN_Linux $PATHRT/gfs_fcst_run.IN
-  export RTPWD=$DATADIR/RT-Baselines
-  export FIXGLOBAL=/lustre/f1/unswept/ncep/Shrinivas.Moorthi/para_branch/para_new/fix/fix_am
-elif [ $MACHINE_ID = theia ]; then
-  export DATADIR=/scratch4/NCEPDEV/nems/noscrub/NEMS-Data
-  export ACCNR
-  # export ACCNR=cmp
-  #export QUEUE=batch
-  export QUEUE=debug
-  export STMP=/scratch3/NCEPDEV/stmp1
-  export PTMP=/scratch3/NCEPDEV/stmp1
-  # export STMP=/scratch3/NCEPDEV/swpc/scrub
-  # export PTMP=/scratch3/NCEPDEV/swpc/scrub
-  export SCHEDULER=pbs
-  export MPIEXEC=mpirun
-  export SIGHDR=/scratch4/NCEPDEV/global/save/Shrinivas.Moorthi/para/sorc/global_sighdr.fd/global_sighdr
-  export SLG=.false.
-  # -
-  cp $PATHRT/gfs_fcst_run.IN_Linux $PATHRT/gfs_fcst_run.IN
-  export RTPWD=$DATADIR/RT-Baselines
-  export FIXGLOBAL=/scratch4/NCEPDEV/global/save/Shrinivas.Moorthi/para/fix/fix_am
-elif [ $MACHINE_ID = yellowstone ]; then
-  export DATADIR=/glade/p/work/theurich/NEMS-Data
-  export ACCNR=P35071400
-  # export ACCNR=UCUB0024
-  export QUEUE=small
-  export STMP=/glade/scratch
-  export PTMP=/glade/scratch
-  export SCHEDULER=lsf
-  export MPIEXEC=mpirun
-  export SIGHDR=/glade/p/work/theurich/para/global_sighdr.fd/global_sighdr
-  export SLG=.false.
-  # -
-  cp $PATHRT/gfs_fcst_run.IN_Linux $PATHRT/gfs_fcst_run.IN
-  cp $PATHRT/gfs_bsub.IN_yellowstone $PATHRT/gfs_bsub.IN
-  cp $PATHRT/nmm_conf/nmm_bsub.IN_yellowstone $PATHRT/nmm_conf/nmm_bsub.IN
-  export RTPWD=$DATADIR/RT-Baselines
-  export FIXGLOBAL=/glade/p/work/theurich/para/fix_am
-elif [ $MACHINE_ID = linux_gnu ]; then
-  export DATADIR=/ptmp
-  export PTMP=/ptmp
-  export MPIEXEC=mpirun
-  export SIGHDR=/ptmp/gerhard/para/global_sighdr.fd/global_sighdr
-  export SLG=.false.
-  # -
-  cp $PATHRT/gfs_fcst_run.IN_Linux $PATHRT/gfs_fcst_run.IN
-  cp $PATHRT/gfs_bsub.IN_yellowstone $PATHRT/gfs_bsub.IN
-  cp $PATHRT/nmm_conf/nmm_bsub.IN_yellowstone $PATHRT/nmm_conf/nmm_bsub.IN
-  export RTPWD=/ptmp/gerhard/REGRESSION_TEST_NUOPC_development_v0020
-  export FIXGLOBAL=/ptmp/gerhard/para/fix_am
-else
-  echo "Unknown machine ID: " $MACHINE_ID
-  echo "Must edit file '$PATHTR/oldtests/detect_machine.sh'"
-  echo "and/or '$PATHTR/NEMSCompsetRun'."
-  echo "...bailing out!"
-  exit 1    
-fi
-
-echo "========================================================================="
-
-# Make the RUNDIR_ROOT on the temporary file system
-export RUNDIR_ROOT=${PTMP}/${USER}/rt_$$
-mkdir -p ${RUNDIR_ROOT}
-
-echo "RUNDIR_ROOT: '${RUNDIR_ROOT}'"
-
-export TEST_NR=""
-export REGRESSIONTEST_LOG=${PATHRT}/RegressionTests_$MACHINE_ID.log
-
-echo "========================================================================="
-
-# Determine file that contains the list of compsets
-if ([ $# == 0 ]); then
-  compsetfileCounter=0
-  shopt -s nullglob # all expansion to null string
-  for i in $ROOTDIR/*.compsetRun; do
-    if [ "x$i" != "x" ]; then
-      let compsetfileCounter++
-      compsetfilelist=( "${compsetfilelist[@]}" $i )
-    fi
-  done
-  if [ $compsetfileCounter == 0 ]; then
-    file=$PATHCS/"default.compsetRun"
-  else
-    file=${compsetfilelist[0]}
-  fi
-  echo "Looping through the compset list in file '$file'..."
-elif ([ $# == 1 ]); then
-  file=$1
-  echo "Looping through the compset list in file '$file'..."
-elif ([ $# == 2 ]); then
-  file=$1
-  if [ "$file" == "-compset" ]; then
-    compsets="$2"
-    echo "Single compset: '$2'..."
-    # default
-    compsetdir=$ROOTDIR
-  else
-    echo "Usage: ./NEMSCompsetRun [FILE]"
-    echo "  Where FILE contains a list of compsets to be run, one compset per line."
-    echo "  Without FILE the default configuration in file 'default.compsetRun' "
-    echo "  in subdir ../oldcompsets in the NEMS root directory is used."
-    echo "OR:    ./NEMSCompsetRun -compset [COMPSET]"
-    echo "  Where COMPSET is an existing compset."
-    echo "...bailing out!"
-    exit 1
-  fi
-else
-  echo "Usage: ./NEMSCompsetRun [FILE]"
-  echo "  Where FILE contains a list of compsets to be run, one compset per line."
-  echo "  Without FILE the default configuration in file 'default.compsetRun' "
-  echo "  in subdir ../oldcompsets in the NEMS root directory is used."
-  echo "OR:    ./NEMSCompsetRun -compset [COMPSET]"
-  echo "  Where COMPSET is an existing compset."
-  echo "...bailing out!"
-  exit 1
-fi
-
-if [ "$file" != "-compset" ]; then
-  # Ensure the file exists
-  if ([ ! -f $file ]); then
-    echo "The file '$file' does not exist!"
-    echo "...bailing out!"
-    exit 1
-  fi
-
-  # Construct a list variable of compsets, skip comments
-  compsets=`cat $file | grep -v '^#'| grep -v '^DIR=' | awk '{ print $1 }' | xargs`
-  echo $compsets
-
-  # Look for DIR variable in the file
-  compsetdir=`cat $file | grep -e '^DIR=' | tail -1 | sed 's/DIR=//g'`
-  if ([ $compsetdir"x" == "x" ]); then
-    # default
-    compsetdir=$PATHCS
-  fi
-fi
-  
-echo "Looking for compsets in directory: '$compsetdir'."
-
-echo "========================================================================="
-
-# Loop over the list of compsets
-echo "Starting :" > $REGRESSIONTEST_LOG
-date >> $REGRESSIONTEST_LOG
-i=0
-for compset in $compsets; do
-  echo "======================================================================"
-  echo "======================================================================"\
-  >> $REGRESSIONTEST_LOG
-  echo "Setting up to run NEMS on compset: '$compset'."
-  echo "Setting up to run NEMS on compset: '$compset'." >> $REGRESSIONTEST_LOG
-  if ([ -f $compsetdir/$compset ]); then
-    echo "Found compset file '$compsetdir/$compset'."
-    export RUNDIR=${RUNDIR_ROOT}/$compset
-    mkdir -p ${RUNDIR}
-    let i++
-    export JBNME=`basename $RUNDIR_ROOT`_$i
-    unset IC_DIR
-    unset passive_tracer
-    source $compsetdir/$compset
-    echo "RUNDIR: '$RUNDIR'."
-    echo "RUNDIR: '$RUNDIR'." >> $REGRESSIONTEST_LOG
-    cd $PATHRT
-    ./${RUN_SCRIPT} || echo "... detected problems!!!"
-  else
-    echo "Did NOT find compset file '$compsetdir/$compset'."
-    echo "...bailing out!"
-    exit 1
-  fi
-done
-echo "======================================================================"
-echo "======================================================================"\
->> $REGRESSIONTEST_LOG
-date >> $REGRESSIONTEST_LOG
+link ../OldCompsetRun
\ No newline at end of file

Property changes on: checkout/OldCompsetRun
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Index: checkout
===================================================================
--- checkout	(revision 86251)
+++ checkout	(revision 86845)

Property changes on: checkout
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /nems/branches/regtests:r86448-86844

--=_587e5426.FSScMzJ5Gp/8PhglyTpo6C6WjdHOvXQfS5qgGfUPkgmLl3G6--


More information about the Ncep.list.nems.announce mailing list