001:
+002: cimport cython
__pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
003:
004: from cython.parallel import parallel, prange
005: from libc.stdlib cimport abort, malloc, free
+006: import time, sys
__pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+007: import numpy as np
__pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
008: cimport numpy as np
009:
010:
011: cdef int loops
012:
+013: def timefunc(name):
/* Python wrapper */
static PyObject *__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_1timefunc(PyObject *__pyx_self, PyObject *__pyx_v_name); /*proto*/
static PyMethodDef __pyx_mdef_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_1timefunc = {"timefunc", (PyCFunction)__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_1timefunc, METH_O, 0};
static PyObject *__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_1timefunc(PyObject *__pyx_self, PyObject *__pyx_v_name) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("timefunc (wrapper)", 0);
__pyx_r = __pyx_pf_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_timefunc(__pyx_self, ((PyObject *)__pyx_v_name));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
static PyObject *__pyx_pf_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_timefunc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name) {
struct __pyx_obj_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45___pyx_scope_struct__timefunc *__pyx_cur_scope;
PyObject *__pyx_v_timedecorator = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("timefunc", 0);
__pyx_cur_scope = (struct __pyx_obj_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45___pyx_scope_struct__timefunc *)__pyx_tp_new_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45___pyx_scope_struct__timefunc(__pyx_ptype_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45___pyx_scope_struct__timefunc, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__pyx_cur_scope = ((struct __pyx_obj_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45___pyx_scope_struct__timefunc *)Py_None);
__Pyx_INCREF(Py_None);
__PYX_ERR(0, 13, __pyx_L1_error)
} else {
__Pyx_GOTREF(__pyx_cur_scope);
}
__pyx_cur_scope->__pyx_v_name = __pyx_v_name;
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_name);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_name);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("_cython_magic_3581c8be701b141ba2e4a4555cbc9e45.timefunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_timedecorator);
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__31 = PyTuple_Pack(3, __pyx_n_s_name, __pyx_n_s_timedecorator, __pyx_n_s_timedecorator); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 13, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__31);
__Pyx_GIVEREF(__pyx_tuple__31);
/* … */
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_1timefunc, NULL, __pyx_n_s_cython_magic_3581c8be701b141ba2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_timefunc, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_mendoza_ipython_cython__c, __pyx_n_s_timefunc, 13, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 13, __pyx_L1_error)
/* … */
struct __pyx_obj_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45___pyx_scope_struct__timefunc {
PyObject_HEAD
PyObject *__pyx_v_name;
};
+014: def timedecorator(f):
/* Python wrapper */
static PyObject *__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_8timefunc_1timedecorator(PyObject *__pyx_self, PyObject *__pyx_v_f); /*proto*/
static PyMethodDef __pyx_mdef_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_8timefunc_1timedecorator = {"timedecorator", (PyCFunction)__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_8timefunc_1timedecorator, METH_O, 0};
static PyObject *__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_8timefunc_1timedecorator(PyObject *__pyx_self, PyObject *__pyx_v_f) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("timedecorator (wrapper)", 0);
__pyx_r = __pyx_pf_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_8timefunc_timedecorator(__pyx_self, ((PyObject *)__pyx_v_f));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_8timefunc_timedecorator(PyObject *__pyx_self, PyObject *__pyx_v_f) {
struct __pyx_obj_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45___pyx_scope_struct__timefunc *__pyx_cur_scope;
struct __pyx_obj_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45___pyx_scope_struct__timefunc *__pyx_outer_scope;
int __pyx_v_L;
PyArrayObject *__pyx_v_np_array = 0;
PyArrayObject *__pyx_v_global_buf = 0;
PyObject *__pyx_v_start = NULL;
PyObject *__pyx_v_end = NULL;
__Pyx_LocalBuf_ND __pyx_pybuffernd_global_buf;
__Pyx_Buffer __pyx_pybuffer_global_buf;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("timedecorator", 0);
__pyx_outer_scope = (struct __pyx_obj_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45___pyx_scope_struct__timefunc *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
__pyx_pybuffer_global_buf.pybuffer.buf = NULL;
__pyx_pybuffer_global_buf.refcount = 0;
__pyx_pybuffernd_global_buf.data = NULL;
__pyx_pybuffernd_global_buf.rcbuffer = &__pyx_pybuffer_global_buf;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_XDECREF(__pyx_t_12);
{ PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
__Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_global_buf.rcbuffer->pybuffer);
__Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
__Pyx_AddTraceback("_cython_magic_3581c8be701b141ba2e4a4555cbc9e45.timefunc.timedecorator", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
goto __pyx_L2;
__pyx_L0:;
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_global_buf.rcbuffer->pybuffer);
__pyx_L2:;
__Pyx_XDECREF((PyObject *)__pyx_v_np_array);
__Pyx_XDECREF((PyObject *)__pyx_v_global_buf);
__Pyx_XDECREF(__pyx_v_start);
__Pyx_XDECREF(__pyx_v_end);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__4 = PyTuple_Pack(7, __pyx_n_s_f, __pyx_n_s_L, __pyx_n_s_i, __pyx_n_s_np_array, __pyx_n_s_global_buf, __pyx_n_s_start, __pyx_n_s_end); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 14, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__4);
__Pyx_GIVEREF(__pyx_tuple__4);
/* … */
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_8timefunc_1timedecorator, 0, __pyx_n_s_timefunc_locals_timedecorator, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cython_magic_3581c8be701b141ba2, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_timedecorator = __pyx_t_1;
__pyx_t_1 = 0;
__pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_mendoza_ipython_cython__c, __pyx_n_s_timedecorator, 14, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 14, __pyx_L1_error)
015: cdef int L, i
016: cdef np.ndarray np_array
017: cdef np.ndarray[double] global_buf
018:
+019: print("Running", name)
if (unlikely(!__pyx_cur_scope->__pyx_v_name)) { __Pyx_RaiseClosureNameError("name"); __PYX_ERR(0, 19, __pyx_L1_error) }
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_n_u_Running);
__Pyx_GIVEREF(__pyx_n_u_Running);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_Running);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_name);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_name);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_name);
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+020: for L in [10000, 1000000]:
__pyx_t_2 = __pyx_tuple_; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
for (;;) {
if (__pyx_t_3 >= 2) break;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 20, __pyx_L1_error)
#else
__pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
#endif
__pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 20, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_L = __pyx_t_4;
/* … */
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* … */
__pyx_tuple_ = PyTuple_Pack(2, __pyx_int_10000, __pyx_int_1000000); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 20, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple_);
__Pyx_GIVEREF(__pyx_tuple_);
+021: np_array = np.ones(L)
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 21, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ones); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 21, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_L); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 21, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_7 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
if (likely(__pyx_t_7)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
__Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_6, function);
}
}
__pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 21, __pyx_L1_error)
__Pyx_XDECREF_SET(__pyx_v_np_array, ((PyArrayObject *)__pyx_t_1));
__pyx_t_1 = 0;
+022: global_buf = np_array
{
__Pyx_BufFmt_StackElem __pyx_stack[1];
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_global_buf.rcbuffer->pybuffer);
__pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_global_buf.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_v_np_array), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
if (unlikely(__pyx_t_4 < 0)) {
PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_global_buf.rcbuffer->pybuffer, (PyObject*)__pyx_v_global_buf, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
__Pyx_RaiseBufferFallbackError();
} else {
PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
}
__pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
}
__pyx_pybuffernd_global_buf.diminfo[0].strides = __pyx_pybuffernd_global_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_global_buf.diminfo[0].shape = __pyx_pybuffernd_global_buf.rcbuffer->pybuffer.shape[0];
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
}
__Pyx_INCREF(((PyObject *)__pyx_v_np_array));
__Pyx_XDECREF_SET(__pyx_v_global_buf, ((PyArrayObject *)__pyx_v_np_array));
+023: start = time.clock()
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_clock); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
if (likely(__pyx_t_6)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
__Pyx_INCREF(__pyx_t_6);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_5, function);
}
}
__pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF_SET(__pyx_v_start, __pyx_t_1);
__pyx_t_1 = 0;
+024: f(global_buf, L, <int>(L/2))
__pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_L); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = __Pyx_PyInt_From_int(((int)(((double)__pyx_v_L) / 2.0))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 24, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_v_f);
__pyx_t_7 = __pyx_v_f; __pyx_t_11 = NULL;
__pyx_t_4 = 0;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
__pyx_t_11 = PyMethod_GET_SELF(__pyx_t_7);
if (likely(__pyx_t_11)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
__Pyx_INCREF(__pyx_t_11);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_7, function);
__pyx_t_4 = 1;
}
}
#if CYTHON_FAST_PYCALL
if (PyFunction_Check(__pyx_t_7)) {
PyObject *__pyx_temp[4] = {__pyx_t_11, ((PyObject *)__pyx_v_global_buf), __pyx_t_5, __pyx_t_6};
__pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
__Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
} else
#endif
#if CYTHON_FAST_PYCCALL
if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
PyObject *__pyx_temp[4] = {__pyx_t_11, ((PyObject *)__pyx_v_global_buf), __pyx_t_5, __pyx_t_6};
__pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
__Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
} else
#endif
{
__pyx_t_12 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 24, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
if (__pyx_t_11) {
__Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
}
__Pyx_INCREF(((PyObject *)__pyx_v_global_buf));
__Pyx_GIVEREF(((PyObject *)__pyx_v_global_buf));
PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_4, ((PyObject *)__pyx_v_global_buf));
__Pyx_GIVEREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_4, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_4, __pyx_t_6);
__pyx_t_5 = 0;
__pyx_t_6 = 0;
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+025: end = time.clock()
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_time); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 25, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_clock); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 25, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_7 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_12);
if (likely(__pyx_t_7)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
__Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_12, function);
}
}
__pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_XDECREF_SET(__pyx_v_end, __pyx_t_1);
__pyx_t_1 = 0;
+026: print(format((end-start) / loops * 1e6, "2f"), end=" ")
__pyx_t_1 = PyNumber_Subtract(__pyx_v_end, __pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_loops); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 26, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 26, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_12 = PyNumber_Multiply(__pyx_t_7, __pyx_float_1e6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 26, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 26, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_GIVEREF(__pyx_t_12);
PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_12);
__Pyx_INCREF(__pyx_kp_u_2f);
__Pyx_GIVEREF(__pyx_kp_u_2f);
PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_kp_u_2f);
__pyx_t_12 = 0;
__pyx_t_12 = __Pyx_PyObject_Call(__pyx_builtin_format, __pyx_t_7, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 26, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 26, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_GIVEREF(__pyx_t_12);
PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_12);
__pyx_t_12 = 0;
__pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 26, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_end, __pyx_kp_u__2) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_7, __pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+027: sys.stdout.flush()
__Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_sys); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 27, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_stdout); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 27, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_flush); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 27, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_7 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_12);
if (likely(__pyx_t_7)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
__Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_12, function);
}
}
__pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
028:
+029: print("μs")
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* … */
__pyx_tuple__3 = PyTuple_Pack(1, __pyx_n_u_s); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 29, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__3);
__Pyx_GIVEREF(__pyx_tuple__3);
+030: return timedecorator
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_timedecorator);
__pyx_r = __pyx_v_timedecorator;
goto __pyx_L0;
031:
+032: print()
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_print); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+033: print("-------- TESTS -------")
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* … */
__pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_u_TESTS); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 33, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__33);
__Pyx_GIVEREF(__pyx_tuple__33);
+034: loops = 1000
__pyx_v_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_loops = 0x3E8;
035:
036: @cython.boundscheck(False) # Deactivate bounds checking
037: @cython.wraparound(False) # Deactivate negative indexing.
+038: @timefunc("Static allocation for n=2")
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_timefunc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* … */
__pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_u_Static_allocation_for_n_2); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 38, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__34);
__Pyx_GIVEREF(__pyx_tuple__34);
/* … */
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s__37, __pyx_t_3) < 0) __PYX_ERR(0, 39, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+039: def _(double[::1] global_buf not None, int n, int n2):
/* Python wrapper */
static PyObject *__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_3_(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_3_ = {"_", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_3_, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_3_(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__Pyx_memviewslice __pyx_v_global_buf = { 0, 0, { 0 }, { 0 }, { 0 } };
CYTHON_UNUSED int __pyx_v_n;
CYTHON_UNUSED int __pyx_v_n2;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_global_buf,&__pyx_n_s_n,&__pyx_n_s_n2,0};
PyObject* values[3] = {0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_global_buf)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("_", 1, 3, 3, 1); __PYX_ERR(0, 39, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n2)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("_", 1, 3, 3, 2); __PYX_ERR(0, 39, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_") < 0)) __PYX_ERR(0, 39, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
}
__pyx_v_global_buf = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_global_buf.memview)) __PYX_ERR(0, 39, __pyx_L3_error)
__pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L3_error)
__pyx_v_n2 = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_n2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L3_error)
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("_", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 39, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("_cython_magic_3581c8be701b141ba2e4a4555cbc9e45._", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(((PyObject *)__pyx_v_global_buf.memview) == Py_None)) {
PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "global_buf"); __PYX_ERR(0, 39, __pyx_L1_error)
}
__pyx_r = __pyx_pf_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_2_(__pyx_self, __pyx_v_global_buf, __pyx_v_n, __pyx_v_n2);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_2_(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_global_buf, CYTHON_UNUSED int __pyx_v_n, CYTHON_UNUSED int __pyx_v_n2) {
double __pyx_v_local_buf[2];
int __pyx_v_idx;
CYTHON_UNUSED int __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_", 0);
/* … */
/* function exit code */
__pyx_L0:;
__PYX_XDEC_MEMVIEW(&__pyx_v_global_buf, 1);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__35 = PyTuple_Pack(6, __pyx_n_s_global_buf, __pyx_n_s_n, __pyx_n_s_n2, __pyx_n_s_local_buf, __pyx_n_s_idx, __pyx_n_s_i); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 39, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__35);
__Pyx_GIVEREF(__pyx_tuple__35);
/* … */
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_3_, NULL, __pyx_n_s_cython_magic_3581c8be701b141ba2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_mendoza_ipython_cython__c, __pyx_n_s__37, 39, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 39, __pyx_L1_error)
040: cdef double[2] local_buf
041: cdef int idx, i
042:
+043: with nogil, parallel():
{
#ifdef WITH_THREAD
PyThreadState *_save;
Py_UNBLOCK_THREADS
__Pyx_FastGIL_Remember();
#endif
/*try:*/ {
{
#if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
#undef likely
#undef unlikely
#define likely(x) (x)
#define unlikely(x) (x)
#endif
#ifdef _OPENMP
#pragma omp parallel private(__pyx_v_i)
#endif /* _OPENMP */
{
/* Initialize private variables to invalid values */
__pyx_v_i = ((int)0xbad0bad0);
/* … */
/*finally:*/ {
/*normal exit:*/{
#ifdef WITH_THREAD
__Pyx_FastGIL_Forget();
Py_BLOCK_THREADS
#endif
goto __pyx_L5;
}
__pyx_L5:;
}
}
+044: for i in range(loops):
__pyx_t_1 = __pyx_v_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_loops;
__pyx_t_2 = __pyx_t_1;
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
+045: for idx in prange(n2, schedule='guided'):
__pyx_t_4 = __pyx_v_n2;
if (1 == 0) abort();
{
__pyx_t_6 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
if (__pyx_t_6 > 0)
{
#ifdef _OPENMP
#pragma omp for firstprivate(__pyx_v_idx) lastprivate(__pyx_v_idx) schedule(guided)
#endif /* _OPENMP */
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_6; __pyx_t_5++){
{
__pyx_v_idx = (int)(0 + 1 * __pyx_t_5);
+046: local_buf[0] = global_buf[idx*2]
__pyx_t_7 = (__pyx_v_idx * 2);
(__pyx_v_local_buf[0]) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_global_buf.data) + __pyx_t_7)) )));
+047: local_buf[1] = global_buf[idx*2+1]
__pyx_t_8 = ((__pyx_v_idx * 2) + 1);
(__pyx_v_local_buf[1]) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_global_buf.data) + __pyx_t_8)) )));
+048: func(local_buf)
__pyx_f_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_func(__pyx_v_local_buf);
}
}
}
}
}
}
}
#if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
#undef likely
#undef unlikely
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
}
+049: return
__Pyx_XDECREF(__pyx_r);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
050:
051: @cython.boundscheck(False) # Deactivate bounds checking
052: @cython.wraparound(False) # Deactivate negative indexing.
+053: @timefunc("Dynamic allocation for n=2")
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_timefunc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* … */
__pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_u_Dynamic_allocation_for_n_2); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 53, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__38);
__Pyx_GIVEREF(__pyx_tuple__38);
/* … */
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s__37, __pyx_t_2) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+054: def _(double[::1] global_buf not None, int n, int n2):
/* Python wrapper */
static PyObject *__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_5_(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_5_ = {"_", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_5_, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_5_(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__Pyx_memviewslice __pyx_v_global_buf = { 0, 0, { 0 }, { 0 }, { 0 } };
CYTHON_UNUSED int __pyx_v_n;
CYTHON_UNUSED int __pyx_v_n2;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_global_buf,&__pyx_n_s_n,&__pyx_n_s_n2,0};
PyObject* values[3] = {0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_global_buf)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("_", 1, 3, 3, 1); __PYX_ERR(0, 54, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n2)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("_", 1, 3, 3, 2); __PYX_ERR(0, 54, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_") < 0)) __PYX_ERR(0, 54, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
}
__pyx_v_global_buf = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_global_buf.memview)) __PYX_ERR(0, 54, __pyx_L3_error)
__pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L3_error)
__pyx_v_n2 = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_n2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L3_error)
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("_", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 54, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("_cython_magic_3581c8be701b141ba2e4a4555cbc9e45._", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(((PyObject *)__pyx_v_global_buf.memview) == Py_None)) {
PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "global_buf"); __PYX_ERR(0, 54, __pyx_L1_error)
}
__pyx_r = __pyx_pf_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_4_(__pyx_self, __pyx_v_global_buf, __pyx_v_n, __pyx_v_n2);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_4_(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_global_buf, CYTHON_UNUSED int __pyx_v_n, CYTHON_UNUSED int __pyx_v_n2) {
double *__pyx_v_local_buf;
int __pyx_v_idx;
CYTHON_UNUSED int __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_", 0);
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__PYX_XDEC_MEMVIEW(&__pyx_v_global_buf, 1);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__39 = PyTuple_Pack(6, __pyx_n_s_global_buf, __pyx_n_s_n, __pyx_n_s_n2, __pyx_n_s_local_buf, __pyx_n_s_idx, __pyx_n_s_i); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 54, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__39);
__Pyx_GIVEREF(__pyx_tuple__39);
/* … */
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_5_, NULL, __pyx_n_s_cython_magic_3581c8be701b141ba2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_mendoza_ipython_cython__c, __pyx_n_s__37, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 54, __pyx_L1_error)
055: cdef double* local_buf
056: cdef int idx, i
057:
+058: with nogil, parallel():
{
#ifdef WITH_THREAD
PyThreadState *_save;
Py_UNBLOCK_THREADS
__Pyx_FastGIL_Remember();
#endif
/*try:*/ {
{
#if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
#undef likely
#undef unlikely
#define likely(x) (x)
#define unlikely(x) (x)
#endif
#ifdef _OPENMP
#pragma omp parallel private(__pyx_v_i, __pyx_v_local_buf)
#endif /* _OPENMP */
{
/* Initialize private variables to invalid values */
__pyx_v_i = ((int)0xbad0bad0);
__pyx_v_local_buf = ((double *)1);
/* … */
/*finally:*/ {
/*normal exit:*/{
#ifdef WITH_THREAD
__Pyx_FastGIL_Forget();
Py_BLOCK_THREADS
#endif
goto __pyx_L5;
}
__pyx_L5:;
}
}
+059: for i in range(loops):
__pyx_t_1 = __pyx_v_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_loops;
__pyx_t_2 = __pyx_t_1;
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
+060: local_buf = <double *> malloc(sizeof(double) * 2)
__pyx_v_local_buf = ((double *)malloc(((sizeof(double)) * 2)));
+061: for idx in prange(n2, schedule='guided'):
__pyx_t_4 = __pyx_v_n2;
if (1 == 0) abort();
{
__pyx_t_6 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
if (__pyx_t_6 > 0)
{
#ifdef _OPENMP
#pragma omp for firstprivate(__pyx_v_idx) lastprivate(__pyx_v_idx) schedule(guided)
#endif /* _OPENMP */
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_6; __pyx_t_5++){
{
__pyx_v_idx = (int)(0 + 1 * __pyx_t_5);
+062: local_buf[0] = global_buf[idx*2]
__pyx_t_7 = (__pyx_v_idx * 2);
(__pyx_v_local_buf[0]) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_global_buf.data) + __pyx_t_7)) )));
+063: local_buf[1] = global_buf[idx*2+1]
__pyx_t_8 = ((__pyx_v_idx * 2) + 1);
(__pyx_v_local_buf[1]) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_global_buf.data) + __pyx_t_8)) )));
+064: func(local_buf)
__pyx_f_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_func(__pyx_v_local_buf);
}
}
}
}
+065: free(local_buf)
free(__pyx_v_local_buf);
}
}
}
#if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
#undef likely
#undef unlikely
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
}
066:
067: @cython.boundscheck(False) # Deactivate bounds checking
068: @cython.wraparound(False) # Deactivate negative indexing.
+069: @timefunc("Static allocation for n=4")
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_timefunc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* … */
__pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_u_Static_allocation_for_n_4); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 69, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__41);
__Pyx_GIVEREF(__pyx_tuple__41);
/* … */
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s__37, __pyx_t_1) < 0) __PYX_ERR(0, 70, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+070: def _(double[::1] global_buf not None, int n, int n2):
/* Python wrapper */
static PyObject *__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_7_(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_7_ = {"_", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_7_, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_7_(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__Pyx_memviewslice __pyx_v_global_buf = { 0, 0, { 0 }, { 0 }, { 0 } };
CYTHON_UNUSED int __pyx_v_n;
int __pyx_v_n2;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_global_buf,&__pyx_n_s_n,&__pyx_n_s_n2,0};
PyObject* values[3] = {0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_global_buf)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("_", 1, 3, 3, 1); __PYX_ERR(0, 70, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n2)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("_", 1, 3, 3, 2); __PYX_ERR(0, 70, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_") < 0)) __PYX_ERR(0, 70, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
}
__pyx_v_global_buf = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_global_buf.memview)) __PYX_ERR(0, 70, __pyx_L3_error)
__pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L3_error)
__pyx_v_n2 = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_n2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L3_error)
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("_", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 70, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("_cython_magic_3581c8be701b141ba2e4a4555cbc9e45._", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(((PyObject *)__pyx_v_global_buf.memview) == Py_None)) {
PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "global_buf"); __PYX_ERR(0, 70, __pyx_L1_error)
}
__pyx_r = __pyx_pf_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_6_(__pyx_self, __pyx_v_global_buf, __pyx_v_n, __pyx_v_n2);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_6_(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_global_buf, CYTHON_UNUSED int __pyx_v_n, int __pyx_v_n2) {
double __pyx_v_local_buf[4];
int __pyx_v_idx;
CYTHON_UNUSED int __pyx_v_i;
CYTHON_UNUSED int __pyx_v_n4;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_", 0);
/* … */
/* function exit code */
__pyx_L0:;
__PYX_XDEC_MEMVIEW(&__pyx_v_global_buf, 1);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__42 = PyTuple_Pack(7, __pyx_n_s_global_buf, __pyx_n_s_n, __pyx_n_s_n2, __pyx_n_s_local_buf, __pyx_n_s_idx, __pyx_n_s_i, __pyx_n_s_n4); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 70, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__42);
__Pyx_GIVEREF(__pyx_tuple__42);
/* … */
__pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_7_, NULL, __pyx_n_s_cython_magic_3581c8be701b141ba2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_mendoza_ipython_cython__c, __pyx_n_s__37, 70, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 70, __pyx_L1_error)
071: cdef double[4] local_buf
+072: cdef int idx, i, n4 = <int> (n2/2)
__pyx_v_n4 = ((int)(((double)__pyx_v_n2) / 2.0));
073:
+074: with nogil, parallel():
{
#ifdef WITH_THREAD
PyThreadState *_save;
Py_UNBLOCK_THREADS
__Pyx_FastGIL_Remember();
#endif
/*try:*/ {
{
#if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
#undef likely
#undef unlikely
#define likely(x) (x)
#define unlikely(x) (x)
#endif
#ifdef _OPENMP
#pragma omp parallel private(__pyx_v_i)
#endif /* _OPENMP */
{
/* Initialize private variables to invalid values */
__pyx_v_i = ((int)0xbad0bad0);
/* … */
/*finally:*/ {
/*normal exit:*/{
#ifdef WITH_THREAD
__Pyx_FastGIL_Forget();
Py_BLOCK_THREADS
#endif
goto __pyx_L5;
}
__pyx_L5:;
}
}
+075: for i in range(loops):
__pyx_t_1 = __pyx_v_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_loops;
__pyx_t_2 = __pyx_t_1;
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
+076: for idx in prange(n4, schedule='guided'):
__pyx_t_4 = __pyx_v_n4;
if (1 == 0) abort();
{
__pyx_t_6 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
if (__pyx_t_6 > 0)
{
#ifdef _OPENMP
#pragma omp for firstprivate(__pyx_v_idx) lastprivate(__pyx_v_idx) schedule(guided)
#endif /* _OPENMP */
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_6; __pyx_t_5++){
{
__pyx_v_idx = (int)(0 + 1 * __pyx_t_5);
+077: local_buf[0] = global_buf[idx*4]
__pyx_t_7 = (__pyx_v_idx * 4);
(__pyx_v_local_buf[0]) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_global_buf.data) + __pyx_t_7)) )));
+078: local_buf[1] = global_buf[idx*4+1]
__pyx_t_8 = ((__pyx_v_idx * 4) + 1);
(__pyx_v_local_buf[1]) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_global_buf.data) + __pyx_t_8)) )));
+079: local_buf[2] = global_buf[idx*4+2]
__pyx_t_9 = ((__pyx_v_idx * 4) + 2);
(__pyx_v_local_buf[2]) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_global_buf.data) + __pyx_t_9)) )));
+080: local_buf[3] = global_buf[idx*4+3]
__pyx_t_10 = ((__pyx_v_idx * 4) + 3);
(__pyx_v_local_buf[3]) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_global_buf.data) + __pyx_t_10)) )));
+081: func(local_buf)
__pyx_f_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_func(__pyx_v_local_buf);
}
}
}
}
}
}
}
#if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
#undef likely
#undef unlikely
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
}
+082: return
__Pyx_XDECREF(__pyx_r);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
083:
084: @cython.boundscheck(False) # Deactivate bounds checking
085: @cython.wraparound(False) # Deactivate negative indexing.
+086: @timefunc("Dynamic allocation for n=4")
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_timefunc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* … */
__pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_u_Dynamic_allocation_for_n_4); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 86, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__44);
__Pyx_GIVEREF(__pyx_tuple__44);
/* … */
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s__37, __pyx_t_3) < 0) __PYX_ERR(0, 87, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+087: def _(double[::1] global_buf not None, int n, int n2):
/* Python wrapper */
static PyObject *__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_9_(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_9_ = {"_", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_9_, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_9_(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__Pyx_memviewslice __pyx_v_global_buf = { 0, 0, { 0 }, { 0 }, { 0 } };
CYTHON_UNUSED int __pyx_v_n;
int __pyx_v_n2;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_global_buf,&__pyx_n_s_n,&__pyx_n_s_n2,0};
PyObject* values[3] = {0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_global_buf)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("_", 1, 3, 3, 1); __PYX_ERR(0, 87, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n2)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("_", 1, 3, 3, 2); __PYX_ERR(0, 87, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_") < 0)) __PYX_ERR(0, 87, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
}
__pyx_v_global_buf = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_global_buf.memview)) __PYX_ERR(0, 87, __pyx_L3_error)
__pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L3_error)
__pyx_v_n2 = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_n2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L3_error)
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("_", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 87, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("_cython_magic_3581c8be701b141ba2e4a4555cbc9e45._", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(((PyObject *)__pyx_v_global_buf.memview) == Py_None)) {
PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "global_buf"); __PYX_ERR(0, 87, __pyx_L1_error)
}
__pyx_r = __pyx_pf_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_8_(__pyx_self, __pyx_v_global_buf, __pyx_v_n, __pyx_v_n2);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_8_(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_global_buf, CYTHON_UNUSED int __pyx_v_n, int __pyx_v_n2) {
double *__pyx_v_local_buf;
int __pyx_v_idx;
CYTHON_UNUSED int __pyx_v_i;
CYTHON_UNUSED int __pyx_v_n4;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_", 0);
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__PYX_XDEC_MEMVIEW(&__pyx_v_global_buf, 1);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__45 = PyTuple_Pack(7, __pyx_n_s_global_buf, __pyx_n_s_n, __pyx_n_s_n2, __pyx_n_s_local_buf, __pyx_n_s_idx, __pyx_n_s_i, __pyx_n_s_n4); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 87, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__45);
__Pyx_GIVEREF(__pyx_tuple__45);
/* … */
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_9_, NULL, __pyx_n_s_cython_magic_3581c8be701b141ba2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_mendoza_ipython_cython__c, __pyx_n_s__37, 87, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 87, __pyx_L1_error)
088: cdef double* local_buf
+089: cdef int idx, i, n4 = <int> (n2/2)
__pyx_v_n4 = ((int)(((double)__pyx_v_n2) / 2.0));
090:
+091: with nogil, parallel():
{
#ifdef WITH_THREAD
PyThreadState *_save;
Py_UNBLOCK_THREADS
__Pyx_FastGIL_Remember();
#endif
/*try:*/ {
{
#if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
#undef likely
#undef unlikely
#define likely(x) (x)
#define unlikely(x) (x)
#endif
#ifdef _OPENMP
#pragma omp parallel private(__pyx_v_i, __pyx_v_local_buf)
#endif /* _OPENMP */
{
/* Initialize private variables to invalid values */
__pyx_v_i = ((int)0xbad0bad0);
__pyx_v_local_buf = ((double *)1);
/* … */
/*finally:*/ {
/*normal exit:*/{
#ifdef WITH_THREAD
__Pyx_FastGIL_Forget();
Py_BLOCK_THREADS
#endif
goto __pyx_L5;
}
__pyx_L5:;
}
}
+092: for i in range(loops):
__pyx_t_1 = __pyx_v_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_loops;
__pyx_t_2 = __pyx_t_1;
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
+093: local_buf = <double *> malloc(sizeof(double) * 4)
__pyx_v_local_buf = ((double *)malloc(((sizeof(double)) * 4)));
+094: for idx in prange(n4, schedule='guided'):
__pyx_t_4 = __pyx_v_n4;
if (1 == 0) abort();
{
__pyx_t_6 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
if (__pyx_t_6 > 0)
{
#ifdef _OPENMP
#pragma omp for firstprivate(__pyx_v_idx) lastprivate(__pyx_v_idx) schedule(guided)
#endif /* _OPENMP */
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_6; __pyx_t_5++){
{
__pyx_v_idx = (int)(0 + 1 * __pyx_t_5);
+095: local_buf[0] = global_buf[idx*4]
__pyx_t_7 = (__pyx_v_idx * 4);
(__pyx_v_local_buf[0]) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_global_buf.data) + __pyx_t_7)) )));
+096: local_buf[1] = global_buf[idx*4+1]
__pyx_t_8 = ((__pyx_v_idx * 4) + 1);
(__pyx_v_local_buf[1]) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_global_buf.data) + __pyx_t_8)) )));
+097: local_buf[2] = global_buf[idx*4+2]
__pyx_t_9 = ((__pyx_v_idx * 4) + 2);
(__pyx_v_local_buf[2]) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_global_buf.data) + __pyx_t_9)) )));
+098: local_buf[3] = global_buf[idx*4+3]
__pyx_t_10 = ((__pyx_v_idx * 4) + 3);
(__pyx_v_local_buf[3]) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_global_buf.data) + __pyx_t_10)) )));
+099: func(local_buf)
__pyx_f_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_func(__pyx_v_local_buf);
}
}
}
}
+100: free(local_buf)
free(__pyx_v_local_buf);
}
}
}
#if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
#undef likely
#undef unlikely
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
}
101:
102: # ==============================================================================
103: # test function
+104: cdef void func(double* local_buf) nogil:
static void __pyx_f_46_cython_magic_3581c8be701b141ba2e4a4555cbc9e45_func(CYTHON_UNUSED double *__pyx_v_local_buf) {
CYTHON_UNUSED int __pyx_v_i;
/* … */
/* function exit code */
__pyx_L0:;
}
+105: cdef int i=0
__pyx_v_i = 0;
+106: return
goto __pyx_L0;