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

numpy-svn@scip... numpy-svn@scip...
Thu Oct 25 23:52:30 CDT 2007


Author: cdavid
Date: 2007-10-25 23:52:21 -0500 (Thu, 25 Oct 2007)
New Revision: 4298

Modified:
   branches/numpy.scons/numpy/distutils/scons/__init__.py
   branches/numpy.scons/numpy/distutils/scons/custom_checkers.py
   branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py
   branches/numpy.scons/numpy/scons_fake/checkers/SConstruct
Log:
Add Sunperf checker (C called only)

Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/__init__.py	2007-10-26 03:31:45 UTC (rev 4297)
+++ branches/numpy.scons/numpy/distutils/scons/__init__.py	2007-10-26 04:52:21 UTC (rev 4298)
@@ -2,6 +2,6 @@
 from libinfo_scons import NumpyCheckLib
 from libinfo import get_paths as scons_get_paths
 from custom_checkers import CheckMKL, CheckATLAS, CheckCBLAS, \
-        CheckAccelerate, CheckMKL2
+        CheckAccelerate, CheckMKL2, CheckSunperf
 from extension import get_python_inc, get_pythonlib_dir
 from utils import isstring

Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py	2007-10-26 03:31:45 UTC (rev 4297)
+++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py	2007-10-26 04:52:21 UTC (rev 4298)
@@ -9,7 +9,7 @@
 
 from libinfo import get_config, get_config_from_section
 from libinfo_scons import NumpyCheckLib
-from testcode_snippets import cblas_sgemm as cblas_src
+from testcode_snippets import cblas_sgemm as cblas_src, c_sgemm as sunperf_src
 
 def _check_include_and_run(context, name, cpppath, headers, run_src, libs,
                            libpath, linkflags, cflags, autoadd = 1):
@@ -99,6 +99,7 @@
                                   cblas_src, libs, libpath, [], [], autoadd)
 
 def CheckMKL2(context, autoadd = 1):
+    """Check MKL is usable using a simple cblas example."""
     section = "mkl"
     siteconfig, cfgfiles = get_config()
     (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section)
@@ -125,6 +126,17 @@
                                   ['Accelerate/Accelerate.h'], cblas_src, [], 
                                   [], linkflags, [], autoadd)
 
+def CheckSunperf(context, autoadd = 1):
+    """Checker for sunperf using a simple sunperf example"""
+
+    # XXX: Other options needed ?
+    linkflags = ['-xlic_lib=sunperf']
+    cflags = ['-dalign']
+
+    return _check_include_and_run(context, 'sunperf', None, 
+                                  ['sunperf.h'], sunperf_src, [], 
+                                  [], linkflags, cflags, autoadd)
+
 def CheckCBLAS(context, autoadd = 1):
 
     # If section cblas is in site.cfg, use those options. Otherwise, use default

Modified: branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py	2007-10-26 03:31:45 UTC (rev 4297)
+++ branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py	2007-10-26 04:52:21 UTC (rev 4298)
@@ -6,18 +6,20 @@
 # symbols or headers, those are overkill).
 
 # Check whether CBLAS sgemm works
-cblas_sgemm = """
+cblas_sgemm = r"""
 
 int
 main (void)
 {
     int lda = 3;
-    float A[] = { 0.11, 0.12, 0.13,
-                 0.21, 0.22, 0.23 };
+    float A[] = {1, 2, 3,
+                 4, 5, 6};
+
     int ldb = 2;
-    float B[] = { 1011, 1012,
-                 1021, 1022,
-                 1031, 1032 };
+    float B[] = {1, 2, 
+	         3, 4,
+		 5, 6};
+
     int ldc = 2;
     float C[] = { 0.00, 0.00,
                  0.00, 0.00 };
@@ -30,3 +32,34 @@
     return 0;  
 }
 """
+
+# Check whether calling sgemm from C works (FOLLOW FORTRAN CONVENTION !). This
+# is useful to test sunperf, for example.
+c_sgemm = r"""
+/*
+ * sunperf, when calling func wo cblas_ prefix, follows Fortran convention for
+ * array layout in memory !
+ */
+int
+main (void)
+{
+    int lda = 2;
+    float A[] = {1, 4,
+		 2, 5,
+		 3, 6};
+
+    int ldb = 3;
+    float B[] = {1, 3, 5,
+	         2, 4, 6}; 
+    int ldc = 2;
+    float C[] = { 0.00, 0.00,
+                 0.00, 0.00 };
+
+    /* Compute C = A B */
+    sgemm('N', 'N', 2, 2, 3,
+          1.0, A, lda, B, ldb, 0.0, C, ldc);
+
+    printf("C = {%f, %f; %f, %f}\n", C[0], C[2], C[1], C[3]);
+    return 0;  
+}
+"""

Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct
===================================================================
--- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct	2007-10-26 03:31:45 UTC (rev 4297)
+++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct	2007-10-26 04:52:21 UTC (rev 4298)
@@ -1,6 +1,7 @@
 # vim:syntax=python
 from numpy.distutils.scons import GetNumpyEnvironment, CheckATLAS, \
-                                  CheckAccelerate, CheckMKL2, CheckCBLAS
+                                  CheckAccelerate, CheckMKL2, CheckCBLAS, \
+				  CheckSunperf
 
 env = GetNumpyEnvironment(ARGUMENTS)
 
@@ -8,11 +9,14 @@
     {'CheckATLAS' : CheckATLAS,
     'CheckMKL' : CheckMKL2,
     'CheckAccelerate' : CheckAccelerate,
+    'CheckSunperf' : CheckSunperf,
     'CheckCBLAS' : CheckCBLAS})
 
 config.CheckATLAS(autoadd = 0)
 config.CheckMKL(autoadd = 0)
 config.CheckAccelerate(autoadd = 0)
+config.CheckSunperf(autoadd = 0)
+config.CheckCBLAS(autoadd = 0)
 
 config.Finish()
 



More information about the Numpy-svn mailing list