SMA#
Shared memory arrays for parallel processing.
Note
Usage of this array can help for parallel processing of shared memory
arrays. However, using memmap sources (MMP
) often enable
faster implementations.
- base(array)[source]#
Return the underlying multiprocessing shared raw array from a shared numpy array
Arguments
- arrayarray
Shared array.
Returns
- arrayarray
The raw shared memory base array.
- ctype(dtype)[source]#
Determine ctype from array or dtype for ctype array construction
Arguments
- dtypearray or dtype
The array or data type to determine the c type from.
Returns
- ctypestr
The c-type correspinding to the array or dtype.
- empty(shape, dtype=None, order=None)[source]#
Creates a empty shared memory array with numpy wrapper
Arguments
- shapetuple of ints
The shape of the shared memory array to create.
- dtypearray or dtype
The array or data type to determine the c type from, if None float is used.
- orderC’, ‘F’, or None
The order of the array.
Returns
- arrayarray
A shared memory array wrapped as ndarray.
- ones(shape, dtype=None, order=None)[source]#
Creates a shared memory array of ones with numpy wrapper
Arguments
- shapetuple of ints
The shape of the shared memory array to create.
- dtypearray or dtype
The array or data type to determine the c type from, if None float is used.
- order‘A’, ‘C’, ‘F’, or None
The order of the array. If None, ‘A’ is used.
Returns
- arrayarray
A shared memory array wrapped as ndarray.
- zeros(shape, dtype=None, order=None)[source]#
Creates a shared memory array of zeros with numpy wrapper
Arguments
- shapetuple of ints
The shape of the shared memory array to create.
- dtypearray or dtype
The array or data type to determine the c type from, if None float is used.
- order‘A’, ‘C’, ‘F’, or None
The order of the array. If None, ‘A’ is used.
Returns
- arrayarray
A shared memory array wrapped as ndarray.
- zeros_like(source, shape=None, dtype=None, order=None)[source]#
Creates a shared memory array with numpy wrapper using shape, dtype and order from source
Arguments
- sourcearray
The source array to use as template.
- shapetuple of ints
The shape of the shared memory array to create.
- dtypearray or dtype
The array or data type to determine the c type from, if None float is used.
- order‘A’, ‘C’, ‘F’, or None
The order of the array. If None, ‘A’ is used.
Returns
- arrayarray
A shared memory array wrapped as ndarray basedon the source array.