[cig-commits] r17233 - in seismo/3D/SPECFEM3D/trunk: . decompose_mesh_SCOTCH

pieyre at geodynamics.org pieyre at geodynamics.org
Mon Oct 4 02:33:46 PDT 2010


Author: pieyre
Date: 2010-10-04 02:33:45 -0700 (Mon, 04 Oct 2010)
New Revision: 17233

Modified:
   seismo/3D/SPECFEM3D/trunk/config.h.in
   seismo/3D/SPECFEM3D/trunk/configure
   seismo/3D/SPECFEM3D/trunk/configure.ac
   seismo/3D/SPECFEM3D/trunk/decompose_mesh_SCOTCH/Makefile
   seismo/3D/SPECFEM3D/trunk/decompose_mesh_SCOTCH/decompose_mesh_SCOTCH.f90
   seismo/3D/SPECFEM3D/trunk/decompose_mesh_SCOTCH/part_decompose_mesh_SCOTCH.f90
Log:
Modified script configure : added option '--with-scotch-lib', for instance you can type './configure --with-scotch-lib=/opt/scotch/gcc64/lib' to specify the path of Scotch libraries. Minor modification in decompose_mesh_scotch for GCC compatibility.


Modified: seismo/3D/SPECFEM3D/trunk/config.h.in
===================================================================
--- seismo/3D/SPECFEM3D/trunk/config.h.in	2010-10-01 15:00:21 UTC (rev 17232)
+++ seismo/3D/SPECFEM3D/trunk/config.h.in	2010-10-04 09:33:45 UTC (rev 17233)
@@ -18,6 +18,9 @@
    the Fortran libraries. */
 #undef FC_MAIN
 
+/* defined if scotch is installed */
+#undef HAVE_SCOTCH
+
 /* Define to the address where bug reports for this package should be sent. */
 #undef PACKAGE_BUGREPORT
 

Modified: seismo/3D/SPECFEM3D/trunk/configure
===================================================================
--- seismo/3D/SPECFEM3D/trunk/configure	2010-10-01 15:00:21 UTC (rev 17232)
+++ seismo/3D/SPECFEM3D/trunk/configure	2010-10-04 09:33:45 UTC (rev 17233)
@@ -643,6 +643,7 @@
 PYTHON_LINKFORSHARED
 PYTHON_MODLIBS
 PYTHON_SYSLIBS
+PYTHON_LA_LDFLAGS
 FC
 FCFLAGS
 LDFLAGS
@@ -656,6 +657,7 @@
 CPPFLAGS
 ac_ct_CC
 FCFLAGS_f90
+SCOTCH_LIBS
 MPIFC
 MPILIBS
 MPICC
@@ -679,6 +681,7 @@
 CC
 CFLAGS
 CPPFLAGS
+SCOTCH_LIBS
 MPIFC
 MPILIBS
 MPICC
@@ -1265,6 +1268,7 @@
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-pyre             build Pyrized version [default=no]
   --with-mpi              build parallel version [default=yes]
+  --with-scotch-lib       tell where scotch library reside
 
 Some influential environment variables:
   FC          Fortran compiler command
@@ -1276,6 +1280,7 @@
   CFLAGS      C compiler flags
   CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
+  SCOTCH_LIBS extra libraries for linking Scotch
   MPIFC       MPI Fortran compiler command
   MPILIBS     extra libraries for linking MPI programs
   MPICC       MPI C compiler command
@@ -1285,7 +1290,7 @@
               for critical subroutines
   LOCAL_PATH_IS_ALSO_GLOBAL
               files on a local path on each node are also seen as global with
-              same path [default=false]
+              same path [default=true]
   PYTHON      Python interpreter
   PYTHONPATH  Python module search path
 
@@ -1736,9 +1741,7 @@
   want_pyre=no
 fi
 
-
-
-if test "$want_pyre" = yes; then
+ if test "$want_pyre" = yes; then
   COND_PYRE_TRUE=
   COND_PYRE_FALSE='#'
 else
@@ -1755,9 +1758,7 @@
   want_mpi=yes
 fi
 
-
-
-if test "$want_mpi" = yes; then
+ if test "$want_mpi" = yes; then
   COND_MPI_TRUE=
   COND_MPI_FALSE='#'
 else
@@ -1974,13 +1975,19 @@
 
 
 
