| 393 | } |
| 394 | |
| 395 | static int |
| 396 | run_interpreter(NumExprObject *self, NpyIter *iter, NpyIter *reduce_iter, |
| 397 | bool reduction_outer_loop, bool need_output_buffering, |
| 398 | int *pc_error) |
| 399 | { |
| 400 | |
| 401 | int returnValue; |
| 402 | |
| 403 | char *errorMessage = NULL; |
| 404 | |
| 405 | |
| 406 | *pc_error = -1; |
| 407 | |
| 408 | // printf( "run_interpreter #1\n" ); |
| 409 | if ((gs.n_thread == 1) || gs.force_serial) { |
| 410 | // Can do it as one "task" |
| 411 | if (reduce_iter == NULL) { |
| 412 | // Reset the iterator to allocate its buffers |
| 413 | if(NpyIter_Reset(iter, NULL) != NPY_SUCCEED) return -1; |
| 414 | |
| 415 | // prepareSerial is a faster variant on prepareThreads. |
| 416 | BENCH_TIME(0); |
| 417 | returnValue = prepareSerial( self, iter, pc_error, &errorMessage ); |
| 418 | DIFF_TIME(0); |
| 419 | // BENCH_TIME(1); |
| 420 | if( returnValue != 0 ) return -1; |
| 421 | |
| 422 | // printf( "run_interpreter #3\n" ); |
| 423 | Py_BEGIN_ALLOW_THREADS |
| 424 | BENCH_TIME(200); |
| 425 | returnValue = vm_engine_iter_task(iter, self, 0, pc_error, &errorMessage); |
| 426 | DIFF_TIME(200); |
| 427 | Py_END_ALLOW_THREADS |
| 428 | // printf( "run_interpreter #5\n" ); |
| 429 | // finishThreads(iter); |
| 430 | } |
| 431 | else { // Reduction operation |
| 432 | if (reduction_outer_loop) { // Reduction on outer loop |
| 433 | char **dataPtr; |
| 434 | NpyIter_IterNextFunc *iterNext; |
| 435 | |
| 436 | dataPtr = NpyIter_GetDataPtrArray(reduce_iter); |
| 437 | iterNext = NpyIter_GetIterNext(reduce_iter, NULL); |
| 438 | if (iterNext == NULL) { |
| 439 | return -1; |
| 440 | } |
| 441 | |
| 442 | // get_temps_space( safeParams, BLOCK_SIZE1); |
| 443 | returnValue = prepareThreads( self, iter, pc_error, &errorMessage ); |
| 444 | if( returnValue != 0 ) return -1; |
| 445 | |
| 446 | Py_BEGIN_ALLOW_THREADS |
| 447 | do { |
| 448 | returnValue = NpyIter_ResetBasePointers(iter, dataPtr, &errorMessage); |
| 449 | if (returnValue >= 0) { |
| 450 | returnValue = vm_engine_iter_outer_reduce_task(iter, |
| 451 | self, |
| 452 | pc_error, &errorMessage); |
no test coverage detected
searching dependent graphs…