Skip to content

Commit

Permalink
Added support for all shared numpy datatypes - different ctypes const…
Browse files Browse the repository at this point in the history
…ructor for Python 3 support.
  • Loading branch information
classner committed Sep 20, 2016
1 parent b13fa22 commit 3df557e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pymp/shared.py
Expand Up @@ -26,7 +26,9 @@ def array(shape, dtype=_np.float64, autolock=False):
# because they're only partially supported. Instead, create a byte ctypes
# array of the right size and use a view of the appropriate datatype.
shared_arr = _multiprocessing.Array(
'b', _np.prod(shape) * dtype.alignment, lock=autolock)
'b',
_np.zeros(_np.prod(shape) * dtype.alignment, dtype=_np.byte),
lock=autolock)
with _warnings.catch_warnings():
# For more information on why this is necessary, see
# https://www.reddit.com/r/Python/comments/j3qjb/parformatlabpool_replacement
Expand Down

0 comments on commit 3df557e

Please sign in to comment.