-# $Id: cit_python_sysconfig.m4 5301 2006-11-16 12:59:42Z leif $
+# $Id: cit_python.m4 16217 2010-02-02 23:44:16Z walter $
 
 { echo "$as_me:$LINENO: checking $am_display_PYTHON sysconfig" >&5
 echo $ECHO_N "checking $am_display_PYTHON sysconfig... $ECHO_C" >&6; }
 cat >sysconfig.py <<END_OF_PYTHON
+import os, sys
 from distutils import sysconfig
-print 'PYTHON_INCDIR="%s"' % sysconfig.get_python_inc()
+def cygpath(wpath):
+    s = os.popen('cygpath -u "%s"' % wpath)
+    path = s.read().strip()
+    s.close()
+    return path
+incdir = sysconfig.get_python_inc()
 keys = (
     'BLDLIBRARY',
     'LDFLAGS',
@@ -1993,20 +2000,58 @@
     'LINKFORSHARED',
     'MODLIBS',
     'SYSLIBS',
+    'LA_LDFLAGS',
 )
-vars = sysconfig.get_config_vars()
-# transform AIX's python.exp
-vars['LINKFORSHARED'] = vars['LINKFORSHARED'].replace('Modules',vars['LIBPL'])
-if vars['LDLIBRARY'] == vars['LIBRARY']:
-    # "On systems without shared libraries, LDLIBRARY is the same as LIBRARY"
-    vars['BLDLIBRARY'] = "-L%(LIBPL)s -lpython%(VERSION)s" % vars
-elif vars['BLDLIBRARY']:
-    vars['BLDLIBRARY'] = "-L%(LIBDIR)s -lpython%(VERSION)s" % vars
+if os.name == "nt":
+    # We are running under Python for Windows (the real one...
+    # not Cygwin Python, under which 'os.name' is 'posix').
+    # We assume that we are still in the Cygwin POSIX environment,
+    # however (this is 'configure', after all); so we convert
+    # all Windows pathnames to POSIX pathnames using 'cygpath'.
+    incdir = cygpath(incdir)
+    vars = {}
+    libs = os.path.join(sys.prefix, "libs")
+    libs = cygpath(libs)
+    version = sysconfig.get_python_version()
+    version = version.replace('.', '')
+    vars['BLDLIBRARY'] = "-L%s -lpython%s" % (libs, version)
 else:
-    # "On Mac OS X frameworks, BLDLIBRARY is blank"
-    # See also Issue39.
-    framework = "%(PYTHONFRAMEWORKDIR)s/Versions/%(VERSION)s/%(PYTHONFRAMEWORK)s" % vars
-    vars['LINKFORSHARED'] = vars['LINKFORSHARED'].replace(framework, "-framework " + vars.get('PYTHONFRAMEWORK', 'Python'))
+    vars = sysconfig.get_config_vars()
+    # transform AIX's python.exp
+    vars['LINKFORSHARED'] = vars['LINKFORSHARED'].replace('Modules',vars['LIBPL'])
+    if vars['LDLIBRARY'] == vars['LIBRARY']:
+        # "On systems without shared libraries, LDLIBRARY is the same as LIBRARY"
+        vars['BLDLIBRARY'] = "-L%(LIBPL)s -lpython%(VERSION)s" % vars
+    elif vars['BLDLIBRARY']:
+        #     The 'mpicc' wrapper for LAM/MPI isn't very smart about "-L"
+        # options.  Adding "-L/usr/lib" can cause "-lmpi" to be found in /usr/lib
+        # instead of LAM's 'lib' directory.  Of course, avoiding "-L/usr/lib"
+        # doesn't really fix the problem, but it does make it much less likely;
+        # and "-L/usr/lib" is redundant and potentially problematic anyway.
+        #     Python 2.4 and later puts a symlink to libpython.so in LIBPL
+        # (/usr/lib/python2.x/config), which makes adding "-L$LIBDIR"
+        # (in addition to "-L$LIBPL") completely redundant.
+        #     But we still support Python 2.3, and we prefer shared to static,
+        # so we still add "-L$LIBDIR" when Python is installed in a non-standard
+        # location.  Note that the linker will still prefer shared over static
+        # with only "-L/usr/lib/python2.3/config" on the link line.
+        libdir = ""
+        if vars['LIBDIR'] != "/usr/lib":
+            libdir = "-L%(LIBDIR)s "
+        # Important: on Cygwin, the import library for libpython.dll is
+        # nested inside Python's 'config' directory (see Issue39).  This means
+        # that the linker always needs help finding "-lpython2.x" (in the form
+        # of "-L$LIBPL"), even for the "system" Python installed under /usr.
+        vars['BLDLIBRARY'] = (libdir + "-L%(LIBPL)s -lpython%(VERSION)s") % vars
+    else:
+        # "On Mac OS X frameworks, BLDLIBRARY is blank"
+        # See also Issue39.
+        framework = "%(PYTHONFRAMEWORKDIR)s/Versions/%(VERSION)s/%(PYTHONFRAMEWORK)s" % vars
+        PYTHONFRAMEWORK = vars.get('PYTHONFRAMEWORK', 'Python')
+        vars['LINKFORSHARED'] = vars['LINKFORSHARED'].replace(framework, "-framework " + PYTHONFRAMEWORK)
+        vars['LA_LDFLAGS'] = "-Wl,-framework,%s" % PYTHONFRAMEWORK
+vars['LDFLAGS'] = '' # only causes trouble (e.g., "-arch i386 -arch ppc" on Mac) -- see issue97
+print 'PYTHON_INCDIR="%s"' % incdir
 for key in keys:
     print 'PYTHON_%s="%s"' % (key, vars.get(key, ''))
 
