Ravi,
I don't know if this answers your question, but in C and C++,
multi-dimensional arrays are stored in "row-major" order, that is, in
such a way that the LAST subscript varies most rapidly, then the next to
last etc.
e.g. the elements of the array: int t[2][3] are stored (in
increasing addresses) as:
t[0][0], t[0][1], t[0][2], t[1][0], t[1][1], t[1][2]
However in FORTRAN, multidimensional arrays are store in "column-major"
order, that is, in such a way that the FIRST subscript varies most
rapidly, then the second, then the third, etc.
e.g. the elements of the array: INTEGER K(2,3) are stored (in
increasing addresses) as:
k(1,1), K(2,1) , K(1,2), K(2,2), K(1,3), K(2,3)
You have to take this into consideration when writing "mixed" programs
in C (or C++) and Fortran code, and when outputting arrays as binary
data in code written in one language and reading it in code written in
the other.
Regards
Neil
Kumar, Ravi Ranjan wrote:
>Thank you for the reply! I'll apply non-blocking send-recv to check if problem
>still exits.
>
>I have another question on sending contiguous data. I want to know which index
>is traversed first among 3 indices (z, y & x) in T[Nz][Nx][Ny]. I wrote my code
>in C++ and MPI. Suppose, I want to send Nx*Ny number of data so I am simply
>using T[2][0][0] (if I want to send 3rd plane out of Nz planes of data) and I
>am receiving data in another processor at location (say) T[3][0][0]. I have
>doubt about x-y co-ordinate of data. Will it be received in the same fashion as
>it was sent?? Do I need to check which indices ( x or y ) is traversed first?
>Pls explain.
>
>Thanks a lot for your help
>
>Ravi R. Kumar
>
>
>
>
>
--
+-----------------+---------------------------------+------------------+
| Neil Storer | Head: Systems S/W Section | Operations Dept. |
+-----------------+---------------------------------+------------------+
| ECMWF, | email: neil.storer_at_[hidden] | //=\\ //=\\ |
| Shinfield Park, | Tel: (+44 118) 9499353 | // \\// \\ |
| Reading, | (+44 118) 9499000 x 2353 | ECMWF |
| Berkshire, | Fax: (+44 118) 9869450 | ECMWF |
| RG2 9AX, | | \\ //\\ // |
| UK | URL: http://www.ecmwf.int/ | \\=// \\=// |
+--+--------------+---------------------------------+----------------+-+
| ECMWF is the European Centre for Medium-Range Weather Forecasts |
+-----------------------------------------------------------------+
|