[cig-commits] r22681 - in seismo/3D/SPECFEM3D/trunk: . doc/USER_MANUAL
dkomati1 at geodynamics.org
dkomati1 at geodynamics.org
Thu Jul 25 16:25:49 PDT 2013
Author: dkomati1
Date: 2013-07-25 16:25:48 -0700 (Thu, 25 Jul 2013)
New Revision: 22681
Added:
seismo/3D/SPECFEM3D/trunk/replace_use_mpi_with_include_mpif_dot_h.pl
Modified:
seismo/3D/SPECFEM3D/trunk/doc/USER_MANUAL/manual_SPECFEM3D_Cartesian.pdf
seismo/3D/SPECFEM3D/trunk/doc/USER_MANUAL/manual_SPECFEM3D_Cartesian.tex
Log:
added replace_use_mpi_with_include_mpif_dot_h.pl
Modified: seismo/3D/SPECFEM3D/trunk/doc/USER_MANUAL/manual_SPECFEM3D_Cartesian.pdf
===================================================================
(Binary files differ)
Modified: seismo/3D/SPECFEM3D/trunk/doc/USER_MANUAL/manual_SPECFEM3D_Cartesian.tex
===================================================================
--- seismo/3D/SPECFEM3D/trunk/doc/USER_MANUAL/manual_SPECFEM3D_Cartesian.tex 2013-07-25 23:22:42 UTC (rev 22680)
+++ seismo/3D/SPECFEM3D/trunk/doc/USER_MANUAL/manual_SPECFEM3D_Cartesian.tex 2013-07-25 23:25:48 UTC (rev 22681)
@@ -502,10 +502,14 @@
in most cases they will), you can select single precision for your
future runs.\\
+If your compiler has problems with the \texttt{use mpi} statements that are used in the code, use the script called
+\texttt{replace\_use\_mpi\_with\_include\_mpif\_dot\_h.pl} in the root directory to replace all of them with \texttt{include 'mpif.h'} automatically.
-
\section{Adding OpenMP support in addition to MPI}
+NOTE FROM JULY 2013: OpenMP support is maybe / probably not maintained any more.
+Thus the section below is maybe obsolete.
+
OpenMP support can be enabled in addition to MPI. However, in many
cases performance will not improve because our pure MPI implementation
is already heavily optimized and thus the resulting code will in fact
Added: seismo/3D/SPECFEM3D/trunk/replace_use_mpi_with_include_mpif_dot_h.pl
===================================================================
--- seismo/3D/SPECFEM3D/trunk/replace_use_mpi_with_include_mpif_dot_h.pl (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/replace_use_mpi_with_include_mpif_dot_h.pl 2013-07-25 23:25:48 UTC (rev 22681)
@@ -0,0 +1,75 @@
+#!/usr/bin/perl
+
+#
+# replace "use mpi" with include "mpif.h" in all source files;
+# also swap it with the "implicit none" line, which must be located after
+# in the case of "use mpi" but before in the case of include "mpif.h"
+#
+# Author : Dimitri Komatitsch, EPS - Harvard University, January 1998 and CNRS Marseille, France, July 2013
+#
+
+#
+# first clean trailing white spaces in all f90 files in the src/ sub-directories
+#
+
+ @objects = `ls src/*/*.f90 src/*/*.F90`;
+
+ foreach $name (@objects) {
+ chop $name;
+# change tabs to white spaces
+ system("expand -2 < $name > _____dummy08_____");
+ $f90name = $name;
+ print STDOUT "Cleaning trailing white spaces in $f90name ...\n";
+
+ open(FILE_INPUT,"<_____dummy08_____");
+ open(FILEF90,">$f90name");
+
+# open the input f90 file
+ while($line = <FILE_INPUT>) {
+
+# suppress trailing white spaces and carriage return
+ $line =~ s/\s*$//;
+
+ print FILEF90 "$line\n";
+
+ }
+
+ close(FILE_INPUT);
+ close(FILEF90);
+
+ }
+
+#
+# then perform the replacement in all f90 and F90 files in the src/ sub-directories
+#
+
+ @objects = `ls src/*/*.f90 src/*/*.F90`;
+
+ foreach $name (@objects) {
+ chop $name;
+# change tabs to white spaces
+ system("expand -2 < $name > _____dummy08_____");
+ $f90name = $name;
+ print STDOUT "Replacing 'use mpi' (if any) in $f90name ...\n";
+
+ open(FILE_INPUT,"<_____dummy08_____");
+ open(FILEF90,">$f90name");
+
+# to read the whole file in the variable instead of a single line
+ undef $/;
+
+# read the whole input file
+ $whole_file = <FILE_INPUT>;
+
+# make the replacement
+ $whole_file =~ s/\n\s*use mpi\s*\n*\s*implicit none\s*\n/\n\n implicit none\n\n include 'mpif.h'\n\n/og;
+
+ print FILEF90 "$whole_file";
+
+ close(FILE_INPUT);
+ close(FILEF90);
+
+ }
+
+ system("rm -f _____dummy08_____");
+
Property changes on: seismo/3D/SPECFEM3D/trunk/replace_use_mpi_with_include_mpif_dot_h.pl
___________________________________________________________________
Added: svn:executable
+ *
More information about the CIG-COMMITS
mailing list