[Dart-dev] [4395] DART/trunk/utilities: Added a test directory for test utility programs. Made a p

nancy at ucar.edu nancy at ucar.edu
Mon Jun 28 13:55:19 MDT 2010


Revision: 4395
Author:   nancy
Date:     2010-06-28 13:55:19 -0600 (Mon, 28 Jun 2010)
Log Message:
-----------
Added a test directory for test utility programs.  Made a path names
and mkmf file for the existing PrecisionCheck test, plus one for
testing reading/writing nml files.  At this point there are no
tests which require obs kinds so the quickbuild does not build
or run preprocess.

Added Paths:
-----------
    DART/trunk/utilities/nml_test.f90
    DART/trunk/utilities/test/
    DART/trunk/utilities/test/Makefile
    DART/trunk/utilities/test/input.nml
    DART/trunk/utilities/test/mkmf_PrecisionCheck
    DART/trunk/utilities/test/mkmf_nml_test
    DART/trunk/utilities/test/path_names_PrecisionCheck
    DART/trunk/utilities/test/path_names_nml_test
    DART/trunk/utilities/test/quickbuild.csh

-------------- next part --------------
Added: DART/trunk/utilities/nml_test.f90
===================================================================
--- DART/trunk/utilities/nml_test.f90	                        (rev 0)
+++ DART/trunk/utilities/nml_test.f90	2010-06-28 19:55:19 UTC (rev 4395)
@@ -0,0 +1,90 @@
+! DART software - Copyright © 2004 - 2010 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
+
+program nml_test
+
+! <next few lines under version control, do not edit>
+! $URL$
+! $Id$
+! $Revision$
+! $Date$
+
+use     types_mod, only : r8
+use utilities_mod, only : register_module, error_handler, E_ERR, E_MSG,       &
+                          open_file, close_file, nc_check, get_next_filename, &
+                          find_namelist_in_file, check_namelist_read,         &
+                          do_nml_file, do_nml_term, nmlfileunit,              &
+                          initialize_utilities, finalize_utilities
+implicit none
+
+! version controlled file description for error handling, do not edit
+! split into separate lines; getting too long for the absoft compiler
+character(len=128), parameter :: source = &
+ "$URL$"
+character(len=128), parameter :: revision = "$Revision$"
+character(len=128), parameter :: revdate  = "$Date$"
+
+logical, save :: module_initialized = .false.
+
+character(len=128) :: msgstring, msgstring2, tmpstring
+integer :: iunit, io
+integer  :: test1
+logical  :: test2
+real(r8) :: test3
+
+! namelist items we are going to create/overwrite
+namelist /nml_test_nml/  test1, test2, test3
+
+! main code here
+ 
+!@! option to create a dummy input.nml at runtime.
+!@iunit = 11
+!@open (iunit, file='input.nml', form='formatted',     &
+!@      position='rewind', delim='apostrophe',    &
+!@      action='write', status='replace', iostat=io)
+!@write(iunit, "(A)") "&utilities_nml"
+!@write(iunit, "(A)") "/"
+!@close(iunit)
+
+! initialize the dart libs
+call initialize_utilities('nml_test')
+call initialize_module()
+
+! Create and write a namelist
+test1 = 2
+test2 = .true.
+test3 = 3.14159
+
+iunit = open_file("new_test.nml", "formatted", "write")
+write(iunit, nml = nml_test_nml, iostat = io)
+call close_file(iunit)
+
+! Read back the namelist entry
+call find_namelist_in_file("new_test.nml", "nml_test_nml", iunit)
+read(iunit, nml = nml_test_nml, iostat = io)
+call check_namelist_read(iunit, io, "nml_test_nml")
+
+! Record the namelist values used for the run ...
+if (do_nml_file()) write(nmlfileunit, nml=nml_test_nml)
+if (do_nml_term()) write(     *     , nml=nml_test_nml)
+
+call finalize_utilities('nml_test')
+
+! end of main code
+
+
+contains
+
+!----------------------------------------------------------------------
+
+subroutine initialize_module
+
+  call register_module(source, revision, revdate)
+  module_initialized = .true.
+
+end subroutine initialize_module
+
+!----------------------------------------------------------------------
+
+end program


Property changes on: DART/trunk/utilities/nml_test.f90
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author HeadURL Id
Added: svn:eol-style
   + native

