Suppose we have a numpy array.
a = np.array([[1,2,3],[4,5,6], [7,8,9]])
Now, if I want to extract Columns 0 and 2, it would require doing something like
b = a[:, [0, 2]]
However, if we try to find properties of b by executing b.flags
, we get
C_CONTIGUOUS : False
F_CONTIGUOUS : True
As can be seen, array a which is originally C_contiguous is automatically converted to F_contiguous. This usually does not pose any problem if I run my code on a single core. However, if I use mpi4py to scatter data across multiple cores, it has to be C_contiguous only or else scattering is incorrect.
My question is how can I avoid 'b' from automatically getting converted to F_contiguous?
Thanks,
SLB