1
#ifndef NUMEXPR_MODULE_HPP
2
#define NUMEXPR_MODULE_HPP
4
// Deal with the clunky numpy import mechanism
5
// by inverting the logic of the NO_IMPORT_ARRAY symbol.
6
#define PY_ARRAY_UNIQUE_SYMBOL numexpr_ARRAY_API
7
#ifndef DO_NUMPY_IMPORT_ARRAY
8
# define NO_IMPORT_ARRAY
12
#include <numpy/ndarrayobject.h>
13
#include <numpy/arrayscalars.h>
15
#include "numexpr_config.hpp"
18
/* Global variables for threads */
19
int nthreads; /* number of desired threads in pool */
20
int init_threads_done; /* pool of threads initialized? */
21
int end_threads; /* should exisiting threads end? */
22
pthread_t threads[MAX_THREADS]; /* opaque structure for threads */
23
int tids[MAX_THREADS]; /* ID per each thread */
24
npy_intp gindex; /* global index for all threads */
25
int init_sentinels_done; /* sentinels initialized? */
26
int giveup; /* should parallel code giveup? */
27
int force_serial; /* force serial code instead of parallel? */
28
int pid; /* the PID for this process */
30
/* Syncronization variables */
31
pthread_mutex_t count_mutex;
33
pthread_mutex_t count_threads_mutex;
34
pthread_cond_t count_threads_cv;
38
init_threads_done = 0;
44
extern global_state gs;
46
int numexpr_set_nthreads(int nthreads_new);
48
#endif // NUMEXPR_MODULE_HPP