summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wiebe <mwwiebe@gmail.com>2011-03-10 00:38:41 -0800
committerMark Wiebe <mwwiebe@gmail.com>2011-03-10 18:38:55 -0800
commit72ef8a6cd4a1491212e7fc4a581825e2267903c8 (patch)
tree5b121eb3d801b3cd8321b11210ed8d8f5e4b5da1
parentec151cc1147913ab470bba277f16a7085d69ec0c (diff)
downloadnumpy-72ef8a6cd4a1491212e7fc4a581825e2267903c8.tar.gz
STY: Work around lack of variadic macros in debug tracing
-rw-r--r--numpy/core/src/multiarray/einsum.c.src42
-rw-r--r--numpy/core/src/multiarray/new_iterator.c.src92
-rw-r--r--numpy/core/src/umath/ufunc_object.c120
3 files changed, 136 insertions, 118 deletions
diff --git a/numpy/core/src/multiarray/einsum.c.src b/numpy/core/src/multiarray/einsum.c.src
index fdad2ad10..376e51c99 100644
--- a/numpy/core/src/multiarray/einsum.c.src
+++ b/numpy/core/src/multiarray/einsum.c.src
@@ -48,9 +48,15 @@
#define NPY_EINSUM_DBG_TRACING 0
#if NPY_EINSUM_DBG_TRACING
-#define NPY_EINSUM_DBG_PRINTF(...) printf(__VA_ARGS__)
+#define NPY_EINSUM_DBG_PRINT(s) printf("%s", s);
+#define NPY_EINSUM_DBG_PRINT1(s, p1) printf(s, p1);
+#define NPY_EINSUM_DBG_PRINT2(s, p1, p2) printf(s, p1, p2);
+#define NPY_EINSUM_DBG_PRINT3(s, p1, p2, p3) printf(s);
#else
-#define NPY_EINSUM_DBG_PRINTF
+#define NPY_EINSUM_DBG_PRINT(s)
+#define NPY_EINSUM_DBG_PRINT1(s, p1)
+#define NPY_EINSUM_DBG_PRINT2(s, p1, p2)
+#define NPY_EINSUM_DBG_PRINT3(s, p1, p2, p3)
#endif
/**********************************************/
@@ -117,7 +123,7 @@ static void
npy_intp stride_out = strides[@nop@];
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_@noplabel@ (%d)\n", (int)count);
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_@noplabel@ (%d)\n", (int)count);
while (count--) {
#if !@complex@
@@ -202,7 +208,7 @@ static void
npy_@name@ *data0 = (npy_@name@ *)dataptr[0];
npy_@name@ *data_out = (npy_@name@ *)dataptr[1];
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_contig_one (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_contig_one (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -269,7 +275,7 @@ static void
__m128 a, b;
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_contig_two (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_contig_two (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -357,7 +363,7 @@ static void
__m128d a, b, value0_sse;
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_stride0_contig_outcontig_two (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_stride0_contig_outcontig_two (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -484,7 +490,7 @@ static void
__m128 a, b, value1_sse;
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_contig_stride0_outcontig_two (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_contig_stride0_outcontig_two (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -570,7 +576,7 @@ static void
__m128d a, accum_sse = _mm_setzero_pd();
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_contig_contig_outstride0_two (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_contig_contig_outstride0_two (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -728,7 +734,7 @@ static void
__m128 a, accum_sse = _mm_setzero_ps();
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_stride0_contig_outstride0_two (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_stride0_contig_outstride0_two (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -827,7 +833,7 @@ static void
__m128 a, accum_sse = _mm_setzero_ps();
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_contig_stride0_outstride0_two (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_contig_stride0_outstride0_two (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -963,7 +969,7 @@ static void
@name@_sum_of_products_contig_@noplabel@(int nop, char **dataptr,
npy_intp *NPY_UNUSED(strides), npy_intp count)
{
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_contig_@noplabel@ (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_contig_@noplabel@ (%d)\n",
(int)count);
while (count--) {
@@ -1031,7 +1037,7 @@ static void
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_contig_outstride0_one (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_contig_outstride0_one (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -1212,7 +1218,7 @@ static void
npy_intp stride2 = strides[2];
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_outstride0_@noplabel@ (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_outstride0_@noplabel@ (%d)\n",
(int)count);
while (count--) {
@@ -2437,7 +2443,7 @@ unbuffered_loop_nop1_ndim2(NpyIter *iter)
#if NPY_EINSUM_DBG_TRACING
NpyIter_DebugPrint(iter);
#endif
- NPY_EINSUM_DBG_PRINTF("running hand-coded 1-op 2-dim loop\n");
+ NPY_EINSUM_DBG_PRINT("running hand-coded 1-op 2-dim loop\n");
NpyIter_GetShape(iter, shape);
memcpy(strides[0], NpyIter_GetAxisStrideArray(iter, 0),
@@ -2485,7 +2491,7 @@ unbuffered_loop_nop1_ndim3(NpyIter *iter)
#if NPY_EINSUM_DBG_TRACING
NpyIter_DebugPrint(iter);
#endif
- NPY_EINSUM_DBG_PRINTF("running hand-coded 1-op 3-dim loop\n");
+ NPY_EINSUM_DBG_PRINT("running hand-coded 1-op 3-dim loop\n");
NpyIter_GetShape(iter, shape);
memcpy(strides[0], NpyIter_GetAxisStrideArray(iter, 0),
@@ -2542,7 +2548,7 @@ unbuffered_loop_nop2_ndim2(NpyIter *iter)
#if NPY_EINSUM_DBG_TRACING
NpyIter_DebugPrint(iter);
#endif
- NPY_EINSUM_DBG_PRINTF("running hand-coded 2-op 2-dim loop\n");
+ NPY_EINSUM_DBG_PRINT("running hand-coded 2-op 2-dim loop\n");
NpyIter_GetShape(iter, shape);
memcpy(strides[0], NpyIter_GetAxisStrideArray(iter, 0),
@@ -2592,7 +2598,7 @@ unbuffered_loop_nop2_ndim3(NpyIter *iter)
#if NPY_EINSUM_DBG_TRACING
NpyIter_DebugPrint(iter);
#endif
- NPY_EINSUM_DBG_PRINTF("running hand-coded 2-op 3-dim loop\n");
+ NPY_EINSUM_DBG_PRINT("running hand-coded 2-op 3-dim loop\n");
NpyIter_GetShape(iter, shape);
memcpy(strides[0], NpyIter_GetAxisStrideArray(iter, 0),
@@ -3075,7 +3081,7 @@ PyArray_EinsteinSum(char *subscripts, npy_intp nop,
if (!needs_api) {
NPY_BEGIN_THREADS;
}
- NPY_EINSUM_DBG_PRINTF("Einsum loop\n");
+ NPY_EINSUM_DBG_PRINT("Einsum loop\n");
do {
sop(nop, dataptr, stride, *countptr);
} while(iternext(iter));
diff --git a/numpy/core/src/multiarray/new_iterator.c.src b/numpy/core/src/multiarray/new_iterator.c.src
index 1ce83ec72..15380e28b 100644
--- a/numpy/core/src/multiarray/new_iterator.c.src
+++ b/numpy/core/src/multiarray/new_iterator.c.src
@@ -48,9 +48,15 @@
#define NPY_IT_DBG_TRACING 0
#if NPY_IT_DBG_TRACING
-#define NPY_IT_DBG_PRINTF(...) printf(__VA_ARGS__)
+#define NPY_IT_DBG_PRINT(s) printf("%s", s)
+#define NPY_IT_DBG_PRINT1(s, p1) printf(s, p1)
+#define NPY_IT_DBG_PRINT2(s, p1, p2) printf(s, p1, p2)
+#define NPY_IT_DBG_PRINT3(s, p1, p2, p3) printf(s, p1, p2, p3)
#else
-#define NPY_IT_DBG_PRINTF
+#define NPY_IT_DBG_PRINT(s)
+#define NPY_IT_DBG_PRINT1(s, p1)
+#define NPY_IT_DBG_PRINT2(s, p1, p2)
+#define NPY_IT_DBG_PRINT3(s, p1, p2, p3)
#endif
/**********************************************/
@@ -609,7 +615,7 @@ NpyIter_MultiNew(int niter, PyArrayObject **op_in, npy_uint32 flags,
return NULL;
}
if (flags&NPY_ITER_COMMON_DTYPE) {
- NPY_IT_DBG_PRINTF("Iterator: Replacing all data types\n");
+ NPY_IT_DBG_PRINT("Iterator: Replacing all data types\n");
/* Replace all the data types */
for (iiter = 0; iiter < niter; ++iiter) {
if (op_dtype[iiter] != dtype) {
@@ -620,7 +626,7 @@ NpyIter_MultiNew(int niter, PyArrayObject **op_in, npy_uint32 flags,
}
}
else {
- NPY_IT_DBG_PRINTF("Iterator: Setting unset output data types\n");
+ NPY_IT_DBG_PRINT("Iterator: Setting unset output data types\n");
/* Replace the NULL data types */
for (iiter = 0; iiter < niter; ++iiter) {
if (op_dtype[iiter] == NULL) {
@@ -1793,7 +1799,7 @@ npyiter_buffered_reduce_iternext_iters@tag_niter@(NpyIter *iter)
NIT_ITERINDEX(iter) += NBF_SIZE(bufferdata);
}
- NPY_IT_DBG_PRINTF("Iterator: Finished iteration %d of outer reduce loop\n",
+ NPY_IT_DBG_PRINT1("Iterator: Finished iteration %d of outer reduce loop\n",
(int)NBF_REDUCE_POS(bufferdata));
/* The outer increment for the reduce double loop */
if (++NBF_REDUCE_POS(bufferdata) < NBF_REDUCE_OUTERSIZE(bufferdata)) {
@@ -3171,7 +3177,7 @@ npyiter_prepare_one_operand(PyArrayObject **op,
Py_DECREF(*op_dtype);
*op_dtype = nbo_dtype;
- NPY_IT_DBG_PRINTF("Iterator: Setting NPY_OP_ITFLAG_CAST "
+ NPY_IT_DBG_PRINT("Iterator: Setting NPY_OP_ITFLAG_CAST "
"because of NPY_ITER_NBO\n");
/* Indicate that byte order or alignment needs fixing */
*op_itflags |= NPY_OP_ITFLAG_CAST;
@@ -3181,7 +3187,7 @@ npyiter_prepare_one_operand(PyArrayObject **op,
if (op_flags&NPY_ITER_ALIGNED) {
/* Check alignment */
if (!PyArray_ISALIGNED(*op)) {
- NPY_IT_DBG_PRINTF("Iterator: Setting NPY_OP_ITFLAG_CAST "
+ NPY_IT_DBG_PRINT("Iterator: Setting NPY_OP_ITFLAG_CAST "
"because of NPY_ITER_ALIGNED\n");
*op_itflags |= NPY_OP_ITFLAG_CAST;
}
@@ -3299,7 +3305,7 @@ npyiter_check_casting(int niter, PyArrayObject **op,
int iiter;
for(iiter = 0; iiter < niter; ++iiter) {
- NPY_IT_DBG_PRINTF("Iterator: Checking casting for operand %d\n",
+ NPY_IT_DBG_PRINT1("Iterator: Checking casting for operand %d\n",
(int)iiter);
#if NPY_IT_DBG_TRACING
printf("op: ");
@@ -3341,7 +3347,7 @@ npyiter_check_casting(int niter, PyArrayObject **op,
return 0;
}
- NPY_IT_DBG_PRINTF("Iterator: Setting NPY_OP_ITFLAG_CAST "
+ NPY_IT_DBG_PRINT("Iterator: Setting NPY_OP_ITFLAG_CAST "
"because the types aren't equivalent\n");
/* Indicate that this operand needs casting */
op_itflags[iiter] |= NPY_OP_ITFLAG_CAST;
@@ -4421,7 +4427,7 @@ npyiter_new_temp_array(NpyIter *iter, PyTypeObject *subtype,
}
if (i >= 0) {
- NPY_IT_DBG_PRINTF("Iterator: Setting allocated stride %d "
+ NPY_IT_DBG_PRINT3("Iterator: Setting allocated stride %d "
"for iterator dimension %d to %d\n", (int)i,
(int)idim, (int)stride);
strides[i] = stride;
@@ -4466,7 +4472,7 @@ npyiter_new_temp_array(NpyIter *iter, PyTypeObject *subtype,
return NULL;
}
- NPY_IT_DBG_PRINTF("Iterator: Indicating that a reduction "
+ NPY_IT_DBG_PRINT("Iterator: Indicating that a reduction "
"is occurring\n");
/* Indicate that a reduction is occurring */
NIT_ITFLAGS(iter) |= NPY_ITFLAG_REDUCE;
@@ -4490,7 +4496,7 @@ npyiter_new_temp_array(NpyIter *iter, PyTypeObject *subtype,
}
if (i >= 0) {
- NPY_IT_DBG_PRINTF("Iterator: Setting allocated stride %d "
+ NPY_IT_DBG_PRINT3("Iterator: Setting allocated stride %d "
"for iterator dimension %d to %d\n", (int)i,
(int)idim, (int)stride);
strides[i] = stride;
@@ -4802,7 +4808,7 @@ npyiter_allocate_arrays(NpyIter *iter,
npy_intp stride = NAD_STRIDES(axisdata)[iiter];
if (stride != op_dtype[iiter]->elsize) {
- NPY_IT_DBG_PRINTF("Iterator: Setting NPY_OP_ITFLAG_CAST "
+ NPY_IT_DBG_PRINT("Iterator: Setting NPY_OP_ITFLAG_CAST "
"because of NPY_ITER_CONTIG\n");
op_itflags[iiter] |= NPY_OP_ITFLAG_CAST;
if (!(itflags&NPY_ITFLAG_BUFFER)) {
@@ -4916,7 +4922,7 @@ npyiter_get_common_dtype(int niter, PyArrayObject **op,
PyArray_Descr *dtypes[NPY_MAXARGS];
PyArray_Descr *ret;
- NPY_IT_DBG_PRINTF("Iterator: Getting a common data type from operands\n");
+ NPY_IT_DBG_PRINT("Iterator: Getting a common data type from operands\n");
for (iiter = 0; iiter < niter; ++iiter) {
if (op_dtype[iiter] != NULL &&
@@ -5266,7 +5272,7 @@ npyiter_copy_from_buffers(NpyIter *iter)
return;
}
- NPY_IT_DBG_PRINTF("Iterator: Copying buffers to outputs\n");
+ NPY_IT_DBG_PRINT("Iterator: Copying buffers to outputs\n");
if (itflags&NPY_ITFLAG_REDUCE) {
reduce_outerdim = NBF_REDUCE_OUTERDIM(bufferdata);
@@ -5293,7 +5299,7 @@ npyiter_copy_from_buffers(NpyIter *iter)
npy_intp src_stride, *dst_strides, *dst_coords, *dst_shape;
int ndim_transfer;
- NPY_IT_DBG_PRINTF("Iterator: Operand %d was buffered\n",
+ NPY_IT_DBG_PRINT1("Iterator: Operand %d was buffered\n",
(int)iiter);
/*
@@ -5350,7 +5356,7 @@ npyiter_copy_from_buffers(NpyIter *iter)
ndim_transfer = ndim;
}
- NPY_IT_DBG_PRINTF("Iterator: Copying buffer to "
+ NPY_IT_DBG_PRINT2("Iterator: Copying buffer to "
"operand %d (%d items)\n",
(int)iiter, (int)op_transfersize);
@@ -5372,7 +5378,7 @@ npyiter_copy_from_buffers(NpyIter *iter)
/* Decrement refs only if the pointer was pointing to the buffer */
npy_intp delta = (ptrs[iiter] - buffer);
if (0 <= delta && delta <= transfersize*dtypes[iiter]->elsize) {
- NPY_IT_DBG_PRINTF("Iterator: Freeing refs and zeroing buffer "
+ NPY_IT_DBG_PRINT1("Iterator: Freeing refs and zeroing buffer "
"of operand %d\n", (int)iiter);
/* Decrement refs */
stransfer(NULL, 0, buffer, dtypes[iiter]->elsize,
@@ -5389,7 +5395,7 @@ npyiter_copy_from_buffers(NpyIter *iter)
}
}
- NPY_IT_DBG_PRINTF("Iterator: Finished copying buffers to outputs\n");
+ NPY_IT_DBG_PRINT("Iterator: Finished copying buffers to outputs\n");
}
/*
@@ -5436,7 +5442,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
npy_intp axisdata_incr = NIT_AXISDATA_SIZEOF(itflags, ndim, niter) /
NPY_SIZEOF_INTP;
- NPY_IT_DBG_PRINTF("Iterator: Copying inputs to buffers\n");
+ NPY_IT_DBG_PRINT("Iterator: Copying inputs to buffers\n");
/* Calculate the size if using any buffers */
iterindex = NIT_ITERINDEX(iter);
@@ -5457,7 +5463,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
transfersize = NBF_REDUCE_OUTERSIZE(bufferdata)*reduce_innersize;
NBF_BUFITEREND(bufferdata) = iterindex + reduce_innersize;
- NPY_IT_DBG_PRINTF("Reused reduce transfersize: %d innersize: %d "
+ NPY_IT_DBG_PRINT3("Reused reduce transfersize: %d innersize: %d "
"itersize: %d\n",
(int)transfersize,
(int)reduce_innersize,
@@ -5470,11 +5476,11 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
* to combine values itself.
*/
else if (itflags&NPY_ITFLAG_REDUCE) {
- NPY_IT_DBG_PRINTF("Iterator: Calculating reduce loops\n");
+ NPY_IT_DBG_PRINT("Iterator: Calculating reduce loops\n");
transfersize = npyiter_checkreducesize(iter, transfersize,
&reduce_innersize,
&reduce_outerdim);
- NPY_IT_DBG_PRINTF("Reduce transfersize: %d innersize: %d "
+ NPY_IT_DBG_PRINT3("Reduce transfersize: %d innersize: %d "
"itersize: %d\n",
(int)transfersize,
(int)reduce_innersize,
@@ -5590,7 +5596,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
strides[iiter] = 0;
/* It's all in one stride in the inner loop dimension */
if (is_onestride) {
- NPY_IT_DBG_PRINTF("reduce op %d all one stride\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("reduce op %d all one stride\n", (int)iiter);
ptrs[iiter] = ad_ptrs[iiter];
reduce_outerstrides[iiter] = 0;
stransfer = NULL;
@@ -5600,7 +5606,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
(transfersize/reduce_innersize <=
NAD_SHAPE(reduce_outeraxisdata) -
NAD_COORD(reduce_outeraxisdata))) {
- NPY_IT_DBG_PRINTF("reduce op %d all one outer stride\n",
+ NPY_IT_DBG_PRINT1("reduce op %d all one outer stride\n",
(int)iiter);
ptrs[iiter] = ad_ptrs[iiter];
/* Outer reduce loop advances by one item */
@@ -5610,7 +5616,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
}
/* In this case, the buffer is being used */
else {
- NPY_IT_DBG_PRINTF("reduce op %d must buffer\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("reduce op %d must buffer\n", (int)iiter);
ptrs[iiter] = buffers[iiter];
/* Both outer and inner reduce loops have stride 0 */
if (NAD_STRIDES(reduce_outeraxisdata)[iiter] == 0) {
@@ -5624,7 +5630,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
}
else if (is_onestride) {
- NPY_IT_DBG_PRINTF("reduce op %d all one stride in dim 0\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("reduce op %d all one stride in dim 0\n", (int)iiter);
ptrs[iiter] = ad_ptrs[iiter];
strides[iiter] = ad_strides[iiter];
reduce_outerstrides[iiter] = 0;
@@ -5676,30 +5682,30 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
else {
ptrs[iiter] = buffers[iiter];
if (ad_strides[iiter] == 0) {
- NPY_IT_DBG_PRINTF("cast op %d has innermost stride 0\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("cast op %d has innermost stride 0\n", (int)iiter);
strides[iiter] = 0;
/* Both outer and inner reduce loops have stride 0 */
if (NAD_STRIDES(reduce_outeraxisdata)[iiter] == 0) {
- NPY_IT_DBG_PRINTF("cast op %d has outermost stride 0\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("cast op %d has outermost stride 0\n", (int)iiter);
reduce_outerstrides[iiter] = 0;
}
/* Outer reduce loop advances by one item */
else {
- NPY_IT_DBG_PRINTF("cast op %d has outermost stride !=0\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("cast op %d has outermost stride !=0\n", (int)iiter);
reduce_outerstrides[iiter] = dtypes[iiter]->elsize;
}
}
else {
- NPY_IT_DBG_PRINTF("cast op %d has innermost stride !=0\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("cast op %d has innermost stride !=0\n", (int)iiter);
strides[iiter] = dtypes[iiter]->elsize;
if (NAD_STRIDES(reduce_outeraxisdata)[iiter] == 0) {
- NPY_IT_DBG_PRINTF("cast op %d has outermost stride 0\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("cast op %d has outermost stride 0\n", (int)iiter);
/* Reduction in outer reduce loop */
reduce_outerstrides[iiter] = 0;
}
else {
- NPY_IT_DBG_PRINTF("cast op %d has outermost stride !=0\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("cast op %d has outermost stride !=0\n", (int)iiter);
/* Advance to next items in outer reduce loop */
reduce_outerstrides[iiter] = reduce_innersize *
dtypes[iiter]->elsize;
@@ -5746,7 +5752,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
*/
if (prev_dataptrs &&
prev_dataptrs[iiter] == ad_ptrs[iiter]) {
- NPY_IT_DBG_PRINTF("Iterator: skipping operand %d"
+ NPY_IT_DBG_PRINT1("Iterator: skipping operand %d"
" copy because it's a 1-element reduce\n",
(int)iiter);
@@ -5796,7 +5802,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
* we don't have to copy the data again.
*/
if (reuse_reduce_loops && prev_dataptrs[iiter] == ad_ptrs[iiter]) {
- NPY_IT_DBG_PRINTF("Iterator: skipping operands %d "
+ NPY_IT_DBG_PRINT2("Iterator: skipping operands %d "
"copy (%d items) because loops are reused and the data "
"pointer didn't change\n",
(int)iiter, (int)op_transfersize);
@@ -5805,7 +5811,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
/* If the data type requires zero-inititialization */
if (PyDataType_FLAGCHK(dtypes[iiter], NPY_NEEDS_INIT)) {
- NPY_IT_DBG_PRINTF("Iterator: Buffer requires init, "
+ NPY_IT_DBG_PRINT("Iterator: Buffer requires init, "
"memsetting to 0\n");
memset(ptrs[iiter], 0, dtypes[iiter]->elsize*op_transfersize);
/* Can't skip the transfer in this case */
@@ -5813,7 +5819,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
}
if (!skip_transfer) {
- NPY_IT_DBG_PRINTF("Iterator: Copying operand %d to "
+ NPY_IT_DBG_PRINT2("Iterator: Copying operand %d to "
"buffer (%d items)\n",
(int)iiter, (int)op_transfersize);
@@ -5830,7 +5836,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
else if (ptrs[iiter] == buffers[iiter]) {
/* If the data type requires zero-inititialization */
if (PyDataType_FLAGCHK(dtypes[iiter], NPY_NEEDS_INIT)) {
- NPY_IT_DBG_PRINTF("Iterator: Write-only buffer for "
+ NPY_IT_DBG_PRINT1("Iterator: Write-only buffer for "
"operand %d requires init, "
"memsetting to 0\n", (int)iiter);
memset(ptrs[iiter], 0, dtypes[iiter]->elsize*transfersize);
@@ -5848,7 +5854,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
if (!any_buffered && (itflags&NPY_ITFLAG_GROWINNER) &&
!(itflags&NPY_ITFLAG_REDUCE)) {
if (singlestridesize > transfersize) {
- NPY_IT_DBG_PRINTF("Iterator: Expanding inner loop size "
+ NPY_IT_DBG_PRINT2("Iterator: Expanding inner loop size "
"from %d to %d since buffering wasn't needed\n",
(int)NBF_SIZE(bufferdata), (int)singlestridesize);
NBF_SIZE(bufferdata) = singlestridesize;
@@ -5856,9 +5862,9 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
}
}
- NPY_IT_DBG_PRINTF("Any buffering needed: %d\n", any_buffered);
+ NPY_IT_DBG_PRINT1("Any buffering needed: %d\n", any_buffered);
- NPY_IT_DBG_PRINTF("Iterator: Finished copying inputs to buffers "
+ NPY_IT_DBG_PRINT1("Iterator: Finished copying inputs to buffers "
"(buffered size is %d)\n", (int)NBF_SIZE(bufferdata));
}
@@ -5937,7 +5943,7 @@ npyiter_checkreducesize(NpyIter *iter, npy_intp count,
(!stride0op[iiter] &&
(strides[iiter] == 0) &&
(op_itflags[iiter]&NPY_OP_ITFLAG_REDUCE))) {
- NPY_IT_DBG_PRINTF("Iterator: Reduce operation limits "
+ NPY_IT_DBG_PRINT1("Iterator: Reduce operation limits "
"buffer to %d\n", (int)reducespace);
/*
* If we already found more elements than count, or
@@ -6028,7 +6034,7 @@ npyiter_checkreducesize(NpyIter *iter, npy_intp count,
(!stride0op[iiter] &&
(strides[iiter] == 0) &&
(op_itflags[iiter]&NPY_OP_ITFLAG_REDUCE))) {
- NPY_IT_DBG_PRINTF("Iterator: Reduce operation limits "
+ NPY_IT_DBG_PRINT1("Iterator: Reduce operation limits "
"buffer to %d\n", (int)reducespace);
/*
* This terminates the outer level of our double loop.
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index 59787185a..12c45b2e4 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -45,9 +45,15 @@
#define NPY_UF_DBG_TRACING 0
#if NPY_UF_DBG_TRACING
-#define NPY_UF_DBG_PRINTF(...) printf(__VA_ARGS__)
+#define NPY_UF_DBG_PRINT(s) printf("%s", s)
+#define NPY_UF_DBG_PRINT1(s, p1) printf(s, p1)
+#define NPY_UF_DBG_PRINT2(s, p1, p2) printf(s, p1, p2)
+#define NPY_UF_DBG_PRINT3(s, p1, p2, p3) printf(s, p1, p2, p3)
#else
-#define NPY_UF_DBG_PRINTF
+#define NPY_UF_DBG_PRINT(s)
+#define NPY_UF_DBG_PRINT1(s, p1)
+#define NPY_UF_DBG_PRINT2(s, p1, p2)
+#define NPY_UF_DBG_PRINT3(s, p1, p2, p3)
#endif
/**********************************************/
@@ -1003,7 +1009,7 @@ ufunc_loop_matches(PyUFuncObject *self,
}
Py_DECREF(tmp);
}
- NPY_UF_DBG_PRINTF("The inputs all worked\n");
+ NPY_UF_DBG_PRINT("The inputs all worked\n");
/*
* If all the inputs were ok, then check casting back to the
@@ -1028,7 +1034,7 @@ ufunc_loop_matches(PyUFuncObject *self,
Py_DECREF(tmp);
}
}
- NPY_UF_DBG_PRINTF("The outputs all worked\n");
+ NPY_UF_DBG_PRINT("The outputs all worked\n");
return 1;
}
@@ -1145,7 +1151,7 @@ find_ufunc_matching_userloop(PyUFuncObject *self,
*out_innerloop = funcdata->func;
*out_innerloopdata = funcdata->data;
- NPY_UF_DBG_PRINTF("Returning userdef inner "
+ NPY_UF_DBG_PRINT("Returning userdef inner "
"loop successfully\n");
return 0;
@@ -1238,7 +1244,7 @@ find_ufunc_specified_userloop(PyUFuncObject *self,
*out_innerloop = funcdata->func;
*out_innerloopdata = funcdata->data;
- NPY_UF_DBG_PRINTF("Returning userdef inner "
+ NPY_UF_DBG_PRINT("Returning userdef inner "
"loop successfully\n");
return 0;
@@ -1348,7 +1354,7 @@ find_best_ufunc_inner_loop(PyUFuncObject *self,
types[j] = orig_types[j];
}
- NPY_UF_DBG_PRINTF("Trying function loop %d\n", (int)i);
+ NPY_UF_DBG_PRINT1("Trying function loop %d\n", (int)i);
switch (ufunc_loop_matches(self, op,
input_casting, output_casting,
any_object, all_inputs_scalar,
@@ -1367,7 +1373,7 @@ find_best_ufunc_inner_loop(PyUFuncObject *self,
*out_innerloop = self->functions[i];
*out_innerloopdata = self->data[i];
- NPY_UF_DBG_PRINTF("Returning inner loop successfully\n");
+ NPY_UF_DBG_PRINT("Returning inner loop successfully\n");
return 0;
}
@@ -1375,7 +1381,7 @@ find_best_ufunc_inner_loop(PyUFuncObject *self,
}
/* If no function was found, throw an error */
- NPY_UF_DBG_PRINTF("No loop was found\n");
+ NPY_UF_DBG_PRINT("No loop was found\n");
if (no_castable_output) {
PyErr_Format(PyExc_TypeError,
"ufunc '%s' output (typecode '%c') could not be coerced to "
@@ -1501,7 +1507,7 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
Py_XDECREF(str_obj);
return -1;
}
- NPY_UF_DBG_PRINTF("signature character '%c', type num %d\n",
+ NPY_UF_DBG_PRINT2("signature character '%c', type num %d\n",
str[0], dtype->type_num);
specified_types[0] = dtype->type_num;
Py_DECREF(dtype);
@@ -1518,7 +1524,7 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
Py_XDECREF(str_obj);
return -1;
}
- NPY_UF_DBG_PRINTF("signature character '%c', type num %d\n",
+ NPY_UF_DBG_PRINT2("signature character '%c', type num %d\n",
str[istr], dtype->type_num);
specified_types[i] = dtype->type_num;
Py_DECREF(dtype);
@@ -1529,7 +1535,7 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
/* If the ufunc has userloops, search for them. */
if (self->userloops) {
- NPY_UF_DBG_PRINTF("Searching user loops for specified sig\n");
+ NPY_UF_DBG_PRINT("Searching user loops for specified sig\n");
switch (find_ufunc_specified_userloop(self,
n_specified, specified_types,
op, casting,
@@ -1545,12 +1551,12 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
}
}
- NPY_UF_DBG_PRINTF("Searching loops for specified sig\n");
+ NPY_UF_DBG_PRINT("Searching loops for specified sig\n");
for (i = 0; i < self->ntypes; ++i) {
char *orig_types = self->types + i*self->nargs;
int matched = 1;
- NPY_UF_DBG_PRINTF("Trying function loop %d\n", (int)i);
+ NPY_UF_DBG_PRINT1("Trying function loop %d\n", (int)i);
/* Copy the types into an int array for matching */
for (j = 0; j < niter; ++j) {
@@ -1565,7 +1571,7 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
}
}
} else {
- NPY_UF_DBG_PRINTF("Specified type: %d, first output type: %d\n",
+ NPY_UF_DBG_PRINT2("Specified type: %d, first output type: %d\n",
specified_types[0], types[nin]);
if (types[nin] != specified_types[0]) {
matched = 0;
@@ -1575,7 +1581,7 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
continue;
}
- NPY_UF_DBG_PRINTF("It matches, confirming type casting\n");
+ NPY_UF_DBG_PRINT("It matches, confirming type casting\n");
switch (ufunc_loop_matches(self, op,
casting, casting,
any_object, all_inputs_scalar,
@@ -1594,7 +1600,7 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
*out_innerloop = self->functions[i];
*out_innerloopdata = self->data[i];
- NPY_UF_DBG_PRINTF("Returning specified inner loop successfully\n");
+ NPY_UF_DBG_PRINT("Returning specified inner loop successfully\n");
return 0;
/* Didn't work */
@@ -1611,7 +1617,7 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
}
/* If no function was found, throw an error */
- NPY_UF_DBG_PRINTF("No specified loop was found\n");
+ NPY_UF_DBG_PRINT("No specified loop was found\n");
PyErr_Format(PyExc_TypeError,
"No loop matching the specified signature was found "
@@ -1638,7 +1644,7 @@ trivial_two_operand_loop(PyArrayObject **op,
data[0], data[1],
stride[0], stride[1]);
count[1] = count[0];
- NPY_UF_DBG_PRINTF("two operand loop count %d\n", (int)count[0]);
+ NPY_UF_DBG_PRINT1("two operand loop count %d\n", (int)count[0]);
if (!needs_api) {
NPY_BEGIN_THREADS;
@@ -1671,7 +1677,7 @@ trivial_three_operand_loop(PyArrayObject **op,
stride[0], stride[1], stride[2]);
count[1] = count[0];
count[2] = count[0];
- NPY_UF_DBG_PRINTF("three operand loop count %d\n", (int)count[0]);
+ NPY_UF_DBG_PRINT1("three operand loop count %d\n", (int)count[0]);
if (!needs_api) {
NPY_BEGIN_THREADS;
@@ -1855,7 +1861,7 @@ iterator_loop(PyUFuncObject *self,
/* Execute the loop */
do {
- NPY_UF_DBG_PRINTF("iterator loop count %d\n", (int)*count_ptr);
+ NPY_UF_DBG_PRINT1("iterator loop count %d\n", (int)*count_ptr);
innerloop(dataptr, count_ptr, stride, innerloopdata);
} while (iternext(iter));
@@ -1914,7 +1920,7 @@ execute_ufunc_loop(PyUFuncObject *self,
return -1;
}
- NPY_UF_DBG_PRINTF("trivial 1 input with allocated output\n");
+ NPY_UF_DBG_PRINT("trivial 1 input with allocated output\n");
trivial_two_operand_loop(op, innerloop, innerloopdata);
return 0;
@@ -1929,7 +1935,7 @@ execute_ufunc_loop(PyUFuncObject *self,
return -1;
}
- NPY_UF_DBG_PRINTF("trivial 1 input\n");
+ NPY_UF_DBG_PRINT("trivial 1 input\n");
trivial_two_operand_loop(op, innerloop, innerloopdata);
return 0;
@@ -1965,7 +1971,7 @@ execute_ufunc_loop(PyUFuncObject *self,
return -1;
}
- NPY_UF_DBG_PRINTF("trivial 2 input with allocated output\n");
+ NPY_UF_DBG_PRINT("trivial 2 input with allocated output\n");
trivial_three_operand_loop(op, innerloop, innerloopdata);
return 0;
@@ -1981,7 +1987,7 @@ execute_ufunc_loop(PyUFuncObject *self,
return -1;
}
- NPY_UF_DBG_PRINTF("trivial 2 input\n");
+ NPY_UF_DBG_PRINT("trivial 2 input\n");
trivial_three_operand_loop(op, innerloop, innerloopdata);
return 0;
@@ -1994,7 +2000,7 @@ execute_ufunc_loop(PyUFuncObject *self,
* resolve broadcasting, etc
*/
- NPY_UF_DBG_PRINTF("iterator loop\n");
+ NPY_UF_DBG_PRINT("iterator loop\n");
if (iterator_loop(self, op, dtype, order,
buffersize, arr_prep, arr_prep_args,
innerloop, innerloopdata) < 0) {
@@ -2112,7 +2118,7 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
ufunc_name = self->name ? self->name : "<unnamed ufunc>";
- NPY_UF_DBG_PRINTF("\nEvaluating ufunc %s\n", ufunc_name);
+ NPY_UF_DBG_PRINT1("\nEvaluating ufunc %s\n", ufunc_name);
/* Initialize all the operands and dtypes to NULL */
for (i = 0; i < niter; ++i) {
@@ -2121,7 +2127,7 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
arr_prep[i] = NULL;
}
- NPY_UF_DBG_PRINTF("Getting arguments\n");
+ NPY_UF_DBG_PRINT("Getting arguments\n");
/* Get all the arguments */
retval = get_ufunc_arguments(self, args, kwds,
@@ -2205,7 +2211,7 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
}
}
- NPY_UF_DBG_PRINTF("Finding inner loop\n");
+ NPY_UF_DBG_PRINT("Finding inner loop\n");
/*
* Decide the casting rules for inputs and outputs. We want
@@ -2386,7 +2392,7 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
/* Start with the floating-point exception flags cleared */
PyUFunc_clearfperr();
- NPY_UF_DBG_PRINTF("Executing inner loop\n");
+ NPY_UF_DBG_PRINT("Executing inner loop\n");
/* Do the ufunc loop */
if (NpyIter_GetIterSize(iter) != 0) {
@@ -2428,12 +2434,12 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
Py_XDECREF(type_tup);
Py_XDECREF(arr_prep_args);
- NPY_UF_DBG_PRINTF("Returning Success\n");
+ NPY_UF_DBG_PRINT("Returning Success\n");
return 0;
fail:
- NPY_UF_DBG_PRINTF("Returning failure code %d\n", retval);
+ NPY_UF_DBG_PRINT1("Returning failure code %d\n", retval);
if (inner_strides) {
_pya_free(inner_strides);
}
@@ -2517,7 +2523,7 @@ PyUFunc_GenericFunction(PyUFuncObject *self,
ufunc_name = self->name ? self->name : "<unnamed ufunc>";
- NPY_UF_DBG_PRINTF("\nEvaluating ufunc %s\n", ufunc_name);
+ NPY_UF_DBG_PRINT1("\nEvaluating ufunc %s\n", ufunc_name);
/* Initialize all the operands and dtypes to NULL */
for (i = 0; i < niter; ++i) {
@@ -2526,7 +2532,7 @@ PyUFunc_GenericFunction(PyUFuncObject *self,
arr_prep[i] = NULL;
}
- NPY_UF_DBG_PRINTF("Getting arguments\n");
+ NPY_UF_DBG_PRINT("Getting arguments\n");
/* Get all the arguments */
retval = get_ufunc_arguments(self, args, kwds,
@@ -2551,7 +2557,7 @@ PyUFunc_GenericFunction(PyUFuncObject *self,
}
}
- NPY_UF_DBG_PRINTF("Finding inner loop\n");
+ NPY_UF_DBG_PRINT("Finding inner loop\n");
/*
* Decide the casting rules for inputs and outputs. We want
@@ -2630,7 +2636,7 @@ PyUFunc_GenericFunction(PyUFuncObject *self,
/* Start with the floating-point exception flags cleared */
PyUFunc_clearfperr();
- NPY_UF_DBG_PRINTF("Executing inner loop\n");
+ NPY_UF_DBG_PRINT("Executing inner loop\n");
/* Do the ufunc loop */
retval = execute_ufunc_loop(self, trivial_loop_ok, op, dtype, order,
@@ -2656,12 +2662,12 @@ PyUFunc_GenericFunction(PyUFuncObject *self,
Py_XDECREF(type_tup);
Py_XDECREF(arr_prep_args);
- NPY_UF_DBG_PRINTF("Returning Success\n");
+ NPY_UF_DBG_PRINT("Returning Success\n");
return 0;
fail:
- NPY_UF_DBG_PRINTF("Returning failure code %d\n", retval);
+ NPY_UF_DBG_PRINT1("Returning failure code %d\n", retval);
for (i = 0; i < niter; ++i) {
Py_XDECREF(op[i]);
op[i] = NULL;
@@ -2690,7 +2696,7 @@ get_binary_op_function(PyUFuncObject *self, int *otype,
int i;
PyUFunc_Loop1d *funcdata;
- NPY_UF_DBG_PRINTF("Getting binary op function for type number %d\n",
+ NPY_UF_DBG_PRINT1("Getting binary op function for type number %d\n",
*otype);
/* If the type is custom and there are userloops, search for it here */
@@ -2723,7 +2729,7 @@ get_binary_op_function(PyUFuncObject *self, int *otype,
for (i = 0; i < self->ntypes; ++i) {
char *types = self->types + i*self->nargs;
- NPY_UF_DBG_PRINTF("Trying loop with signature %d %d -> %d\n",
+ NPY_UF_DBG_PRINT3("Trying loop with signature %d %d -> %d\n",
types[0], types[1], types[2]);
if (PyArray_CanCastSafely(*otype, types[0]) &&
@@ -2808,7 +2814,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
NPY_BEGIN_THREADS_DEF;
- NPY_UF_DBG_PRINTF("\nEvaluating ufunc %s.%s\n", ufunc_name, opname);
+ NPY_UF_DBG_PRINT2("\nEvaluating ufunc %s.%s\n", ufunc_name, opname);
#if 0
printf("Doing %s.%s on array with dtype : ", ufunc_name, opname);
@@ -2917,7 +2923,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
op_dtypes_param = op_dtypes;
op_dtypes[1] = op_dtypes[0];
}
- NPY_UF_DBG_PRINTF("Allocating outer iterator\n");
+ NPY_UF_DBG_PRINT("Allocating outer iterator\n");
iter = NpyIter_MultiNew(2, op, flags,
NPY_KEEPORDER, NPY_UNSAFE_CASTING,
op_flags,
@@ -3019,7 +3025,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
/* Also set the dtype for buffering arr */
op_dtypes[1] = op_dtypes[0];
- NPY_UF_DBG_PRINTF("Allocating inner iterator\n");
+ NPY_UF_DBG_PRINT("Allocating inner iterator\n");
if (operation == UFUNC_REDUCE) {
/* The per-operand flags for the inner loop */
op_flags[0] = NPY_ITER_READWRITE|
@@ -3080,7 +3086,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
npy_intp *stride_inner;
npy_intp count, *count_ptr_inner;
- NPY_UF_DBG_PRINTF("UFunc: Reduce loop with two nested iterators\n");
+ NPY_UF_DBG_PRINT("UFunc: Reduce loop with two nested iterators\n");
iternext_inner = NpyIter_GetIterNext(iter_inner, NULL);
if (iternext_inner == NULL) {
goto fail;
@@ -3130,7 +3136,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
first = 0;
}
stride_copy[1] = stride_inner[1];
- NPY_UF_DBG_PRINTF("iterator loop count %d\n", (int)count);
+ NPY_UF_DBG_PRINT1("iterator loop count %d\n", (int)count);
innerloop(dataptr_copy, &count,
stride_copy, innerloopdata);
} while(iternext_inner(iter_inner));
@@ -3145,7 +3151,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
npy_intp count_m1 = PyArray_DIM(op[1], axis)-1;
npy_intp stride0 = 0, stride1 = PyArray_STRIDE(op[1], axis);
- NPY_UF_DBG_PRINTF("UFunc: Reduce loop with just outer iterator\n");
+ NPY_UF_DBG_PRINT("UFunc: Reduce loop with just outer iterator\n");
if (operation == UFUNC_ACCUMULATE) {
stride0 = PyArray_STRIDE(op[0], axis);
@@ -3187,7 +3193,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
dataptr_copy[1] += stride1;
dataptr_copy[2] += stride0;
}
- NPY_UF_DBG_PRINTF("iterator loop count %d\n",
+ NPY_UF_DBG_PRINT1("iterator loop count %d\n",
(int)count_m1);
innerloop(dataptr_copy, &count_m1,
stride_copy, innerloopdata);
@@ -3214,7 +3220,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
npy_intp count, *count_ptr_inner;
int first = 1;
- NPY_UF_DBG_PRINTF("UFunc: Reduce loop with just inner iterator\n");
+ NPY_UF_DBG_PRINT("UFunc: Reduce loop with just inner iterator\n");
iternext_inner = NpyIter_GetIterNext(iter_inner, NULL);
if (iternext_inner == NULL) {
@@ -3260,7 +3266,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
first = 0;
}
stride_copy[1] = stride_inner[1];
- NPY_UF_DBG_PRINTF("iterator loop count %d\n", (int)count);
+ NPY_UF_DBG_PRINT1("iterator loop count %d\n", (int)count);
innerloop(dataptr_copy, &count,
stride_copy, innerloopdata);
} while(iternext_inner(iter_inner));
@@ -3274,7 +3280,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
npy_intp count = PyArray_DIM(op[1], axis);
npy_intp stride0 = 0, stride1 = PyArray_STRIDE(op[1], axis);
- NPY_UF_DBG_PRINTF("UFunc: Reduce loop with no iterators\n");
+ NPY_UF_DBG_PRINT("UFunc: Reduce loop with no iterators\n");
if (operation == UFUNC_REDUCE) {
if (PyArray_NDIM(op[0]) != 0) {
@@ -3327,7 +3333,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
dataptr_copy[2] += stride0;
}
- NPY_UF_DBG_PRINTF("iterator loop count %d\n", (int)count);
+ NPY_UF_DBG_PRINT1("iterator loop count %d\n", (int)count);
needs_api = PyDataType_REFCHK(op_dtypes[0]);
@@ -3459,7 +3465,7 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
}
}
- NPY_UF_DBG_PRINTF("\nEvaluating ufunc %s.%s\n", ufunc_name, opname);
+ NPY_UF_DBG_PRINT2("\nEvaluating ufunc %s.%s\n", ufunc_name, opname);
#if 0
printf("Doing %s.%s on array with dtype : ", ufunc_name, opname);
@@ -3550,7 +3556,7 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
op_dtypes[1] = op_dtypes[0];
- NPY_UF_DBG_PRINTF("Allocating outer iterator\n");
+ NPY_UF_DBG_PRINT("Allocating outer iterator\n");
iter = NpyIter_MultiNew(3, op, flags,
NPY_KEEPORDER, NPY_UNSAFE_CASTING,
op_flags,
@@ -3625,7 +3631,7 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
stride0 = 0;
stride1 = PyArray_STRIDE(op[1], axis);
- NPY_UF_DBG_PRINTF("UFunc: Reduce loop with just outer iterator\n");
+ NPY_UF_DBG_PRINT("UFunc: Reduce loop with just outer iterator\n");
stride_copy[0] = stride0;
stride_copy[1] = stride1;
@@ -3664,7 +3670,7 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
/* Inner loop like REDUCE */
--count;
dataptr_copy[1] += stride1;
- NPY_UF_DBG_PRINTF("iterator loop count %d\n",
+ NPY_UF_DBG_PRINT1("iterator loop count %d\n",
(int)count);
innerloop(dataptr_copy, &count,
stride_copy, innerloopdata);
@@ -3689,7 +3695,7 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
needs_api = PyDataType_REFCHK(op_dtypes[0]);
- NPY_UF_DBG_PRINTF("UFunc: Reduce loop with no iterators\n");
+ NPY_UF_DBG_PRINT("UFunc: Reduce loop with no iterators\n");
stride_copy[0] = stride0;
stride_copy[1] = stride1;
@@ -3724,7 +3730,7 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
/* Inner loop like REDUCE */
--count;
dataptr_copy[1] += stride1;
- NPY_UF_DBG_PRINTF("iterator loop count %d\n",
+ NPY_UF_DBG_PRINT1("iterator loop count %d\n",
(int)count);
innerloop(dataptr_copy, &count,
stride_copy, innerloopdata);