Added: DART/trunk/utilities/test/Makefile
===================================================================
--- DART/trunk/utilities/test/Makefile	                        (rev 0)
+++ DART/trunk/utilities/test/Makefile	2010-06-28 19:55:19 UTC (rev 4395)
@@ -0,0 +1,44 @@
+# Makefile created by mkmf $Id: mkmf 4255 2010-02-05 00:39:42Z thoar $ 
+
+include ../../mkmf/mkmf.template
+
+CPPDEFS = -Duse_netCDF
+
+.DEFAULT:
+	-touch $@
+all: nml_test
+time_manager_mod.o: ../../time_manager/time_manager_mod.f90 types_mod.o utilities_mod.o
+	$(FC) $(FFLAGS) $(OTHERFLAGS) -c	../../time_manager/time_manager_mod.f90
+null_mpi_utilities_mod.o: ../../mpi_utilities/null_mpi_utilities_mod.f90 types_mod.o utilities_mod.o time_manager_mod.o
+	$(FC) $(FFLAGS) $(OTHERFLAGS) -c	../../mpi_utilities/null_mpi_utilities_mod.f90
+nml_test.o: ../../utilities/nml_test.f90 types_mod.o utilities_mod.o
+	$(FC) $(FFLAGS) $(OTHERFLAGS) -c	../../utilities/nml_test.f90
+utilities_mod.o: ../../utilities/utilities_mod.f90 types_mod.o
+	$(FC) $(FFLAGS) $(OTHERFLAGS) -c	../../utilities/utilities_mod.f90
+types_mod.o: ../../common/types_mod.f90
+	$(FC) $(FFLAGS) $(OTHERFLAGS) -c	../../common/types_mod.f90
+./time_manager_mod.f90: ../../time_manager/time_manager_mod.f90
+	cp ../../time_manager/time_manager_mod.f90 .
+./null_mpi_utilities_mod.f90: ../../mpi_utilities/null_mpi_utilities_mod.f90
+	cp ../../mpi_utilities/null_mpi_utilities_mod.f90 .
+./utilities_mod.f90: ../../utilities/utilities_mod.f90
+	cp ../../utilities/utilities_mod.f90 .
+./types_mod.f90: ../../common/types_mod.f90
+	cp ../../common/types_mod.f90 .
+./nml_test.f90: ../../utilities/nml_test.f90
+	cp ../../utilities/nml_test.f90 .
+SRC = ../../time_manager/time_manager_mod.f90 ../../mpi_utilities/null_mpi_utilities_mod.f90 ../../utilities/nml_test.f90 ../../utilities/utilities_mod.f90 ../../common/types_mod.f90
+OBJ = time_manager_mod.o null_mpi_utilities_mod.o nml_test.o utilities_mod.o types_mod.o
+OFF = ../../time_manager/time_manager_mod.f90 ../../mpi_utilities/null_mpi_utilities_mod.f90 ../../utilities/utilities_mod.f90 ../../common/types_mod.f90 ../../utilities/nml_test.f90
+clean: neat
+	-rm -f .cppdefs $(OBJ) nml_test
+neat:
+	-rm -f $(TMPFILES)
+localize: $(OFF)
+	cp $(OFF) .
+TAGS: $(SRC)
+	etags $(SRC)
+tags: $(SRC)
+	ctags $(SRC)
+nml_test: $(OBJ)
+	$(LD) $(OBJ) -o nml_test  $(LDFLAGS)


Property changes on: DART/trunk/utilities/test/Makefile
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native

Added: DART/trunk/utilities/test/input.nml
===================================================================
--- DART/trunk/utilities/test/input.nml	                        (rev 0)
+++ DART/trunk/utilities/test/input.nml	2010-06-28 19:55:19 UTC (rev 4395)
@@ -0,0 +1,3 @@
+&utilities_nml
+/
+


Property changes on: DART/trunk/utilities/test/input.nml
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native

Added: DART/trunk/utilities/test/mkmf_PrecisionCheck
===================================================================
--- DART/trunk/utilities/test/mkmf_PrecisionCheck	                        (rev 0)
+++ DART/trunk/utilities/test/mkmf_PrecisionCheck	2010-06-28 19:55:19 UTC (rev 4395)
@@ -0,0 +1,18 @@
+#!/bin/csh
+#
+# DART software - Copyright \xA9 2004 - 2010 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
+#
+# $Id$
+
+../../mkmf/mkmf -p PrecisionCheck -t ../../mkmf/mkmf.template -c"-Duse_netCDF" \
+ -a "../.." path_names_PrecisionCheck
+
+exit $status
+
+# <next few lines under version control, do not edit>
+# $URL$
+# $Revision$
+# $Date$
+


Property changes on: DART/trunk/utilities/test/mkmf_PrecisionCheck
___________________________________________________________________
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/utilities/test/mkmf_nml_test
===================================================================
--- DART/trunk/utilities/test/mkmf_nml_test	                        (rev 0)
+++ DART/trunk/utilities/test/mkmf_nml_test	2010-06-28 19:55:19 UTC (rev 4395)
@@ -0,0 +1,18 @@
+#!/bin/csh
+#
+# DART software - Copyright \xA9 2004 - 2010 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
+#
+# $Id$
+
+../../mkmf/mkmf -p nml_test -t ../../mkmf/mkmf.template -c"-Duse_netCDF" \
+ -a "../.." path_names_nml_test
+
+exit $status
+
+# <next few lines under version control, do not edit>
+# $URL$
+# $Revision$
+# $Date$
+