@@ -2018,11 +2063,11 @@
 else
     { { echo "$as_me:$LINENO: error: \"failed
 
-Run '$PYTHON sysconfig.py' to see what wrong.
+Run '$PYTHON sysconfig.py' to see what went wrong.
 \"" >&5
 echo "$as_me: error: \"failed
 
-Run '$PYTHON sysconfig.py' to see what wrong.
+Run '$PYTHON sysconfig.py' to see what went wrong.
 \"" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -2051,7 +2096,9 @@
 
 PYTHON_SYSLIBS=$PYTHON_SYSLIBS
 
+PYTHON_LA_LDFLAGS=$PYTHON_LA_LDFLAGS
 
+
 fi
 
 # a courtesy to the installed base of users
@@ -4971,7 +5018,96 @@
 
 
 
+#checks for Scotch
 
+export SCOTCH_LIBS
+
+
+# Check whether --with-scotch-lib was given.
+if test "${with_scotch_lib+set}" = set; then
+  withval=$with_scotch_lib;
+ ac_scotch_libdir="$withval";
+
+fi
+
+
+scotch_lib=""
+ac_save_ldflags=${LDFLAGS}
+if test -n "${ac_scotch_libdir}"; then
+ LDFLAGS="${LDFLAGS} -L${ac_scotch_libdir}";
+fi
+#AC_CHECK_LIB(scotcherr,SCOTCH_errorPrint ,[scotch_lib="yes"],[scotch_lib="no";LDFLAGS=${ac_save_ldflags}])
+{ echo "$as_me:$LINENO: checking for scotchfarchinit  in -lscotch" >&5
+echo $ECHO_N "checking for scotchfarchinit  in -lscotch... $ECHO_C" >&6; }
+if test "${ac_cv_lib_scotch_scotchfarchinit_+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lscotch -lscotcherr $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+      program main
+      call scotchfarchinit
+      end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_fc_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_scotch_scotchfarchinit_=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_scotch_scotchfarchinit_=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_scotch_scotchfarchinit_" >&5
+echo "${ECHO_T}$ac_cv_lib_scotch_scotchfarchinit_" >&6; }
+if test $ac_cv_lib_scotch_scotchfarchinit_ = yes; then
+  scotch_lib="yes";
+else
+  scotch_lib="no";LDFLAGS=${ac_save_ldflags}
+fi
+
+
+{ echo "$as_me:$LINENO: checking wether scotch is usable" >&5
+echo $ECHO_N "checking wether scotch is usable... $ECHO_C" >&6; }
+if test "x${scotch_lib}" = "xyes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCOTCH 1
+_ACEOF
+
+ SCOTCH_LIBS="-L${ac_scotch_libdir} -lscotch -lscotcherr"
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+LDFLAGS=${ac_save_ldflags}
+
+#AC_CHECK_LIB([scotch], [scotchfgraphmapinit])
+#AC_CHECK_LIB([scotcherr], [SCOTCH_errorPrint])
+
 # influential environment variables
 
 
@@ -4979,6 +5115,7 @@
 
 
 
+
 if test x"$MPIFC" = x; then
     MPIFC=mpif90
 fi
@@ -5397,7 +5534,7 @@
 # Checks for library functions.
 
 
-ac_config_files="$ac_config_files Makefile constants.h precision.h DATA/Par_file DATA/CMTSOLUTION DATA/STATIONS"
+ac_config_files="$ac_config_files Makefile constants.h precision.h DATA/Par_file DATA/CMTSOLUTION DATA/STATIONS meshfem3D/Makefile meshfem3D/precision.h meshfem3D/constants.h decompose_mesh_SCOTCH/Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -5972,6 +6109,10 @@
     "DATA/Par_file") CONFIG_FILES="$CONFIG_FILES DATA/Par_file" ;;
     "DATA/CMTSOLUTION") CONFIG_FILES="$CONFIG_FILES DATA/CMTSOLUTION" ;;
     "DATA/STATIONS") CONFIG_FILES="$CONFIG_FILES DATA/STATIONS" ;;
