[cig-commits] r16333 - in seismo/3D/SPECFEM3D_SESAME/trunk: . EXAMPLES/homogeneous_halfspace EXAMPLES/layered_halfspace

danielpeter at geodynamics.org danielpeter at geodynamics.org
Wed Feb 24 12:49:42 PST 2010


Author: danielpeter
Date: 2010-02-24 12:49:42 -0800 (Wed, 24 Feb 2010)
New Revision: 16333

Modified:
   seismo/3D/SPECFEM3D_SESAME/trunk/EXAMPLES/homogeneous_halfspace/Par_file
   seismo/3D/SPECFEM3D_SESAME/trunk/EXAMPLES/layered_halfspace/Par_file
   seismo/3D/SPECFEM3D_SESAME/trunk/param_reader.c
   seismo/3D/SPECFEM3D_SESAME/trunk/read_parameter_file.f90
Log:
updated the Par_files in EXAMPLES/ to use NPROC only as total number of processes (and no more NPROC_ETA & NPROC_XI)

Modified: seismo/3D/SPECFEM3D_SESAME/trunk/EXAMPLES/homogeneous_halfspace/Par_file
===================================================================
--- seismo/3D/SPECFEM3D_SESAME/trunk/EXAMPLES/homogeneous_halfspace/Par_file	2010-02-24 16:02:19 UTC (rev 16332)
+++ seismo/3D/SPECFEM3D_SESAME/trunk/EXAMPLES/homogeneous_halfspace/Par_file	2010-02-24 20:49:42 UTC (rev 16333)
@@ -7,9 +7,8 @@
 UTM_PROJECTION_ZONE             = 11
 SUPPRESS_UTM_PROJECTION         = .true.
 
-# number of MPI processors along xi and eta (can be different)
-NPROC_XI                        = 2 
-NPROC_ETA                       = 2
+# number of MPI processors 
+NPROC                           = 4
 
 # time step parameters
 NSTEP                           = 1000

Modified: seismo/3D/SPECFEM3D_SESAME/trunk/EXAMPLES/layered_halfspace/Par_file
===================================================================
--- seismo/3D/SPECFEM3D_SESAME/trunk/EXAMPLES/layered_halfspace/Par_file	2010-02-24 16:02:19 UTC (rev 16332)
+++ seismo/3D/SPECFEM3D_SESAME/trunk/EXAMPLES/layered_halfspace/Par_file	2010-02-24 20:49:42 UTC (rev 16333)
@@ -7,9 +7,8 @@
 UTM_PROJECTION_ZONE             = 11
 SUPPRESS_UTM_PROJECTION         = .true.
 
-# number of MPI processors along xi and eta (can be different)
-NPROC_XI                        = 2 
-NPROC_ETA                       = 2
+# number of MPI processors 
+NPROC                           = 4
 
 # time step parameters
 NSTEP                           = 4500

Modified: seismo/3D/SPECFEM3D_SESAME/trunk/param_reader.c
===================================================================
--- seismo/3D/SPECFEM3D_SESAME/trunk/param_reader.c	2010-02-24 16:02:19 UTC (rev 16332)
+++ seismo/3D/SPECFEM3D_SESAME/trunk/param_reader.c	2010-02-24 20:49:42 UTC (rev 16333)
@@ -1,14 +1,12 @@
 /*
  !=====================================================================
  !
- !          S p e c f e m 3 D  G l o b e  V e r s i o n  4 . 0
- !          --------------------------------------------------
+ !               S p e c f e m 3 D  V e r s i o n  1 . 4
+ !               ---------------------------------------
  !
- !          Main authors: Dimitri Komatitsch and Jeroen Tromp
- !    Seismological Laboratory, California Institute of Technology, USA
- !             and University of Pau / CNRS / INRIA, France
- ! (c) California Institute of Technology and University of Pau / CNRS / INRIA
- !                            February 2008
+ !                 Dimitri Komatitsch and Jeroen Tromp
+ !    Seismological Laboratory - California Institute of Technology
+ !         (c) California Institute of Technology September 2006
  !
  ! This program is free software; you can redistribute it and/or modify
  ! it under the terms of the GNU General Public License as published by
@@ -28,9 +26,9 @@
  */
 
 /* 
- 
- by Dennis McRitchie
- 
+
+by Dennis McRitchie
+
  January 7, 2010 - par_file parsing
  ..
  You'll notice that the heart of the parser is a complex regular
@@ -47,7 +45,7 @@
  already six C files that make up part of the build (though they all are
  related to the pyre-framework).
  ..
- */
+*/
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -128,6 +126,7 @@
 	if (fseek(fd, 0, SEEK_SET) != 0) {
 		printf("Can't seek to begining of parameter file\n");
 		*ierr = 1;
+    regfree(&compiled_pattern);
 		return;
 	}
 	// Read every line in the file.