Property changes on: DART/trunk/utilities/test/mkmf_nml_test
___________________________________________________________________
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/utilities/test/path_names_PrecisionCheck
===================================================================
--- DART/trunk/utilities/test/path_names_PrecisionCheck	                        (rev 0)
+++ DART/trunk/utilities/test/path_names_PrecisionCheck	2010-06-28 19:55:19 UTC (rev 4395)
@@ -0,0 +1 @@
+utilities/PrecisionCheck.f90

Added: DART/trunk/utilities/test/path_names_nml_test
===================================================================
--- DART/trunk/utilities/test/path_names_nml_test	                        (rev 0)
+++ DART/trunk/utilities/test/path_names_nml_test	2010-06-28 19:55:19 UTC (rev 4395)
@@ -0,0 +1,5 @@
+common/types_mod.f90
+mpi_utilities/null_mpi_utilities_mod.f90
+time_manager/time_manager_mod.f90
+utilities/utilities_mod.f90
+utilities/nml_test.f90

Added: DART/trunk/utilities/test/quickbuild.csh
===================================================================
--- DART/trunk/utilities/test/quickbuild.csh	                        (rev 0)
+++ DART/trunk/utilities/test/quickbuild.csh	2010-06-28 19:55:19 UTC (rev 4395)
@@ -0,0 +1,124 @@
+#!/bin/csh
+#
+# DART software - Copyright \xA9 2004 - 2010 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
+#
+# $Id$
+#
+# This script compiles all executables in this directory.
+
+#----------------------------------------------------------------------
+# 'preprocess' is a program that culls the appropriate sections of the
+# observation module for the observations types in 'input.nml'; the 
+# resulting source file is used by all the remaining programs, 
+# so this MUST be run first.
+#----------------------------------------------------------------------
+
+\rm -f preprocess *.o *.mod
+#\rm -f ../../obs_def/obs_def_mod.f90
+#\rm -f ../../obs_kind/obs_kind_mod.f90
+
+set MODEL = "utilities test"
+
+@ n = 1
+
+#echo
+#echo
+#echo "---------------------------------------------------------------"
+#echo "${MODEL} build number ${n} is preprocess"
+#
+#csh  mkmf_preprocess
+#make || exit $n
+#
+#./preprocess || exit 99
+
+#----------------------------------------------------------------------
+# Build all the single-threaded targets
+#----------------------------------------------------------------------
+
+foreach TARGET ( mkmf_* )
+
+   set PROG = `echo $TARGET | sed -e 's#mkmf_##'`
+
+   switch ( $TARGET )
+   case mkmf_preprocess:
+      breaksw
+   default:
+      @ n = $n + 1
+      echo
+      echo "---------------------------------------------------"
+      echo "${MODEL} build number ${n} is ${PROG}" 
+      \rm -f ${PROG}
+      csh $TARGET || exit $n
+      make        || exit $n
+      breaksw
+   endsw
+end
+
+\rm -f *.o *.mod 
+\rm -f input.nml*_default
+
+if ( $#argv == 1 && "$1" == "-mpi" ) then
+  echo "Success: All single task DART programs compiled."  
+  echo "Script now compiling MPI parallel versions of the DART programs."
+else if ( $#argv == 1 && "$1" == "-nompi" ) then
+  echo "Success: All single task DART programs compiled."  
+  echo "Script is exiting without building the MPI version of the DART programs."
+  exit 0
+else
+  echo ""
+  echo "Success: All single task DART programs compiled."  
+  exit 0
+endif
+
+#----------------------------------------------------------------------
+# to disable an MPI parallel version of filter for this model, 
+# call this script with the -nompi argument, or if you are never going to
+# build with MPI, add an exit before the entire section above.
+#----------------------------------------------------------------------
+
+#----------------------------------------------------------------------
+# Build the MPI-enabled target(s) 
+#----------------------------------------------------------------------
+
+\rm -f filter wakeup_filter
+
+@ n = $n + 1
+echo
+echo "---------------------------------------------------"
+echo "build number $n is mkmf_filter"
+csh   mkmf_filter -mpi
+make
+
+if ($status != 0) then
+   echo
+   echo "If this died in mpi_utilities_mod, see code comment"
+   echo "in mpi_utilities_mod.f90 starting with 'BUILD TIP' "
+   echo
+   exit $n
+endif
+
+@ n = $n + 1
+echo
+echo "---------------------------------------------------"
+echo "build number $n is mkmf_wakeup_filter"
+csh  mkmf_wakeup_filter -mpi
+make || exit $n
+
+#\rm -f *.o *.mod 
+\rm -f input.nml*_default
+
+echo
+echo 'time to run filter here:'
+echo ' for lsf run "bsub < runme_filter"'
+echo ' for pbs run "qsub runme_filter"'
+echo ' for lam-mpi run "lamboot" once, then "runme_filter"'
+
+exit 0
+
+# <next few lines under version control, do not edit>
+# $URL$
+# $Revision$
+# $Date$
+


Property changes on: DART/trunk/utilities/test/quickbuild.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