I would like to store a 2-d array as shared memory array, so each process created by multiprocessing module can access the 2-d array. But it seems only vector is allowed. If I change the shape in the following example from (6,1) to (2,3), the example won't work and it says "TypeError: only length-1 arrays can be converted to Python scalars"
from multiprocessing import Process, Value, Array
import numpy as np
def f(n,a):
a[:] = np.ones(shape=(6,1), dtype=float)[:]
if __name__ == '__main__':
tmp = np.zeros(shape=(6,1), dtype=float)
print tmp
arr = Array('f', tmp)
p1 = Process(target=f, args=(1,arr))
p1.start()
p1.join()
print 'done'
print arr[:]