@@ -148,6 +147,7 @@
 		if(regret != 0) {
 			printf("regexec returned error %d\n", regret);
 			*ierr = 1;
+      regfree(&compiled_pattern);
 			return;
 		}
     //		printf("Line read = %s\n", line);
@@ -159,6 +159,7 @@
 			continue;
 		}
 		free(keyword);
+    regfree(&compiled_pattern);
 		// If it matches, extract the value from the line.
 		value = strndup(line+parameter[2].rm_so, parameter[2].rm_eo-parameter[2].rm_so);
 		// Clear out the return string with blanks, copy the value into it, and return.
@@ -172,6 +173,7 @@
 	// If no keyword matches, print out error and die.
 	printf("No match in parameter file for keyword %s\n", namecopy);
 	free(namecopy);
+  regfree(&compiled_pattern);
 	*ierr = 1;
 	return;
 }

Modified: seismo/3D/SPECFEM3D_SESAME/trunk/read_parameter_file.f90
===================================================================
--- seismo/3D/SPECFEM3D_SESAME/trunk/read_parameter_file.f90	2010-02-24 16:02:19 UTC (rev 16332)
+++ seismo/3D/SPECFEM3D_SESAME/trunk/read_parameter_file.f90	2010-02-24 20:49:42 UTC (rev 16333)
@@ -48,7 +48,7 @@
   character(len=256) LOCAL_PATH,CMTSOLUTION
 
 ! local variables
-  integer ::ios,icounter,isource,idummy
+  integer ::ios,icounter,isource,idummy,nproc_eta_old,nproc_xi_old
   double precision :: hdur,minval_hdur
   character(len=256) :: dummystring
   integer, external :: err_occurred
@@ -67,7 +67,23 @@
   if(err_occurred() /= 0) return
   ! total number of processors 
   call read_value_integer(NPROC, 'mesher.NPROC')
-  if(err_occurred() /= 0) return
+  if(err_occurred() /= 0) then
+    ! checks if it's using an old Par_file format
+    call read_value_integer(nproc_eta_old, 'mesher.NPROC_ETA')
+    if( err_occurred() /= 0 ) then
+      print*,'please specify the number of processes in Par_file as:'
+      print*,'NPROC           =    <my_number_of_desired_processes> '
+      return
+    endif
+    ! checks if it's using an old Par_file format
+    call read_value_integer(nproc_xi_old, 'mesher.NPROC_XI')
+    if( err_occurred() /= 0 ) then
+      print*,'please specify the number of processes in Par_file as:'
+      print*,'NPROC           =    <my_number_of_desired_processes> '
+      return
+    endif
+    NPROC = nproc_eta_old * nproc_xi_old    
+  endif  
   call read_value_integer(NSTEP, 'solver.NSTEP')
   if(err_occurred() /= 0) return
   call read_value_double_precision(DT, 'solver.DT')



More information about the CIG-COMMITS mailing list