[cig-commits] r21555 - in seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS: . setup src/specfem3D

lefebvre at geodynamics.org lefebvre at geodynamics.org
Mon Mar 18 07:01:31 PDT 2013


Author: lefebvre
Date: 2013-03-18 07:01:30 -0700 (Mon, 18 Mar 2013)
New Revision: 21555

Modified:
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/configure
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/setup/config.h.in
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/write_specfem_adios_header.F90
Log:
routine to write the adios header factorized, use config.fh to save configuration files and program name+version
	modified:   configure
	modified:   setup/config.h.in
	modified:   src/specfem3D/write_specfem_adios_header.F90

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/configure
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/configure	2013-03-18 14:01:22 UTC (rev 21554)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/configure	2013-03-18 14:01:30 UTC (rev 21555)
@@ -2466,6 +2466,7 @@
 eval $flags
 
 
+
 ac_ext=${ac_fc_srcext-f}
 ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
@@ -6365,6 +6366,13 @@
 
 fi
 
+#mpbl: adding flags to config.h.in through autoheader in order to save them into the adios file.
+configure_flags_str="FC=$FC"" FCFLAGS=""$FLAGS_NO_CHECK"""
+
+cat >>confdefs.h <<_ACEOF
+#define CONFIGURE_FLAGS "${configure_flags_str}"
+_ACEOF
+
 # Checks for typedefs, structures, and compiler characteristics.
 
 
@@ -7606,6 +7614,11 @@
 
   esac
 
+
+  case $ac_file$ac_mode in
+    "setup/config.h":H) sed 's/\/\*\(.*\)\*\//!\1/g' setup/config.h > setup/config.fh ;;
+
+  esac
 done # for ac_tag
 
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/setup/config.h.in
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/setup/config.h.in	2013-03-18 14:01:22 UTC (rev 21554)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/setup/config.h.in	2013-03-18 14:01:30 UTC (rev 21555)
@@ -1,5 +1,8 @@
 /* setup/config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* configuration flags to be save in the adios output file. */
+#undef CONFIGURE_FLAGS
+
 /* Define to dummy `main' function (if any) required to link to the Fortran
    libraries. */
 #undef FC_DUMMY_MAIN
@@ -59,9 +62,6 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
@@ -71,5 +71,5 @@
 
 /* Uncomment and define to select optimized file i/o for regional simulations */
 /* map fails when output files are > 4GB, which is often the case for GPU simulations */
-// #define USE_MAP_FUNCTION
+/* #define USE_MAP_FUNCTION */
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/write_specfem_adios_header.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/write_specfem_adios_header.F90	2013-03-18 14:01:22 UTC (rev 21554)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/write_specfem_adios_header.F90	2013-03-18 14:01:30 UTC (rev 21555)
@@ -30,6 +30,8 @@
 !! \brief Write in the adios file a group with all the parameters that insure
 !!        reproductibility
 
+#include "config.fh"
+
 !
 !-------------------------------------------------------------------------------
 !
@@ -108,6 +110,9 @@
 
     group_size_inc = 0 ! Adios group size. Incremented by adios_helpers
 
+    !-- *** Define variables used to configure specfem
+    call define_solver_info_variables (adios_group, group_size_inc)
+
     !--*** Values read from DATA/Par_file ***
     ! extract all unmodified values from the Par_file
     call read_parameter_file(OUTPUT_FILES,                                     & 
@@ -154,6 +159,9 @@
     call adios_group_size (adios_handle, adios_groupsize,                      &
                            adios_totalsize, adios_err)
 
+    ! Write variables from 'config.h'
+    call write_adios_solver_info_variables (adios_handle)
+
     ! Write variables from 'Par_file'
     call write_adios_par_file_variables (adios_handle,                         &
         ANGULAR_WIDTH_XI_IN_DEGREES, ANGULAR_WIDTH_ETA_IN_DEGREES,             &
@@ -202,6 +210,26 @@
 ! which is not currently designed to do that.
 contains
 
+!> \brief Define ADIOS variable to store values from 'setup/config.h'. Store
+!!        configuration parameters to insure reproductibility
+!! \param adios_group The ADIOS entity grouping variables for data transferts
+!! \param group_size_inc The group size to increment wrt. the variable size
+subroutine define_solver_info_variables (adios_group, group_size_inc)
+  implicit none
+  ! Parameters
+  integer(kind=8), intent(in)    :: adios_group
+  integer(kind=8), intent(inout) :: group_size_inc
+  ! Variables
+  integer :: pkg_str_len, conf_flags_len
+ 
+  pkg_str_len    = len_trim(PACKAGE_STRING)
+  conf_flags_len = len_trim(CONFIGURE_FLAGS)
+  call define_adios_integer_scalar (adios_group, "package_string_length", "/solver_info", group_size_inc)
+  call define_adios_string (adios_group, "package_name", "/solver_info", pkg_str_len, group_size_inc)
+  call define_adios_integer_scalar (adios_group, "conf_flags_len", "/solver_info", group_size_inc)
+  call define_adios_string (adios_group, "conf_flags", "/solver_info", conf_flags_len, group_size_inc)
+end subroutine define_solver_info_variables
+
 !> \brief Define ADIOS variable to store values from the Par_file
 !! \param adios_group The ADIOS entity grouping variables for data transferts
 !! \param group_size_inc The group size to increment wrt. the variable size
@@ -209,6 +237,7 @@
 !!                     Usefull for reading back the MODEL
 subroutine define_par_file_variables (adios_group, group_size_inc, model_length)
   implicit none
+  ! Parameters
   integer(kind=8), intent(in)    :: adios_group
   integer(kind=8), intent(inout) :: group_size_inc
   integer, intent(in)            :: model_length ! for later reading of MODEL
@@ -513,6 +542,29 @@
   network_name_length = len(network_name)
 end subroutine read_raw_stations
 
+!> \brief Wrapper to write the 'config.h' variables into the adios header
+!! \param adios_handle The handle to the file where the variable should be
+!!                     written
+subroutine write_adios_solver_info_variables (adios_handle)
+  implicit none
+  ! Parameters
+  integer(kind=8), intent(in)    :: adios_handle
+  ! Variables
+  integer :: pkg_str_len, conf_flags_len, adios_err
+  character(len=:), allocatable :: pkg_str
+  character(len=:), allocatable :: conf_flags
+ 
+  pkg_str    = trim(PACKAGE_STRING)
+  conf_flags = trim(CONFIGURE_FLAGS)
+
+  pkg_str_len    = len_trim(PACKAGE_STRING)
+  conf_flags_len = len_trim(CONFIGURE_FLAGS)
+  call adios_write (adios_handle, "package_string_length", pkg_str_len, adios_err)
+  call adios_write (adios_handle, "package_name", pkg_str, adios_err)
+  call adios_write (adios_handle, "conf_flags_len", conf_flags_len, adios_err)
+  call adios_write (adios_handle, "conf_flags", conf_flags, adios_err)
+end subroutine write_adios_solver_info_variables 
+
 !> \brief Wrapper to write the 'Par_file' variables into the adios header
 !! \param adios_handle The handle to the file where the variable should be
 !!                     written
@@ -687,4 +739,5 @@
   call adios_write (adios_handle, "network_name", network_name, adios_err)
 end subroutine write_adios_stations_variables
 
+
 end subroutine write_specfem_header_adios



More information about the CIG-COMMITS mailing list