[cig-commits] r22678 - in seismo/3D/SPECFEM3D_GLOBE: branches/SPECFEM3D_GLOBE_SUNFLOWER branches/SPECFEM3D_GLOBE_SUNFLOWER/doc/USER_MANUAL trunk trunk/doc/USER_MANUAL

dkomati1 at geodynamics.org dkomati1 at geodynamics.org
Thu Jul 25 16:20:21 PDT 2013


Author: dkomati1
Date: 2013-07-25 16:20:21 -0700 (Thu, 25 Jul 2013)
New Revision: 22678

Added:
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/replace_use_mpi_with_include_mpif_dot_h.pl
   seismo/3D/SPECFEM3D_GLOBE/trunk/replace_use_mpi_with_include_mpif_dot_h.pl
Modified:
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/doc/USER_MANUAL/manual_SPECFEM3D_GLOBE.pdf
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/doc/USER_MANUAL/manual_SPECFEM3D_GLOBE.tex
   seismo/3D/SPECFEM3D_GLOBE/trunk/doc/USER_MANUAL/manual_SPECFEM3D_GLOBE.pdf
   seismo/3D/SPECFEM3D_GLOBE/trunk/doc/USER_MANUAL/manual_SPECFEM3D_GLOBE.tex
Log:
added replace_use_mpi_with_include_mpif_dot_h.pl


Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/doc/USER_MANUAL/manual_SPECFEM3D_GLOBE.pdf
===================================================================
(Binary files differ)

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/doc/USER_MANUAL/manual_SPECFEM3D_GLOBE.tex
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/doc/USER_MANUAL/manual_SPECFEM3D_GLOBE.tex	2013-07-25 22:26:37 UTC (rev 22677)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/doc/USER_MANUAL/manual_SPECFEM3D_GLOBE.tex	2013-07-25 23:20:21 UTC (rev 22678)
@@ -422,6 +422,9 @@
 with the source code (\texttt{SPECFEM3D\_GLOBE\_V5.1.5}). The \texttt{go\_mesher}
 script discussed below automatically takes care of creating the \texttt{OUTPUT\_FILES} directory.
 
+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{Compiling on an IBM BlueGene}
 
 \underline{More recent installation instruction for IBM BlueGene, from October 2012:}\\

Added: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/replace_use_mpi_with_include_mpif_dot_h.pl
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/replace_use_mpi_with_include_mpif_dot_h.pl	                        (rev 0)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/replace_use_mpi_with_include_mpif_dot_h.pl	2013-07-25 23:20:21 UTC (rev 22678)
@@ -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_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/replace_use_mpi_with_include_mpif_dot_h.pl
___________________________________________________________________
Added: svn:executable
   + *

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/doc/USER_MANUAL/manual_SPECFEM3D_GLOBE.pdf
===================================================================
(Binary files differ)

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/doc/USER_MANUAL/manual_SPECFEM3D_GLOBE.tex
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/doc/USER_MANUAL/manual_SPECFEM3D_GLOBE.tex	2013-07-25 22:26:37 UTC (rev 22677)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/doc/USER_MANUAL/manual_SPECFEM3D_GLOBE.tex	2013-07-25 23:20:21 UTC (rev 22678)
@@ -422,6 +422,9 @@
 with the source code (\texttt{SPECFEM3D\_GLOBE\_V5.1.5}). The \texttt{go\_mesher}
 script discussed below automatically takes care of creating the \texttt{OUTPUT\_FILES} directory.
 
+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{Compiling on an IBM BlueGene}
 
 \underline{More recent installation instruction for IBM BlueGene, from October 2012:}\\

Added: seismo/3D/SPECFEM3D_GLOBE/trunk/replace_use_mpi_with_include_mpif_dot_h.pl
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/replace_use_mpi_with_include_mpif_dot_h.pl	                        (rev 0)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/replace_use_mpi_with_include_mpif_dot_h.pl	2013-07-25 23:20:21 UTC (rev 22678)
@@ -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_GLOBE/trunk/replace_use_mpi_with_include_mpif_dot_h.pl
___________________________________________________________________
Added: svn:executable
   + *



More information about the CIG-COMMITS mailing list