Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
5e42b9f0
Commit
5e42b9f0
authored
Feb 04, 2012
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add acquisition counting stress test
parent
399a40a0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
tests/run/memoryview_acq_count.srctree
tests/run/memoryview_acq_count.srctree
+42
-0
No files found.
tests/run/memoryview_acq_count.srctree
0 → 100644
View file @
5e42b9f0
PYTHON setup.py build_ext --inplace
PYTHON -c "import counting_atomic"
PYTHON -c "import counting_locked"
######## setup.py ########
from distutils.core import setup
from Cython.Distutils import build_ext
from Cython.Distutils.extension import Extension
setup(
ext_modules = [
Extension("counting_atomic", ["counting_atomic.pyx"]),
Extension("counting_locked", ["counting_locked.pyx"],
define_macros=[('CYTHON_ATOMICS', '0')])
],
cmdclass={'build_ext': build_ext},
)
######## counting_atomic.pyx ########
include "counting.pxi"
######## counting_locked.pyx ########
include "counting.pxi"
######## counting.pxi ########
cimport cython
from cython.parallel cimport prange
cdef int[100] a
cdef int[:] m = a
cdef Py_ssize_t i
for i in prange(1000000, nogil=True, num_threads=16):
use_slice(m[::2])
cdef int use_slice(int[:] m) nogil except -1:
cdef int[:] m2 = m[1:]
m = m2[:-1]
del m, m2
return 0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment