[cig-commits] commit: Updating to latest stgUnderworldE.

Mercurial hg at geodynamics.org
Mon Nov 24 11:22:41 PST 2008


changeset:   18:fe4bd96119f6
user:        LukeHodkinson
date:        Fri Feb 08 03:53:13 2008 +0000
files:       SConfigure SConsUtils SConstruct
description:
Updating to latest stgUnderworldE.


diff -r 5fd90fccdd0e -r fe4bd96119f6 SConfigure
--- a/SConfigure	Thu Feb 07 23:47:21 2008 +0000
+++ b/SConfigure	Fri Feb 08 03:53:13 2008 +0000
@@ -61,7 +61,21 @@ def petsc_get_arch(base_dir):
     f.close()
     return arch
 
-def petsc_get_x11_libs(base_dir, arch):
+def petsc_get_opt(base_dir, arch, opt):
+    petscconf = os.path.join(base_dir, 'bmake', 
+                             arch, 'petscconf')
+    if not os.path.exists(petscconf):
+        return None
+    f = file(petscconf, 'r')
+    res = ''
+    for l in f.readlines():
+        if l[:len(opt)] == opt:
+            res = l.split('=')[1].strip()
+            break
+    f.close()
+    return res
+
+def petsc_get_libs(base_dir, arch, prefix):
     petscconf = os.path.join(base_dir, 'bmake', 
                              arch, 'petscconf')
     if not os.path.exists(petscconf):
@@ -69,13 +83,16 @@ def petsc_get_x11_libs(base_dir, arch):
     f = file(petscconf, 'r')
     libs = []
     lib_dirs = []
+    prefix = prefix + '_LIB'
     for l in f.readlines():
-        if l[:7] == 'X11_LIB':
+        if l[:len(prefix)] == prefix:
             libs = l.split('=')[1].strip().split(' ')
-            libs = [lib[2:] for lib in libs \
-                        if lib[:2] == env['LIBLINKPREFIX']]
-            lib_dirs = [lib[2:] for lib in libs \
-                            if lib[:2] == env['LIBDIRPREFIX']]
+            length = len(env['LIBLINKPREFIX'])
+            libs = [lib[length:] for lib in libs \
+                        if lib[:length] == env['LIBLINKPREFIX']]
+            length = len(env['LIBDIRPREFIX'])
+            lib_dirs = [lib[length:] for lib in libs \
+                            if lib[:length] == env['LIBDIRPREFIX']]
             break
     f.close()
     return (lib_dirs, libs)
@@ -85,7 +102,7 @@ def petsc_check_state(state):
     if not arch:
         return False
 
-    x11_libs = petsc_get_x11_libs(state.base_dir, arch)
+    x11_libs = petsc_get_libs(state.base_dir, arch, 'X11')
     if x11_libs is None:
         return False
 
@@ -106,6 +123,8 @@ def petsc_check_state(state):
     for l in x11_libs[1]:
         if l not in state.libs:
             state.libs.append(l)
+
+    state.arch = arch
 
     return True
 
@@ -229,6 +248,54 @@ if not env.GetOption('clean'):
     if not build_opts:
         if not cfg.CheckPackage(petsc):
             env.Exit()
