[Dart-dev] DART/branches Revision: 12273

dart at ucar.edu dart at ucar.edu
Thu Jan 4 09:35:43 MST 2018


nancy at ucar.edu
2018-01-04 09:35:41 -0700 (Thu, 04 Jan 2018)
668
update fixsystem to sed in and out the lines that differ
for the NAG compiler.  it's available on the CGD machines
and it has found several bugs/questionable code.  we should
be testing here more frequently, thus i'm making it easier
to just check out and build there.  all the system differences
that are incompatible with other compilers are currently
isolated here.

one other difference, just for the record, is that nag doesn't
use 8 as the kind for real(r8) - so code that assumes 4 and 8
are real kinds doesn't work here.  we don't have that in any
of our modules, but wrf had some wrf source code that made
this assumption.  i'll be committing that in a bit.




Modified: DART/branches/recam/assimilation_code/modules/utilities/fixsystem
===================================================================
--- DART/branches/recam/assimilation_code/modules/utilities/fixsystem	2018-01-03 23:36:15 UTC (rev 12272)
+++ DART/branches/recam/assimilation_code/modules/utilities/fixsystem	2018-01-04 16:35:41 UTC (rev 12273)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh  -v
 #
 # DART software - Copyright UCAR. This open source software is provided
 # by UCAR, "as is", without charge, subject to all terms of use at
@@ -37,11 +37,11 @@
 do
 
   # figure out what state the source file is in before we start
-  export bline="`fgrep SYSTEM_BLOCK_EDIT ${f} | grep START | head -n 1`"
-  if [ "`echo $bline | grep COMMENTED_OUT`" != ""  ]; then
-    export before=out
-  elif [ "`echo $bline | grep COMMENTED_IN`" != ""  ]; then
-    export before=in
+  export bline1="`fgrep SYSTEM_BLOCK_EDIT ${f} | grep START | head -n 1`"
+  if [ "`echo $bline1 | grep COMMENTED_OUT`" != ""  ]; then
+    export before1=out
+  elif [ "`echo $bline1 | grep COMMENTED_IN`" != ""  ]; then
+    export before1=in
   else
     echo ${f} not found, or does not have the right comment string to
     echo automatically change the system interface block via script.
@@ -49,21 +49,30 @@
     echo and try again.
     exit 1
   fi
+  
+  # NAG sections have both in and out - but NAG_BLOCK_EDIT is key
+  export bline2="`fgrep NAG_BLOCK_EDIT ${f} | grep START | head -n 1`"
+  if [ "`echo $bline2 | grep COMMENTED_OUT`" != ""  ]; then
+    export before2=out
+  elif [ "`echo $bline2 | grep COMMENTED_IN`" != ""  ]; then
+    export before2=in
+  else
+    echo ${f} not found, or does not have the right comment string to
+    echo automatically change the system interface block via script.
+    echo Please restore original file from the subversion repository
+    echo and try again.
+    exit 1
+  fi
 
+  # no args given - error.  required now.
   if [ $# = 0 ]; then
-    # no args given, swap to the other configuration.  deprecated
-    # and eventually a single argument will become required.
-    if [ $before = out ]; then
-      export todo=in
-      export compiler=non-gfortran
-    elif [ $before = in ]; then
-      export todo=out
-      export compiler=gfortran
-    else
-      echo Internal error; should not happen.  Contact DART support.
+      echo invalid usage, 1 argument required by $0
+      echo "usage: $0 [ your_fortran_command_name | -help  ]"
+      echo "  e.g. $0 gfortran"
+      echo "  or   $0 ifort "
+      echo "  or   $0 pgf90 "
+      echo "  etc."
       exit 1
-    fi
-
   elif [ $# = 1 ]; then
     # single arg: the name of your fortran compiler command
     if ([ "$1" = help ] || [ "$1" = -help ] || [ "$1" = --help ]); then
@@ -73,10 +82,15 @@
       echo "  or   $0 pgf90 "
       echo "  etc."
       exit 1
-    elif ([ "$1" = gfortran ] || [ "$1" = nagfor ]); then
-      export todo=out
+    elif [ "$1" = gfortran ]; then
+      export todo1=out
+      export todo2=out
+    elif [ "$1" = nagfor ]; then
+      export todo1=out
+      export todo2=in
     else
-      export todo=in
+      export todo1=in
+      export todo2=out
     fi
     export compiler=$1
 
@@ -91,10 +105,12 @@
     exit 1
   fi
   
+  echo $before1 $todo1 $before2 $todo2
+
   # if we are already in the right state, loop to next file
-  if ([ $before = out ] && [ $todo = out ]); then continue; fi
-  if ([ $before = in  ] && [ $todo = in  ]); then continue; fi
+  if ([ $before1 = $todo1 ] && [ $before2 = $todo2 ]); then continue; fi
  
+  echo something to do


More information about the Dart-dev mailing list