+    "meshfem3D/Makefile") CONFIG_FILES="$CONFIG_FILES meshfem3D/Makefile" ;;
+    "meshfem3D/precision.h") CONFIG_FILES="$CONFIG_FILES meshfem3D/precision.h" ;;
+    "meshfem3D/constants.h") CONFIG_FILES="$CONFIG_FILES meshfem3D/constants.h" ;;
+    "decompose_mesh_SCOTCH/Makefile") CONFIG_FILES="$CONFIG_FILES decompose_mesh_SCOTCH/Makefile" ;;
 
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
@@ -6097,6 +6238,7 @@
 PYTHON_LINKFORSHARED!$PYTHON_LINKFORSHARED$ac_delim
 PYTHON_MODLIBS!$PYTHON_MODLIBS$ac_delim
 PYTHON_SYSLIBS!$PYTHON_SYSLIBS$ac_delim
+PYTHON_LA_LDFLAGS!$PYTHON_LA_LDFLAGS$ac_delim
 FC!$FC$ac_delim
 FCFLAGS!$FCFLAGS$ac_delim
 LDFLAGS!$LDFLAGS$ac_delim
@@ -6110,6 +6252,7 @@
 CPPFLAGS!$CPPFLAGS$ac_delim
 ac_ct_CC!$ac_ct_CC$ac_delim
 FCFLAGS_f90!$FCFLAGS_f90$ac_delim
+SCOTCH_LIBS!$SCOTCH_LIBS$ac_delim
 MPIFC!$MPIFC$ac_delim
 MPILIBS!$MPILIBS$ac_delim
 MPICC!$MPICC$ac_delim
@@ -6124,7 +6267,7 @@
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 89; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 91; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

Modified: seismo/3D/SPECFEM3D/trunk/configure.ac
===================================================================
--- seismo/3D/SPECFEM3D/trunk/configure.ac	2010-10-01 15:00:21 UTC (rev 17232)
+++ seismo/3D/SPECFEM3D/trunk/configure.ac	2010-10-04 09:33:45 UTC (rev 17233)
@@ -85,9 +85,40 @@
 AC_PROG_CC
 
 
+#checks for Scotch
 
+export SCOTCH_LIBS
+
+AC_ARG_WITH([scotch-lib],
+AC_HELP_STRING([--with-scotch-lib],[tell where scotch library reside]),
+[
+ ac_scotch_libdir="$withval";
+])
+
+scotch_lib=""
+ac_save_ldflags=${LDFLAGS}
+if test -n "${ac_scotch_libdir}"; then
+ LDFLAGS="${LDFLAGS} -L${ac_scotch_libdir}";
+fi
+#AC_CHECK_LIB(scotcherr,SCOTCH_errorPrint ,[scotch_lib="yes"],[scotch_lib="no";LDFLAGS=${ac_save_ldflags}])
+AC_CHECK_LIB(scotch,scotchfarchinit ,[scotch_lib="yes";],[scotch_lib="no";LDFLAGS=${ac_save_ldflags}], -lscotcherr)
+
+AC_MSG_CHECKING([wether scotch is usable])
+if test "x${scotch_lib}" = "xyes"; then
+ AC_DEFINE([HAVE_SCOTCH],[1],[defined if scotch is installed])
+ SCOTCH_LIBS="-L${ac_scotch_libdir} -lscotch -lscotcherr"
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
+LDFLAGS=${ac_save_ldflags}
+
+#AC_CHECK_LIB([scotch], [scotchfgraphmapinit])
+#AC_CHECK_LIB([scotcherr], [SCOTCH_errorPrint])
+
 # influential environment variables
 
