[Scipy-svn] r3577 - branches/scipy.scons/scipy/lib/lapack

scipy-svn@scip... scipy-svn@scip...
Sat Nov 24 02:21:24 CST 2007


Author: cdavid
Date: 2007-11-24 02:18:52 -0600 (Sat, 24 Nov 2007)
New Revision: 3577

Added:
   branches/scipy.scons/scipy/lib/lapack/SConstruct
   branches/scipy.scons/scipy/lib/lapack/scons_support.py
Modified:
   branches/scipy.scons/scipy/lib/lapack/setupscons.py
Log:
scipy/lib/lapack now builds with scons

Copied: branches/scipy.scons/scipy/lib/lapack/SConstruct (from rev 3574, branches/scipy.scons/scipy/linalg/SConstruct)
===================================================================
--- branches/scipy.scons/scipy/linalg/SConstruct	2007-11-24 03:59:04 UTC (rev 3574)
+++ branches/scipy.scons/scipy/lib/lapack/SConstruct	2007-11-24 08:18:52 UTC (rev 3577)
@@ -0,0 +1,89 @@
+# Last Change: Sat Nov 24 05:00 PM 2007 J
+# vim:syntax=python
+
+import os
+from os.path import join as pjoin, splitext
+
+from numpy.distutils.misc_util import get_numpy_include_dirs
+from numpy.distutils.scons import get_python_inc
+from numpy.distutils.scons import GetNumpyEnvironment
+from numpy.distutils.scons import CheckF77LAPACK,\
+                                  CheckCLAPACK, \
+                                  IsATLAS, GetATLASVersion
+
+from scons_support import do_generate_fake_interface, \
+                          generate_interface_emitter
+from numpy.distutils.scons.configuration import write_info
+
+env = GetNumpyEnvironment(ARGUMENTS)
+env.Append(CPPPATH = [get_python_inc(), get_numpy_include_dirs()])
+#if os.name == 'nt':
+#    # NT needs the pythonlib to run any code importing Python.h, including
+#    # simple code using only typedef and so on, so we need it for configuration
+#    # checks
+#    env.AppendUnique(LIBPATH = [get_pythonlib_dir()])
+
+#=======================
+# Starting Configuration
+#=======================
+config = env.NumpyConfigure(custom_tests = {'CheckCBLAS' : CheckCBLAS,
+                                            'CheckBLAS' : CheckF77BLAS,
+                                            'CheckCLAPACK' : CheckCLAPACK,
+                                            'CheckLAPACK' : CheckF77LAPACK})
+
+#--------------
+# Checking Blas
+#--------------
+st = config.CheckLAPACK(check_version = 1)
+if not st:
+    raise RuntimeError("no lapack found, necessary for lapack module")
+
+if IsATLAS(env, 'lapack'):
+    version = GetATLASVersion(env, 'lapack')
+    env.Append(CPPDEFINES = [('ATLAS_INFO', '"\\"%s"\\"' % version)])
+else:
+    env.Append(CPPDEFINES = [('NO_ATLAS_INFO', 1)])
+
+if config.CheckCLAPACK():
+    has_clapack = 1
+else:
+    has_clapack = 0
+
+config.Finish()
+write_info(env)
+
+#==========
+#  Build
+#==========
+env.AppendUnique(CPPPATH = env['F2PYINCLUDEDIR'])
+env.AppendUnique(F2PYOPTIONS = '--quiet')
+
+env['BUILDERS']['GenerateFakePyf'] = Builder(action = do_generate_fake_interface,
+                                  emitter = generate_interface_emitter)
+
+#------------
+#   flapack
+#------------
+yop = env.NumpyFromFTemplate('flapack.pyf', 'flapack.pyf.src')
+env.NumpyPythonExtension('flapack', source = ['flapack.pyf'])
+
+#------------
+#   clapack
+#------------
+if has_clapack:
+    env.NumpyFromFTemplate('clapack.pyf', 'clapack.pyf.src')
+else:
+    env.GenerateFakePyf('clapack', 'clapack.pyf.src')
+env.NumpyPythonExtension('clapack', source = 'clapack.pyf')
+
+#----------------
+# calc_lwork:
+#----------------
+calc_src = env.F2py(pjoin(env['build_dir'], 'calc_lworkmodule.c'), 
+                    source = pjoin(env['build_dir'], 'calc_lwork.f'))
+env.NumpyPythonExtension('calc_lwork', source = calc_src + ['calc_lwork.f'])
+
+#--------------
+# Atlas version
+#--------------
+env.NumpyPythonExtension('atlas_version', 'atlas_version.c')

