[Numpy-svn] r4729 - in branches/build_with_scons/numpy/core: . include/numpy src

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Jan 18 05:05:12 EST 2008


Author: cdavid
Date: 2008-01-18 04:04:48 -0600 (Fri, 18 Jan 2008)
New Revision: 4729

Modified:
   branches/build_with_scons/numpy/core/include/numpy/ndarrayobject.h
   branches/build_with_scons/numpy/core/setup.py
   branches/build_with_scons/numpy/core/src/multiarraymodule.c
Log:
Merge changes in cleanconfig_rtm

Modified: branches/build_with_scons/numpy/core/include/numpy/ndarrayobject.h
===================================================================
--- branches/build_with_scons/numpy/core/include/numpy/ndarrayobject.h	2008-01-18 09:59:41 UTC (rev 4728)
+++ branches/build_with_scons/numpy/core/include/numpy/ndarrayobject.h	2008-01-18 10:04:48 UTC (rev 4729)
@@ -16,7 +16,7 @@
 #include "numpyconfig.h"
 
 /* Only use thread if configured in config and python supports it */
-#if defined WITH_THREAD && !NPY_NOSMP
+#if defined WITH_THREAD && !NPY_NO_SMP
         #define NPY_ALLOW_THREADS 1
 #else
         #define NPY_ALLOW_THREADS 0

Modified: branches/build_with_scons/numpy/core/setup.py
===================================================================
--- branches/build_with_scons/numpy/core/setup.py	2008-01-18 09:59:41 UTC (rev 4728)
+++ branches/build_with_scons/numpy/core/setup.py	2008-01-18 10:04:48 UTC (rev 4729)
@@ -23,6 +23,31 @@
     header."""
     return sys.platform == 'win32'
 
+def is_npy_no_smp():
+    """Return True if the NPY_NO_SMP symbol must be defined in public
+    header (when SMP support cannot be reliably enabled)."""
+    # Python 2.3 causes a segfault when
+    #  trying to re-acquire the thread-state
+    #  which is done in error-handling
+    #  ufunc code.  NPY_ALLOW_C_API and friends
+    #  cause the segfault. So, we disable threading
+    #  for now.
+    if sys.version[:5] < '2.4.2':
+        nosmp = 1
+    else:
+        # Perhaps a fancier check is in order here.
+        #  so that threads are only enabled if there
+        #  are actually multiple CPUS? -- but
+        #  threaded code can be nice even on a single
+        #  CPU so that long-calculating code doesn't
+        #  block.
+        try:
+            nosmp = os.environ['NPY_NOSMP']
+            nosmp = 1
+        except KeyError:
+            nosmp = 0
+    return nosmp == 1
+
 def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration,dot_join
     from numpy.distutils.system_info import get_info, default_lib_dirs
@@ -58,26 +83,6 @@
                 raise SystemError,"Failed to test configuration. "\
                       "See previous error messages for more information."
 
-            # Python 2.3 causes a segfault when
-            #  trying to re-acquire the thread-state
-            #  which is done in error-handling
-            #  ufunc code.  NPY_ALLOW_C_API and friends
-            #  cause the segfault. So, we disable threading
-            #  for now.
-            if sys.version[:5] < '2.4.2':
-                nosmp = 1
-            else:
-                # Perhaps a fancier check is in order here.
-                #  so that threads are only enabled if there
-                #  are actually multiple CPUS? -- but
-                #  threaded code can be nice even on a single
-                #  CPU so that long-calculating code doesn't
-                #  block.
-                try:
-                    nosmp = os.environ['NPY_NOSMP']
-                    nosmp = 1
-                except KeyError:
-                    nosmp = 0
             moredefs = []
             #
             mathlibs = []
@@ -107,7 +112,7 @@
                     moredefs.append(defsymbol)
 
             if is_npy_no_signal():
-                moredefs.append('NPY_NO_SIGNAL')
+                moredefs.append('__NPY_PRIVATE_NO_SIGNAL')
 
             if sys.platform=='win32' or os.name=='nt':
                 from distutils.msvccompiler import get_build_architecture
@@ -127,12 +132,6 @@
                     target_f.write('#define %s\n' % (d))
                 else:
                     target_f.write('#define %s %s\n' % (d[0],d[1]))
-            # Define NPY_NOSMP to 1 if explicitely requested, or if we cannot
-            # support thread support reliably
-            if nosmp:
-                target_f.write('#define NPY_NOSMP 1\n')
-            else:
-                target_f.write('#define NPY_NOSMP 0\n')
             target_f.close()
             print 'File:',target
             target_f = open(target)
@@ -399,8 +398,7 @@
             ('NPY_SIZEOF_FLOAT', 'SIZEOF_FLOAT'),
             ('NPY_SIZEOF_DOUBLE', 'SIZEOF_DOUBLE'),
             ('NPY_SIZEOF_LONGDOUBLE', 'SIZEOF_LONG_DOUBLE'),
-            ('NPY_SIZEOF_PY_INTPTR_T', 'SIZEOF_PY_INTPTR_T'),
-            ('NPY_NOSMP', 'NPY_NOSMP'),]
+            ('NPY_SIZEOF_PY_INTPTR_T', 'SIZEOF_PY_INTPTR_T')]
 
     testcode = ["""
 #include <Python.h>
@@ -427,6 +425,13 @@
     if is_npy_no_signal():
         testcode.append(r'    fprintf(f, "\n#define NPY_NO_SIGNAL\n");')
 
+    # Define NPY_NOSMP to 1 if explicitely requested, or if we cannot
+    # support thread support reliably
+    if is_npy_no_smp():
+        testcode.append(r'    fprintf(f, "#define NPY_NO_SMP 1\n");')
+    else:
+        testcode.append(r'    fprintf(f, "#define NPY_NO_SMP 0\n");')
+
     tmpcode = r"""
     #ifdef PY_LONG_LONG
         fprintf(f, "\n#define %s %%d \n", %s);

Modified: branches/build_with_scons/numpy/core/src/multiarraymodule.c
===================================================================
--- branches/build_with_scons/numpy/core/src/multiarraymodule.c	2008-01-18 09:59:41 UTC (rev 4728)
+++ branches/build_with_scons/numpy/core/src/multiarraymodule.c	2008-01-18 10:04:48 UTC (rev 4729)
@@ -7267,7 +7267,7 @@
 }
 
 
-#ifndef NPY_NO_SIGNAL
+#ifndef __NPY_PRIVATE_NO_SIGNAL
 
 SIGJMP_BUF _NPY_SIGINT_BUF;
 




More information about the Numpy-svn mailing list