Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
numpyconfig.h186 linesDownload Raw Back to numpy
1#ifndef NUMPY_CORE_INCLUDE_NUMPY_NPY_NUMPYCONFIG_H_
2#define NUMPY_CORE_INCLUDE_NUMPY_NPY_NUMPYCONFIG_H_
3
4#include "_numpyconfig.h"
5
6/*
7 * On Mac OS X, because there is only one configuration stage for all the archs
8 * in universal builds, any macro which depends on the arch needs to be
9 * hardcoded.
10 *
11 * Note that distutils/pip will attempt a universal2 build when Python itself
12 * is built as universal2, hence this hardcoding is needed even if we do not
13 * support universal2 wheels anymore (see gh-22796).
14 * This code block can be removed after we have dropped the setup.py based
15 * build completely.
16 */
17#ifdef __APPLE__
18    #undef NPY_SIZEOF_LONG
19
20    #ifdef __LP64__
21        #define NPY_SIZEOF_LONG         8
22    #else
23        #define NPY_SIZEOF_LONG         4
24    #endif
25
26    #undef NPY_SIZEOF_LONGDOUBLE
27    #undef NPY_SIZEOF_COMPLEX_LONGDOUBLE
28    #ifdef HAVE_LDOUBLE_IEEE_DOUBLE_LE
29      #undef HAVE_LDOUBLE_IEEE_DOUBLE_LE
30    #endif
31    #ifdef HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE
32      #undef HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE
33    #endif
34
35    #if defined(__arm64__)
36        #define NPY_SIZEOF_LONGDOUBLE         8
37        #define NPY_SIZEOF_COMPLEX_LONGDOUBLE 16
38        #define HAVE_LDOUBLE_IEEE_DOUBLE_LE 1
39    #elif defined(__x86_64)
40        #define NPY_SIZEOF_LONGDOUBLE         16
41        #define NPY_SIZEOF_COMPLEX_LONGDOUBLE 32
42        #define HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE 1
43    #elif defined (__i386)
44        #define NPY_SIZEOF_LONGDOUBLE         12
45        #define NPY_SIZEOF_COMPLEX_LONGDOUBLE 24
46    #elif defined(__ppc__) || defined (__ppc64__)
47        #define NPY_SIZEOF_LONGDOUBLE         16
48        #define NPY_SIZEOF_COMPLEX_LONGDOUBLE 32
49    #else
50        #error "unknown architecture"
51    #endif
52#endif
53
54
55/**
56 * To help with both NPY_TARGET_VERSION and the NPY_NO_DEPRECATED_API macro,
57 * we include API version numbers for specific versions of NumPy.
58 * To exclude all API that was deprecated as of 1.7, add the following before
59 * #including any NumPy headers:
60 *   #define NPY_NO_DEPRECATED_API  NPY_1_7_API_VERSION
61 * The same is true for NPY_TARGET_VERSION, although NumPy will default to
62 * a backwards compatible build anyway.
63 */
64#define NPY_1_7_API_VERSION 0x00000007
65#define NPY_1_8_API_VERSION 0x00000008
66#define NPY_1_9_API_VERSION 0x00000009
67#define NPY_1_10_API_VERSION 0x0000000a
68#define NPY_1_11_API_VERSION 0x0000000a
69#define NPY_1_12_API_VERSION 0x0000000a
70#define NPY_1_13_API_VERSION 0x0000000b
71#define NPY_1_14_API_VERSION 0x0000000c
72#define NPY_1_15_API_VERSION 0x0000000c
73#define NPY_1_16_API_VERSION 0x0000000d
74#define NPY_1_17_API_VERSION 0x0000000d
75#define NPY_1_18_API_VERSION 0x0000000d
76#define NPY_1_19_API_VERSION 0x0000000d
77#define NPY_1_20_API_VERSION 0x0000000e
78#define NPY_1_21_API_VERSION 0x0000000e
79#define NPY_1_22_API_VERSION 0x0000000f
80#define NPY_1_23_API_VERSION 0x00000010
81#define NPY_1_24_API_VERSION 0x00000010
82#define NPY_1_25_API_VERSION 0x00000011
83#define NPY_2_0_API_VERSION 0x00000012
84#define NPY_2_1_API_VERSION 0x00000013
85#define NPY_2_2_API_VERSION 0x00000013
86#define NPY_2_3_API_VERSION 0x00000014
87#define NPY_2_4_API_VERSION 0x00000015
88
89
90/*
91 * Binary compatibility version number.  This number is increased
92 * whenever the C-API is changed such that binary compatibility is
93 * broken, i.e. whenever a recompile of extension modules is needed.
94 */
95#define NPY_VERSION NPY_ABI_VERSION
96
97/*
98 * Minor API version we are compiling to be compatible with.  The version
99 * Number is always increased when the API changes via: `NPY_API_VERSION`
100 * (and should maybe just track the NumPy version).
101 *
102 * If we have an internal build, we always target the current version of
103 * course.
104 *
105 * For downstream users, we default to an older version to provide them with
106 * maximum compatibility by default.  Downstream can choose to extend that
107 * default, or narrow it down if they wish to use newer API.  If you adjust
108 * this, consider the Python version support (example for 1.25.x):
109 *
110 * NumPy 1.25.x supports Python:                     3.9  3.10  3.11  (3.12)
111 * NumPy 1.19.x supports Python:      3.6  3.7  3.8  3.9
112 * NumPy 1.17.x supports Python: 3.5  3.6  3.7  3.8
113 * NumPy 1.15.x supports Python: ...  3.6  3.7
114 *
115 * Users of the stable ABI may wish to target the last Python that is not
116 * end of life.  This would be 3.8 at NumPy 1.25 release time.
117 * 1.17 as default was the choice of oldest-support-numpy at the time and
118 * has in practice no limit (compared to 1.19).  Even earlier becomes legacy.
119 */
120#if defined(NPY_INTERNAL_BUILD) && NPY_INTERNAL_BUILD
121    /* NumPy internal build, always use current version. */
122    #define NPY_FEATURE_VERSION NPY_API_VERSION
123#elif defined(NPY_TARGET_VERSION) && NPY_TARGET_VERSION
124    /* user provided a target version, use it */
125    #define NPY_FEATURE_VERSION NPY_TARGET_VERSION
126#else
127    /* Use the default (increase when dropping Python 3.11 support) */
128    #define NPY_FEATURE_VERSION NPY_1_23_API_VERSION
129#endif
130
131/* Sanity check the (requested) feature version */
132#if NPY_FEATURE_VERSION > NPY_API_VERSION
133    #error "NPY_TARGET_VERSION higher than NumPy headers!"
134#elif NPY_FEATURE_VERSION < NPY_1_15_API_VERSION
135    /* No support for irrelevant old targets, no need for error, but warn. */
136    #ifndef _MSC_VER
137        #warning "Requested NumPy target lower than supported NumPy 1.15."
138    #else
139        #define _WARN___STR2__(x) #x
140        #define _WARN___STR1__(x) _WARN___STR2__(x)
141        #define _WARN___LOC__ __FILE__ "(" _WARN___STR1__(__LINE__) ") : Warning Msg: "
142        #pragma message(_WARN___LOC__"Requested NumPy target lower than supported NumPy 1.15.")
143    #endif
144#endif
145
146/*
147 * We define a human readable translation to the Python version of NumPy
148 * for error messages (and also to allow grepping the binaries for conda).
149 */
150#if NPY_FEATURE_VERSION == NPY_1_7_API_VERSION
151    #define NPY_FEATURE_VERSION_STRING "1.7"
152#elif NPY_FEATURE_VERSION == NPY_1_8_API_VERSION
153    #define NPY_FEATURE_VERSION_STRING "1.8"
154#elif NPY_FEATURE_VERSION == NPY_1_9_API_VERSION
155    #define NPY_FEATURE_VERSION_STRING "1.9"
156#elif NPY_FEATURE_VERSION == NPY_1_10_API_VERSION  /* also 1.11, 1.12 */
157    #define NPY_FEATURE_VERSION_STRING "1.10"
158#elif NPY_FEATURE_VERSION == NPY_1_13_API_VERSION
159    #define NPY_FEATURE_VERSION_STRING "1.13"
160#elif NPY_FEATURE_VERSION == NPY_1_14_API_VERSION  /* also 1.15 */
161    #define NPY_FEATURE_VERSION_STRING "1.14"
162#elif NPY_FEATURE_VERSION == NPY_1_16_API_VERSION  /* also 1.17, 1.18, 1.19 */
163    #define NPY_FEATURE_VERSION_STRING "1.16"
164#elif NPY_FEATURE_VERSION == NPY_1_20_API_VERSION  /* also 1.21 */
165    #define NPY_FEATURE_VERSION_STRING "1.20"
166#elif NPY_FEATURE_VERSION == NPY_1_22_API_VERSION
167    #define NPY_FEATURE_VERSION_STRING "1.22"
168#elif NPY_FEATURE_VERSION == NPY_1_23_API_VERSION  /* also 1.24 */
169    #define NPY_FEATURE_VERSION_STRING "1.23"
170#elif NPY_FEATURE_VERSION == NPY_1_25_API_VERSION
171    #define NPY_FEATURE_VERSION_STRING "1.25"
172#elif NPY_FEATURE_VERSION == NPY_2_0_API_VERSION
173    #define NPY_FEATURE_VERSION_STRING "2.0"
174#elif NPY_FEATURE_VERSION == NPY_2_1_API_VERSION
175    #define NPY_FEATURE_VERSION_STRING "2.1"
176#elif NPY_FEATURE_VERSION == NPY_2_3_API_VERSION
177    #define NPY_FEATURE_VERSION_STRING "2.3"
178#elif NPY_FEATURE_VERSION == NPY_2_4_API_VERSION
179    #define NPY_FEATURE_VERSION_STRING "2.4"
180#else
181    #error "Missing version string define for new NumPy version."
182#endif
183
184
185#endif  /* NUMPY_CORE_INCLUDE_NUMPY_NPY_NUMPYCONFIG_H_ */
186 
codekingpro/portable-devtools · Team Ai