[cig-commits] commit: Merging fresh changes from stgUnderworld to
Mercurial
hg at geodynamics.org
Mon Nov 24 11:22:53 PST 2008
changeset: 49:7e2b586b980b
user: LukeHodkinson
date: Wed Mar 12 23:09:22 2008 +0000
files: SConstruct StgSCons config/SConfig/Package.py config/SConfig/packages/BlasLapack.py config/SConfig/packages/CompilerFlags.py config/SConfig/packages/MPI.py config/SConfig/packages/__init__.py config/SConfig/packages/cmath.py config/SConfig/packages/dl.py config/SConfig/packages/libXML2.py config/packages/stgMagma.py
description:
Merging fresh changes from stgUnderworld to
stgMagma.
diff -r 11818f7aabea -r 7e2b586b980b SConstruct
--- a/SConstruct Fri Mar 07 04:54:04 2008 +0000
+++ b/SConstruct Wed Mar 12 23:09:22 2008 +0000
@@ -10,6 +10,8 @@ if platform.platform().find('ia64') != -
env = Environment(ENV=os.environ, tools=['gcc', 'gnulink'])
else:
env = Environment(ENV=os.environ)
+if 'CC' in env['ENV']:
+ env['CC'] = env['ENV']['CC']
# Configuring or building? Or helping?
if 'config' in COMMAND_LINE_TARGETS or 'help' in COMMAND_LINE_TARGETS:
@@ -58,6 +60,6 @@ else:
env.Prepend(LIBS='PICellerator')
SConscript('Underworld/SConscript', exports='env')
env.Prepend(LIBS='Underworld')
- SConscript('Magma/SConscript', exports='env')
+ SConscript('Underworld/Magma', exports='env')
if env['with_glucifer']:
SConscript('gLucifer/SConscript', exports='env')
diff -r 11818f7aabea -r 7e2b586b980b StgSCons
--- a/StgSCons Fri Mar 07 04:54:04 2008 +0000
+++ b/StgSCons Wed Mar 12 23:09:22 2008 +0000
@@ -1,5 +1,6 @@ import os, glob as pyglob, platform, pic
import os, glob as pyglob, platform, pickle
from SCons.Script.SConscript import SConsEnvironment
+import SCons.Sig
#
# Setup some basic path utilities.
@@ -32,10 +33,10 @@ def copy_file(env, dst, src):
dst = env.norm_path(dst)
old = os.getcwd()
os.chdir(env.GetLaunchDir())
- f = File(os.path.abspath(dst))
- f.binfo = f.gen_binfo() # Hack to make work with later versions.
- if not f.is_up_to_date():
- src = env.norm_path(src)
+ src = env.norm_path(src)
+ src_sig = SCons.Sig.MD5.signature(File(os.path.abspath(src)))
+ dst_sig = SCons.Sig.MD5.signature(File(os.path.abspath(dst)))
+ if not os.path.exists(os.path.abspath(dst)) or src_sig != dst_sig:
dst_dir = os.path.dirname(dst)
if not os.path.exists(dst_dir):
Execute(Mkdir(dst_dir))
diff -r 11818f7aabea -r 7e2b586b980b config/SConfig/Package.py
--- a/config/SConfig/Package.py Fri Mar 07 04:54:04 2008 +0000
+++ b/config/SConfig/Package.py Wed Mar 12 23:09:22 2008 +0000
@@ -13,7 +13,9 @@ class Package(object):
# Setup some system specific information.
self.system = platform.system()
- if platform.architecture()[0].find('64') != -1:
+ if platform.platform().find('x86_64') != -1 or \
+ platform.platform().find('ppc64') != -1 or \
+ platform.architecture()[0].find('64') != -1:
self.bits = 64
else:
self.bits = 32
@@ -256,7 +258,7 @@ class Package(object):
# Scan each set of libraries in turn.
libs = []
- for libs in self.libraries:
+ for libs in self.generate_libraries(location):
result = self.check_libs(location, libs)
if result[0]:
break
@@ -337,7 +339,6 @@ class Package(object):
result = [1, '', '']
for l in libs:
src = self.get_header_source()
- src += '#include<dlfcn.h>\n'
src += """
int main(int argc, char* argv[]) {
void* lib;
@@ -419,6 +420,10 @@ int main(int argc, char* argv[]) {
for sub in self.combine_header_sub_dir(dir, hdr):
yield [dir, list(sub), list(lib), list(fw)]
+ def generate_libraries(self, location):
+ for libs in self.libraries:
+ yield libs
+
def combine_sub_dirs(self, base_dir):
"""Take a base directory and combine it with the set of header and library
subdirectories. Yields (['header_dirs'], ['lib_dirs'])."""
@@ -520,11 +525,13 @@ int main(int argc, char* argv[]) {
old = {}
copy = dict(state)
for k, v in copy.iteritems():
+ if not v:
+ continue
if not isinstance(v, list):
copy[k] = [v]
else:
copy[k] = v
- old[k] = self.env.get(k, None)
+ old[k] = self.env.get(k, [])
if append:
self.env.AppendUnique(**copy)
else:
@@ -590,7 +597,7 @@ int main(int argc, char* argv[]) {
log_file.close()
os.remove('sconfig.log')
old_log.write(log)
- return (res, log)
+ return [res, log]
def __str__(self):
str = 'Package name: %s\n' % self.name
diff -r 11818f7aabea -r 7e2b586b980b config/SConfig/packages/BlasLapack.py
--- a/config/SConfig/packages/BlasLapack.py Fri Mar 07 04:54:04 2008 +0000
+++ b/config/SConfig/packages/BlasLapack.py Wed Mar 12 23:09:22 2008 +0000
@@ -9,6 +9,7 @@ class BlasLapack(SConfig.Package):
['cblas', 'clapack'],
['mkl', 'mkl_lapack']]
self.frameworks = [['Accelerate']]
+ self.use_rpath = True
self.symbols = [(['dgeev'], 'FORTRAN_NORMAL'),
(['dgeev_'], 'FORTRAN_SINGLE_TRAILINGBAR'),
(['dgeev__'], 'FORTRAN_DOUBLE_TRAILINGBAR'),
@@ -49,3 +50,26 @@ free(rightEigenVec);
'''
self.symbol_prototypes = ['void %s(char*,char*,int*,double*,int*,double*,double*,double*,int*,double*,int*,double*,int*,int*);']
self.symbol_calls = ['%s(&jobVecLeft, &jobVecRight, &dim, arrayA, &dim, outputReal, outputImag, leftEigenVec, &leadDimVL, rightEigenVec, &leadDimVR, workSpace, &dimWorkSpace, &INFO );']
+
+ # Thanks to there not being a C version of Blas/Lapack on edda, we need
+ # to be able to search for that installation specifically.
+ def generate_locations(self):
+ lib_dir = ['/usr/local/IBM_compilers/xlf/9.1/lib64',
+ '/opt/ibmcmp/lib64']
+ use_dir = True
+ for d in lib_dir:
+ if not os.path.exists(d):
+ use_dir = False
+ break
+ for loc in SConfig.Package.generate_locations(self):
+ yield loc
+ if use_dir:
+ yield [loc[0], loc[1], loc[2] + lib_dir, loc[3]]
+
+ def generate_libraries(self, location):
+ lib_dir = '/usr/local/IBM_compilers/xlf/9.1/lib64'
+ if lib_dir in location[2]:
+ yield ['blas', 'lapack', 'xlf90', 'xlfmath', 'xl']
+ else:
+ for libs in SConfig.Package.generate_libraries(self, location):
+ yield libs
diff -r 11818f7aabea -r 7e2b586b980b config/SConfig/packages/CompilerFlags.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/config/SConfig/packages/CompilerFlags.py Wed Mar 12 23:09:22 2008 +0000
@@ -0,0 +1,62 @@
+import os, platform
+import SCons.Script
+import SConfig
+
+class CompilerFlags(SConfig.Package):
+ def __init__(self, env, options):
+ SConfig.Package.__init__(self, env, options)
+ self.checks = [self.check_bit_flags,
+ self.check_architecture]
+
+ def setup_options(self):
+ SConfig.Package.setup_options(self)
+ if not self.opts:
+ return
+ self.command_options += ['with_32bit']
+ self.opts.AddOptions(
+ SCons.Script.BoolOption('with_32bit', 'Generate 32bit code', 0),
+ SCons.Script.BoolOption('with_64bit', 'Generate 64bit code', 0))
+
+ def check_architecture(self):
+ if (platform.platform().find('x86_64') != -1 or \
+ platform.platform().find('ppc64') != -1 or \
+ platform.architecture()[0].find('64') != -1 or \
+ self.env['with_64bit']) and \
+ not self.env['with_32bit']:
+ self.bits = 64
+ if self.flag_64bit:
+ self.env.MergeFlags(self.flag_64bit)
+ if self.env.subst('$CC') == self.env.subst('$LINK'):
+ self.env.AppendUnique(LINKFLAGS=[self.flag_64bit])
+ else:
+ self.bits = 32
+ if self.flag_32bit:
+ self.env.MergeFlags(self.flag_32bit)
+ if self.env.subst('$CC') == self.env.subst('$LINK'):
+ self.env.AppendUnique(LINKFLAGS=[self.flag_32bit])
+ return [1, '', '']
+
+ def check_bit_flags(self):
+ if self.try_flag('-m32')[0]:
+ self.flag_32bit = '-m32'
+ elif self.try_flag('-q32')[0]:
+ self.flag_32bit = '-q32'
+ else:
+ self.flag_32bit = ''
+ if self.try_flag('-m64')[0]:
+ self.flag_64bit = '-m64'
+ elif self.try_flag('-q64')[0]:
+ self.flag_64bit = '-q64'
+ else:
+ self.flag_64bit = ''
+ return [1, '', '']
+
+ def try_flag(self, flag):
+ state = self.env.ParseFlags(flag)
+ old = self.push_state(state)
+ result = self.run_scons_cmd(self.ctx.TryCompile, '', '.c')
+ self.pop_state(old)
+ if result[0] and (result[1].find('not recognized') != -1 or
+ result[1].find('not recognised') != -1):
+ result[0] = 0
+ return [result[0], result[1], '']
diff -r 11818f7aabea -r 7e2b586b980b config/SConfig/packages/MPI.py
--- a/config/SConfig/packages/MPI.py Fri Mar 07 04:54:04 2008 +0000
+++ b/config/SConfig/packages/MPI.py Wed Mar 12 23:09:22 2008 +0000
@@ -4,6 +4,7 @@ class MPI(SConfig.Package):
class MPI(SConfig.Package):
def __init__(self, env, options):
SConfig.Package.__init__(self, env, options)
+ self.dependency(SConfig.packages.CompilerFlags)
self.base_patterns = ['mpich*', 'MPICH*']
self.header_sub_dir = 'mpi'
self.headers = [['mpi.h']]
@@ -20,5 +21,5 @@ class MPI(SConfig.Package):
shared_dir = os.path.join(lib_dir, 'shared')
path = os.path.join(location[0], shared_dir)
if os.path.exists(path):
- location[2] += [shared_dir]
+ location[2] = [shared_dir] + location[2]
return [1, '', '']
diff -r 11818f7aabea -r 7e2b586b980b config/SConfig/packages/__init__.py
--- a/config/SConfig/packages/__init__.py Fri Mar 07 04:54:04 2008 +0000
+++ b/config/SConfig/packages/__init__.py Wed Mar 12 23:09:22 2008 +0000
@@ -1,3 +1,4 @@ from libXML2 import libXML2
+from CompilerFlags import CompilerFlags
from libXML2 import libXML2
from MPI import MPI
from PETSc import PETSc
diff -r 11818f7aabea -r 7e2b586b980b config/SConfig/packages/cmath.py
--- a/config/SConfig/packages/cmath.py Fri Mar 07 04:54:04 2008 +0000
+++ b/config/SConfig/packages/cmath.py Wed Mar 12 23:09:22 2008 +0000
@@ -4,4 +4,5 @@ class cmath(SConfig.Package):
class cmath(SConfig.Package):
def __init__(self, env, options):
SConfig.Package.__init__(self, env, options)
+ self.dependency(SConfig.packages.CompilerFlags)
self.libraries = [['m']]
diff -r 11818f7aabea -r 7e2b586b980b config/SConfig/packages/dl.py
--- a/config/SConfig/packages/dl.py Fri Mar 07 04:54:04 2008 +0000
+++ b/config/SConfig/packages/dl.py Wed Mar 12 23:09:22 2008 +0000
@@ -4,5 +4,6 @@ class dl(SConfig.Package):
class dl(SConfig.Package):
def __init__(self, env, options):
SConfig.Package.__init__(self, env, options)
+ self.dependency(SConfig.packages.CompilerFlags)
self.headers = [['dlfcn.h']]
self.libraries = [['dl']]
diff -r 11818f7aabea -r 7e2b586b980b config/SConfig/packages/libXML2.py
--- a/config/SConfig/packages/libXML2.py Fri Mar 07 04:54:04 2008 +0000
+++ b/config/SConfig/packages/libXML2.py Wed Mar 12 23:09:22 2008 +0000
@@ -4,6 +4,7 @@ class libXML2(SConfig.Package):
class libXML2(SConfig.Package):
def __init__(self, env, options):
SConfig.Package.__init__(self, env, options)
+ self.dependency(SConfig.packages.CompilerFlags)
self.header_sub_dir = 'libxml2'
self.headers = [[os.path.join('libxml', 'parser.h')]]
self.libraries = [['xml2']]
diff -r 11818f7aabea -r 7e2b586b980b config/packages/stgMagma.py
--- a/config/packages/stgMagma.py Fri Mar 07 04:54:04 2008 +0000
+++ b/config/packages/stgMagma.py Wed Mar 12 23:09:22 2008 +0000
@@ -63,8 +63,4 @@ class stgMagma(SConfig.Package):
if self.env['debug']:
self.env.MergeFlags('-g')
- # Setup 64 bit builds.
- #if platform.architecture()[0].find('64') != -1:
- # self.env.MergeFlags('-m64')
-
return [1, '', '']
More information about the CIG-COMMITS
mailing list