+AC_ARG_VAR(SCOTCH_LIBS, [extra libraries for linking Scotch])
 AC_ARG_VAR(MPIFC, [MPI Fortran compiler command])
 AC_ARG_VAR(MPILIBS, [extra libraries for linking MPI programs])
 AC_ARG_VAR(MPICC, [MPI C compiler command])
@@ -173,7 +204,7 @@
 # Checks for library functions.
 
 
-AC_CONFIG_FILES([Makefile constants.h precision.h DATA/Par_file DATA/CMTSOLUTION DATA/STATIONS])
+AC_CONFIG_FILES([Makefile constants.h precision.h DATA/Par_file DATA/CMTSOLUTION DATA/STATIONS meshfem3D/Makefile meshfem3D/precision.h meshfem3D/constants.h decompose_mesh_SCOTCH/Makefile])
 AC_OUTPUT
 
 

Modified: seismo/3D/SPECFEM3D/trunk/decompose_mesh_SCOTCH/Makefile
===================================================================
--- seismo/3D/SPECFEM3D/trunk/decompose_mesh_SCOTCH/Makefile	2010-10-01 15:00:21 UTC (rev 17232)
+++ seismo/3D/SPECFEM3D/trunk/decompose_mesh_SCOTCH/Makefile	2010-10-04 09:33:45 UTC (rev 17233)
@@ -1,37 +1,119 @@
-# Makefile
+#=====================================================================
+#
+#               S p e c f e m 3 D  V e r s i o n  1 . 4
+#               ---------------------------------------
+#
+#                 Dimitri Komatitsch and Jeroen Tromp
+#    Seismological Laboratory - California Institute of Technology
+#         (c) California Institute of Technology July 2005
+#
+# 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+#=====================================================================
+#
+# United States Government Sponsorship Acknowledged.
+#
 
-#############################################################
-## modify to match your compiler defaults 
-## (which were used to compile SCOTCH libraries from below as well)
-F90 = ifort # -g -traceback -check bounds -warn 
-#F90 = gfortran    # use -Wall
+# decompose_mesh_SCOTCH/Makefile.  Generated from Makefile.in by configure.
 
-## modify to match your library paths
-SCOTCH_LIBS = -L/opt/seismo-util/source/scotch/lib -lscotch -lscotcherr
-#SCOTCH_LIBS = -L/scratch/network/SCOTCH/lib -lscotch -lscotcherr							
-#SCOTCH_LIBS = -L/n/sw/scotch-5.1/lib -lscotch -lscotcherr
+FC = gfortran
+FCFLAGS = #-g -O2
+MPIFC = mpif90
+MPILIBS = 
+FLAGS_CHECK = $(FLAGS_NO_CHECK)
+FLAGS_NO_CHECK = -std=gnu -fimplicit-none -frange-check -O3 -pedantic -pedantic-errors -Waliasing -Wampersand -Wline-truncation -Wsurprising -Wunderflow -fno-trapping-math
+FCFLAGS_f90 = 
+SCOTCH_LIBS = -L/opt/scotch/gcc64/lib -lscotch -lscotcherr
 
-#############################################################
+FCCOMPILE_CHECK = ${FC} ${FCFLAGS} $(FLAGS_CHECK)
+FCCOMPILE_NO_CHECK = ${FC} ${FCFLAGS} $(FLAGS_NO_CHECK)
+MPIFCCOMPILE_CHECK = ${MPIFC} ${FCFLAGS} $(FLAGS_CHECK)
+MPIFCCOMPILE_NO_CHECK = ${MPIFC} ${FCFLAGS} $(FLAGS_NO_CHECK)
+#FCLINK = $(MPIFCCOMPILE_NO_CHECK)
+##FCLINK = $(FCCOMPILE_NO_CHECK)
+FCLINK = $(FCCOMPILE_NO_CHECK)
 
