New submission from Dariusz Trawinski <dtraw...@gmail.com>:

Currently, in order to share numpy array between processes via 
multiprocessing.SharedMemory object, it is required to copy the memory content 
with:
input = np.ones((1,10,10,10))
shm = shared_memory.SharedMemory(create=True, size=input.nbytes)
write_array = np.ndarray(input.shape, dtype=input.dtype,buffer=shm.buf)
write_array1[:] = input[:]
In result the original numpy array is duplicated in RAM. It also adds extra cpu 
cycles to copy the content.

I would like to recommend adding an option to create shared memory object by 
pointing it to existing memoryview object, beside current method of using 
shared memory name. 
Is that doable?

----------
components: C API
messages: 362754
nosy: Dariusz Trawinski
priority: normal
severity: normal
status: open
title: create multiprocessing.SharedMemory by pointing to existing memoryview
type: performance
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39767>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to