
El lun, 11 de oct. de 2021 a la(s) 06:50, Simon Cross (hodgestar+pythondev@gmail.com) escribió:
Multiprocessing sort of added support for this via multiprocessing.Array -- see https://stackoverflow.com/questions/9754034/can-i-create-a-shared-multiarray.... I haven't looked at what multiprocessing.Array does under the hood.
Summary of the StackOverflow answer for those who don't feel like clicking:
mp_arr = mp.Array(c.c_double, size) # then in each new process create a new numpy array using: arr = np.frombuffer(mp_arr.get_obj())
Right, this is very close to what I had in mind for the "example with numpy.array" that I want to code next (as I just said in the response to Gregory, this is a series of implementations for pedagogical purposes trying to teach parallel processing). Thanks! -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org.ar/ Twitter: @facundobatista