-LIBS = part_decompose_mesh_SCOTCH.o \
-				decompose_mesh_SCOTCH.o \
-				program_decompose_mesh_SCOTCH.o
+CC = gcc
+CFLAGS = -g -O2 $(CPPFLAGS)
+CPPFLAGS =  $(COND_MPI_CPPFLAGS)
+COND_MPI_CPPFLAGS = -DWITH_MPI
+#COND_MPI_CPPFLAGS =
 
-# targets
-all: xdecompose_mesh_SCOTCH
+AR = ar
+ARFLAGS = cru
+RANLIB = ranlib
 
-xdecompose_mesh_SCOTCH: $(LIBS)
-	${F90} -o xdecompose_mesh_SCOTCH $(LIBS) $(SCOTCH_LIBS)
+O = ../obj
 
+# objects toggled between the parallel and serial version
+#COND_MPI_OBJECTS = $O/parallel.o
+#COND_MPI_OBJECTS = $O/serial.o
 
-part_decompose_mesh_SCOTCH.o: part_decompose_mesh_SCOTCH.f90
-	${F90} -c part_decompose_mesh_SCOTCH.f90
+####
+#### targets
+####
 
-decompose_mesh_SCOTCH.o: decompose_mesh_SCOTCH.f90 part_decompose_mesh_SCOTCH.f90
-	${F90} -c decompose_mesh_SCOTCH.f90
+# default targets for the Pyrized version
+DEFAULT = xdecompose_mesh_SCOTCH
 
-program_decompose_mesh_SCOTCH.o: program_decompose_mesh_SCOTCH.f90
-	${F90} -c program_decompose_mesh_SCOTCH.f90
 
+default: $(DEFAULT)
+
+all: clean default
+
+decompose_mesh_SCOTCH: xdecompose_mesh_SCOTCH
+
+
+####
+#### rules for executables
+####
+
+
+#DEC_OBJETS = part_decompose_mesh_SCOTCH.o \
+                                decompose_mesh_SCOTCH.o \
+                                program_decompose_mesh_SCOTCH.o
+
+DEC_OBJECTS = part_decompose_mesh_SCOTCH.o \
+                decompose_mesh_SCOTCH.o \
+                program_decompose_mesh_SCOTCH.o
+
+
+# rules for the pure Fortran version
+xdecompose_mesh_SCOTCH:: $(DEC_OBJECTS) 
+	${FCLINK} -o xdecompose_mesh_SCOTCH $(DEC_OBJECTS) $(SCOTCH_LIBS) 
+
+# solver also depends on values from mesher
+#xspecfem3D: $(XSPECFEM_OBJECTS) $(COND_MPI_OBJECTS)
+#	${FCLINK} -o xspecfem3D $(XSPECFEM_OBJECTS) $(COND_MPI_OBJECTS) $(MPILIBS)
+#
+
+
+
 clean:
-	rm -f *.o *.mod a.out xdecompose_mesh_SCOTCH
+	rm -f *.o *.mod xdecompose_mesh_SCOTCH 
+####
+#### rule to build each .o file below
+####
+
+part_decompose_mesh_SCOTCH.o: part_decompose_mesh_SCOTCH.f90 
+	${FCCOMPILE_CHECK} -c part_decompose_mesh_SCOTCH.f90
+
+decompose_mesh_SCOTCH.o: decompose_mesh_SCOTCH.f90 part_decompose_mesh_SCOTCH.f90 part_decompose_mesh_SCOTCH.o
+	${FCCOMPILE_CHECK} -c decompose_mesh_SCOTCH.f90
+
+program_decompose_mesh_SCOTCH.o: program_decompose_mesh_SCOTCH.f90 part_decompose_mesh_SCOTCH.o decompose_mesh_SCOTCH.o
+	${FCCOMPILE_CHECK} -c program_decompose_mesh_SCOTCH.f90
+
+

Modified: seismo/3D/SPECFEM3D/trunk/decompose_mesh_SCOTCH/decompose_mesh_SCOTCH.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/decompose_mesh_SCOTCH/decompose_mesh_SCOTCH.f90	2010-10-01 15:00:21 UTC (rev 17232)
+++ seismo/3D/SPECFEM3D/trunk/decompose_mesh_SCOTCH/decompose_mesh_SCOTCH.f90	2010-10-04 09:33:45 UTC (rev 17233)
@@ -311,8 +311,10 @@
        ! checks material_id
        read(undef_mat_prop(1,imat),*) num_mat
        !print *,'material_id: ',num_mat
