[Numpy-svn] r4359 - in branches/numpy.scons/numpy: distutils/scons/checkers scons_fake/checkers

numpy-svn@scip... numpy-svn@scip...
Tue Oct 30 07:22:17 CDT 2007


Author: cdavid
Date: 2007-10-30 07:22:10 -0500 (Tue, 30 Oct 2007)
New Revision: 4359

Modified:
   branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py
   branches/numpy.scons/numpy/distutils/scons/checkers/support.py
   branches/numpy.scons/numpy/scons_fake/checkers/SConstruct
Log:
Start working on getting version in perflib

Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py	2007-10-30 10:39:36 UTC (rev 4358)
+++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py	2007-10-30 12:22:10 UTC (rev 4359)
@@ -1,5 +1,5 @@
 #! /usr/bin/env python
-# Last Change: Tue Oct 30 06:00 PM 2007 J
+# Last Change: Tue Oct 30 09:00 PM 2007 J
 
 # This module defines checkers for performances libs providing standard API,
 # such as MKL (Intel), ATLAS, Sunperf (solaris and linux), Accelerate (Mac OS
@@ -12,7 +12,7 @@
 from numpy.distutils.scons.testcode_snippets import cblas_sgemm as cblas_src, \
         c_sgemm as sunperf_src, lapack_sgesv
 
-from support import check_include_and_run
+from support import check_include_and_run, CheckOptions
 
 #def CheckMKL(context, mkl_dir, nb):
 #    """mkl_lib is the root path of MKL (the one which contains include, lib,
@@ -25,6 +25,26 @@
 #    return check_include_and_run(context, 'MKL', cpppath, ['mkl.h'],
 #                                  cblas_src, libs, libpath, [], [], autoadd)
 
+#     code = """
+# #include <stdio.h>
+# #include "mkl.h"
+# 
+# int main(void)
+# {
+#     MKLVersion ver;
+#     MKLGetVersion(&ver);
+# 
+#     printf("Major version:          %d\n",ver.MajorVersion);
+#     printf("Minor version:          %d\n",ver.MinorVersion);
+#     printf("Build number:           %d\n",ver.BuildNumber);
+#     printf("Product status:         %s\n",ver.ProductStatus);
+#     printf("Build:                  %s\n",ver.Build);
+#     printf("Processor optimization: %s\n",ver.Processor);
+# 
+#     return 0;
+# }
+# """
+
 def CheckMKL(context, autoadd = 1):
     """Check MKL is usable using a simple cblas example."""
     section = "mkl"
@@ -32,12 +52,37 @@
     (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section)
     if not found:
         # XXX: find exact options to use for the MKL
-        libs.extend(['lapack', 'mkl', 'guide', 'm'])
+        libs.extend(['mkl', 'guide', 'm'])
+
     headers = ['mkl.h']
 
     return check_include_and_run(context, 'MKL', cpppath, headers,
                                   cblas_src, libs, libpath, [], [], autoadd)
 
+def _CheckATLASVersion(context):
+    pass
+
+def CheckATLAS2(context, autoadd = 1):
+    """Check whether ATLAS is usable in C."""
+    opts = CheckOptions(libs = ['atlas'])
+
+    context.Message("Checking ATLAS ... ")
+    version_code = """
+void ATL_buildinfo(void);
+int main(void) {
+  ATL_buildinfo();
+  return 0;
+}
+"""
+    env = context.env
+    env.AppendUnique(LIBS = 'atlas')
+    if not context.TryLink(version_code, '.c'):
+        return "blas blas"
+
+    st, out = context.TryRun(version_code, '.c')
+    context.Result(st)
+    return st
+
 def CheckATLAS(context, autoadd = 1):
     """Check whether ATLAS is usable in C."""
 

Modified: branches/numpy.scons/numpy/distutils/scons/checkers/support.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/checkers/support.py	2007-10-30 10:39:36 UTC (rev 4358)
+++ branches/numpy.scons/numpy/distutils/scons/checkers/support.py	2007-10-30 12:22:10 UTC (rev 4359)
@@ -1,10 +1,43 @@
 #! /usr/bin/env python
-# Last Change: Tue Oct 30 05:00 PM 2007 J
+# Last Change: Tue Oct 30 09:00 PM 2007 J
 
 # This module defines some helper functions, to be used by high level checkers
 
 from copy import deepcopy
 
+class CheckOptions:
+    def __init__(self, cpppath = None, headers = None, cflags = None, 
+                 libpath = None, libs = None, linkflags = None):
+        if cpppath:
+            self.cpppath = cpppath
+        else:
+            self.cpppath = []
+
+        if headers:
+            self.headers = headers
+        else:
+            self.headers = []
+
+        if cflags:
+            self.cflags = cflags
+        else:
+            self.cflags = []
+
+        if libpath:
+            self.libpath = libpath
+        else:
+            self.libpath = []
+
+        if libs:
+            self.libs = libs
+        else:
+            self.libs = []
+
+        if linkflags:
+            self.linkflags = linkflags
+        else:
+            self.linkflags = []
+
 def check_include_and_run(context, name, cpppath, headers, run_src, libs,
                           libpath, linkflags, cflags, autoadd = 1):
     """This is a basic implementation for generic "test include and run"

Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct
===================================================================
--- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct	2007-10-30 10:39:36 UTC (rev 4358)
+++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct	2007-10-30 12:22:10 UTC (rev 4359)
@@ -1,7 +1,7 @@
 # vim:syntax=python
 from numpy.distutils.scons import GetNumpyEnvironment
 from numpy.distutils.scons.checkers.perflib import \
-        CheckATLAS, CheckAccelerate, CheckMKL, CheckSunperf
+        CheckATLAS, CheckAccelerate, CheckMKL, CheckSunperf, CheckATLAS2
 
 env = GetNumpyEnvironment(ARGUMENTS)
 
@@ -14,12 +14,14 @@
 
 config = env.NumpyConfigure(custom_tests = 
     {'CheckATLAS' : CheckATLAS,
+    'CheckATLAS2' : CheckATLAS2,
     'CheckMKL' : CheckMKL,
     'CheckAccelerate' : CheckAccelerate,
     'CheckSunperf' : CheckSunperf})
 
 if do_check:
-    config.CheckATLAS(autoadd = 0)
+    #config.CheckATLAS(autoadd = 0)
+    config.CheckATLAS2(autoadd = 0)
     config.CheckMKL(autoadd = 0)
     config.CheckAccelerate(autoadd = 0)
     config.CheckSunperf(autoadd = 0)



More information about the Numpy-svn mailing list