[Numpy-svn] r6104 - branches/dynamic_cpu_configuration/numpy/core/include/numpy

numpy-svn@scip... numpy-svn@scip...
Tue Nov 25 07:56:53 CST 2008


Author: cdavid
Date: 2008-11-25 07:56:49 -0600 (Tue, 25 Nov 2008)
New Revision: 6104

Added:
   branches/dynamic_cpu_configuration/numpy/core/include/numpy/cpuarch.h
Log:
Add a (public) header to detect common CPU archs.

Added: branches/dynamic_cpu_configuration/numpy/core/include/numpy/cpuarch.h
===================================================================
--- branches/dynamic_cpu_configuration/numpy/core/include/numpy/cpuarch.h	2008-11-25 13:23:11 UTC (rev 6103)
+++ branches/dynamic_cpu_configuration/numpy/core/include/numpy/cpuarch.h	2008-11-25 13:56:49 UTC (rev 6104)
@@ -0,0 +1,32 @@
+/*
+ * This set (target) cpu specific macros:
+ *      - NPY_TARGET_CPU: target CPU type
+ */
+#ifndef _NPY_CPUARCH_H_
+#define _NPY_CPUARCH_H_
+
+#if defined ( _i386_ ) || defined( __i386__ )
+        /* __i386__ is defined by gcc and Intel compiler on Linux, _i386_ by
+        VS compiler */
+        #define NPY_TARGET_CPU NPY_X86
+#elif defined(__x86_64__) || defined(__amd64__)
+        /* both __x86_64__ and __amd64__ are defined by gcc */
+        #define NPY_TARGET_CPU NPY_AMD64
+#elif defined(__ppc__) || defined(__powerpc__)
+        /* __ppc__ is defined by gcc, I remember having seen __powerpc__ once,
+         * but can't find it ATM */
+        #define NPY_TARGET_CPU NPY_PPC
+#elif defined(__sparc__) || defined(__sparc)
+        /* __sparc__ is defined by gcc and Forte (e.g. Sun) compilers */
+        #define NPY_TARGET_CPU NPY_SPARC
+#elif defined(__s390__)
+        #define NPY_TARGET_CPU NPY_S390
+#elif defined(__parisc__)
+        /* XXX: Not sure about this one... */
+        #define NPY_TARGET_CPU NPY_PA_RISC
+#else
+        #error Unknown CPU, please report this to numpy maintainers with \
+        information about your platform
+#endif
+
+#endif



More information about the Numpy-svn mailing list