Copied: branches/scipy.scons/scipy/lib/lapack/scons_support.py (from rev 3576, branches/scipy.scons/scipy/lib/blas/scons_support.py)

Modified: branches/scipy.scons/scipy/lib/lapack/setupscons.py
===================================================================
--- branches/scipy.scons/scipy/lib/lapack/setupscons.py	2007-11-24 08:05:42 UTC (rev 3576)
+++ branches/scipy.scons/scipy/lib/lapack/setupscons.py	2007-11-24 08:18:52 UTC (rev 3577)
@@ -1,106 +1,14 @@
 #!/usr/bin/env python
 
 import os
-from glob import glob
 
-#-------------------
-# To skip wrapping single precision atlas/lapack routines, set
-# the following flag to True:
-
-skip_single_routines = 0
-
-#--------------------
-
-tmpl_empty_clapack_pyf = '''
-python module clapack
-  usercode void empty_module(void) {}
-  interface
-    subroutine empty_module()
-      intent(c) empty_module
-    end subroutine empty_module
-  end interface
-end python module clapack
-'''
-
-
 def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration
     from numpy.distutils.system_info import get_info
 
     config = Configuration('lapack',parent_package,top_path)
 
-    lapack_opt = get_info('lapack_opt',notfound_action=2)
-
-    atlas_version = ([v[3:-3] for k,v in lapack_opt.get('define_macros',[]) \
-                      if k=='ATLAS_INFO']+[None])[0]
-    if atlas_version:
-        print 'ATLAS version',atlas_version
-
-    target_dir = ''
-    skip_names = {'clapack':[],'flapack':[]}
-    if skip_single_routines:
-        target_dir = 'dbl'
-        skip_names['clapack'].extend(\
-            'sgesv cgesv sgetrf cgetrf sgetrs cgetrs sgetri cgetri'\
-            ' sposv cposv spotrf cpotrf spotrs cpotrs spotri cpotri'\
-            ' slauum clauum strtri ctrtri'.split())
-        skip_names['flapack'].extend(skip_names['clapack'])
-        skip_names['flapack'].extend(\
-            'sgesdd cgesdd sgelss cgelss sgeqrf cgeqrf sgeev cgeev'\
-            ' sgegv cgegv ssyev cheev slaswp claswp sgees cgees'
-            ' sggev cggev'.split())
-
-    if atlas_version=='3.2.1_pre3.3.6':
-        target_dir = os.path.join(target_dir,'atlas321')
-        skip_names['clapack'].extend(\
-            'sgetri dgetri cgetri zgetri spotri dpotri cpotri zpotri'\
-            ' slauum dlauum clauum zlauum strtri dtrtri ctrtri ztrtri'.split())
-    elif atlas_version>'3.4.0' and atlas_version<='3.5.12':
-        skip_names['clapack'].extend('cpotrf zpotrf'.split())
-
-    # flapack:
-    config.add_extension('flapack',
-                         sources = ['flapack.pyf.src'],
-                         depends = [__file__,'flapack_*.pyf.src'],
-                         f2py_options = ['skip:']+skip_names['flapack']+[':'],
-                         extra_info = lapack_opt
-                         )
-
-    # clapack:
-    def get_clapack_source(ext, build_dir):
-        name = ext.name.split('.')[-1]
-        assert name=='clapack',`name`
-        if atlas_version is None:
-            target = os.path.join(build_dir,target_dir,'clapack.pyf')
-            from distutils.dep_util import newer
-            if newer(__file__,target):
-                f = open(target,'w')
-                f.write(tmpl_empty_clapack_pyf)
-                f.close()
-        else:
-            target = ext.depends[0]
-            assert os.path.basename(target)=='clapack.pyf.src'
-        return target
-
-    config.add_extension('clapack',
-                         sources = [get_clapack_source],
-                         depends = ['clapack.pyf.src'],
-                         f2py_options = ['skip:']+skip_names['clapack']+[':'],
-                         extra_info = lapack_opt
-                         )
-
-    # calc_lwork:
-    config.add_extension('calc_lwork',
-                         sources = ['calc_lwork.f'],
-                         extra_info = lapack_opt
-                         )
-
-    # atlas_version:
-    config.add_extension('atlas_version',
-                         sources = ['atlas_version.c'],
-                         extra_info = lapack_opt
-                         )
-
+    config.add_sconscript('SConstruct')
     config.add_data_dir('tests')
 
     return config



More information about the Scipy-svn mailing list