-       if(num_mat > 0 .or. -num_mat > count_undef_mat)  stop "ERROR : Invalid nummaterial_velocity_file for undefined materials."
-       if(num_mat /= -imat)  stop "ERROR : Invalid material_id in nummaterial_velocity_file for undefined materials."                            
+       if(num_mat > 0 .or. -num_mat > count_undef_mat)  &
+            stop "ERROR : Invalid nummaterial_velocity_file for undefined materials."
+       if(num_mat /= -imat)  &
+            stop "ERROR : Invalid material_id in nummaterial_velocity_file for undefined materials."                            
 
        ! checks interface: flag_down/flag_up
        if( trim(undef_mat_prop(2,imat)) == 'interface' ) then
@@ -320,19 +322,23 @@
          read( undef_mat_prop(3,imat),*) num_mat 
          if( num_mat > 0 ) then
           ! must point to a defined material
-          if( num_mat > count_def_mat) stop "ERROR: invalid flag_down in interface definition in nummaterial_velocity_file"
+          if( num_mat > count_def_mat) &
+               stop "ERROR: invalid flag_down in interface definition in nummaterial_velocity_file"
          else
           ! must point to an undefined material
-          if( -num_mat > count_undef_mat) stop "ERROR: invalid flag_down in interface definition in nummaterial_velocity_file"         
+          if( -num_mat > count_undef_mat) &
+               stop "ERROR: invalid flag_down in interface definition in nummaterial_velocity_file"         
          endif
          ! flag_up
          read( undef_mat_prop(4,imat),*) num_mat 
          if( num_mat > 0 ) then
           ! must point to a defined material
-          if( num_mat > count_def_mat) stop "ERROR: invalid flag_up in interface definition in nummaterial_velocity_file"
+          if( num_mat > count_def_mat) &
+               stop "ERROR: invalid flag_up in interface definition in nummaterial_velocity_file"
          else
           ! must point to an undefined material
-          if( -num_mat > count_undef_mat) stop "ERROR: invalid flag_up in interface definition in nummaterial_velocity_file"
+          if( -num_mat > count_undef_mat) &
+               stop "ERROR: invalid flag_up in interface definition in nummaterial_velocity_file"
          endif
        endif   
     end do

Modified: seismo/3D/SPECFEM3D/trunk/decompose_mesh_SCOTCH/part_decompose_mesh_SCOTCH.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/decompose_mesh_SCOTCH/part_decompose_mesh_SCOTCH.f90	2010-10-01 15:00:21 UTC (rev 17232)
+++ seismo/3D/SPECFEM3D/trunk/decompose_mesh_SCOTCH/part_decompose_mesh_SCOTCH.f90	2010-10-04 09:33:45 UTC (rev 17233)
@@ -373,7 +373,8 @@
                               sup_neighbour, part, elmnts, xadj, adjncy, &
                               tab_interfaces, tab_size_interfaces, ninterfaces, &
                               nb_materials, cs_material, num_material,nparts)
-
+     
+    integer, intent(in)  :: nb_materials,nparts
     integer(long), intent(in)  :: nelmnts, sup_neighbour
     integer, dimension(0:nelmnts-1), intent(in)  :: part
     integer, dimension(0:esize*nelmnts-1), intent(in)  :: elmnts
@@ -384,8 +385,6 @@
     integer, dimension(1:nelmnts), intent(in)  :: num_material
     ! vs velocities
     double precision, dimension(1:nb_materials), intent(in)  :: cs_material
-    
-    integer, intent(in)  :: nb_materials,nparts
 
     ! local parameters  
     integer  :: num_part, num_part_bis, el, el_adj, num_interface, num_edge, ncommon_nodes, &
@@ -1202,7 +1201,7 @@
 
     ! sets acoustic/elastic flags for undefined materials
     do i = 1, count_undef_mat
-       read(undef_mat_prop(6,i),'(i)') idomain_id
+       read(undef_mat_prop(6,i),*) idomain_id
        ! acoustic material has idomain_id 1
        if (idomain_id == 1 ) then
           is_acoustic(-i) = .true.



More information about the CIG-COMMITS mailing list