1# tag: numpy_old
2# tag: openmp
3
4cimport cython
5from cython.parallel import prange
6cimport numpy as np
7include "numpy_common.pxi"
8
9
10@cython.boundscheck(False)
11def test_parallel_numpy_arrays():
12    """
13    >>> test_parallel_numpy_arrays()
14    -5
15    -4
16    -3
17    -2
18    -1
19    0
20    1
21    2
22    3
23    4
24    """
25    cdef Py_ssize_t i
26    cdef np.ndarray[np.int_t] x
27
28    try:
29        import numpy
30    except ImportError:
31        for i in range(-5, 5):
32            print i
33        return
34
35    x = numpy.zeros(10, dtype=numpy.int)
36
37    for i in prange(x.shape[0], nogil=True):
38        x[i] = i - 5
39
40    for i in x:
41        print i
42
43