+
+        # Check that there isn't a conflict in PETSc's MPICH.
+        petsc_state = env['PACKAGES']['PETSc']
+        mpich_state = env['PACKAGES']['MPICH']
+        libs = petsc_get_libs(petsc_state.base_dir, petsc_state.arch, 'MPI')
+        okay = True
+        for l in libs[0]:
+            if l not in mpich.lib_dirs:
+                okay = False
+                break
+        if okay:
+            for l in libs[1]:
+                if l not in mpich.libs:
+                    okay = False
+                    break
+        if okay:
+            mpi_inc_dir = petsc_get_opt(petsc_state.base_dir,
+                                         petsc_state.arch,
+                                         'MPI_INCLUDE')
+            if mpi_inc_dir:
+                mpi_inc_dir = [d[len(env['INCPREFIX']):] \
+                                   for d in mpi_inc_dir.split(' ')]
+                for dir in mpi_inc_dir:
+                    if dir not in mpich_state.hdr_dirs:
+                        okay = False
+                        break
+        if not okay and not env['ignorePetscMpichConflict']:
+            print '   Error: PETSc is using a different MPI implementation'
+            print '          than the located version...'
+            print ''
+            if mpi_inc_dir:
+                print '      PETSc: Header paths: %s' % str(mpi_inc_dir)
+            if libs[0]:
+                print '      PETSc: Lib paths: %s' % str(libs[0])
+            if libs[1]:
+                print '      PETSc: Libs: %s' % str(libs[1])
+            print '\n',
+            print mpich_state.text('      MPICH: ')
+            print '\n',
+            print '   If you are sure this is okay, override this error'
+            print '   with \'ignorePetscMpichConflict\''
+            print '\n',
+            env.Exit()
+
+        elif not okay:
+            print '   Warning: PETSc is using a different MPI implementation'
+            print '            than the located version...\n'
+
         env.Append(CPPDEFINES='HAVE_PETSC')
         opts.Save('config.cache', env)
     else:
diff -r 5fd90fccdd0e -r fe4bd96119f6 SConsUtils
--- a/SConsUtils	Thu Feb 07 23:47:21 2008 +0000
+++ b/SConsUtils	Fri Feb 08 03:53:13 2008 +0000
@@ -104,9 +104,9 @@ class PackageState(object):
     def __init__(self, pkg, base_dir, hdr_dirs, lib_dirs,
                  libs, frameworks):
         self.pkg = pkg
-        self.base_dir = base_dir
-        self.hdr_dirs = hdr_dirs
-        self.lib_dirs = lib_dirs
+        self.base_dir = os.path.realpath(base_dir)
+        self.hdr_dirs = [os.path.realpath(h) for h in hdr_dirs]
+        self.lib_dirs = [os.path.realpath(l) for l in lib_dirs]
         self.libs = libs
         self.frameworks = frameworks
         self.state = {}
diff -r 5fd90fccdd0e -r fe4bd96119f6 SConstruct
--- a/SConstruct	Thu Feb 07 23:47:21 2008 +0000
+++ b/SConstruct	Fri Feb 08 03:53:13 2008 +0000
@@ -34,7 +34,11 @@ opts.AddOptions(
     PathOption('prefix', 'Installation path',
                '/usr/local', PathOption.PathIsDirCreate),
     BoolOption('force32bit', 'Force the use of 32-bit libraries', 0),
-    PackageOption('csoap', 'Enable use of the package CSoap', 'no'))
+    PackageOption('csoap', 'Enable use of the package CSoap', 'no'),
+    BoolOption('ignorePetscMpichConflict',
+               'Allow PETSc to use a different MPICH implementation',
+               0)
+    )
 
 #
 # Fill in our substitution environment with useful things.
@@ -56,8 +60,8 @@ env['RPATH'] = env['RPATH'] if 'RPATH' i
 # Add any variables that get used throughout the whole build.
 if env['debug']:
     env.Append(CCFLAGS='-g')
-env.Append(CPPPATH=['#build/include'])
-env.Append(LIBPATH=['#build/lib'])
+env.Prepend(CPPPATH=['#build/include'])
+env.Prepend(LIBPATH=['#build/lib'])
 
 # Setup any additional build targets.
 env.Alias('install', env['prefix'])
@@ -98,9 +102,9 @@ SConscript('build/Underworld/SConscript'
 SConscript('build/Underworld/SConscript', exports='env')
 env.Append(LIBS=['Underworld'])
 
-#env.clear_all()
-#SConscript('build/Magma/SConscript', exports='env')
-#env.Append(LIBS=['Magma'])
+env.clear_all()
+SConscript('build/Experimental/SConscript', exports='env')
+env.Append(LIBS=['ExperimentalUnderworld'])
 
 env.clear_all()
 SConscript('build/gLucifer/SConscript', exports='env')



More information about the CIG-COMMITS mailing list