LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Neil Storer (Neil.Storer_at_[hidden])
Date: 2005-03-10 10:45:25


Ravi,

You have a more fundamental problem.

Although you think you "A" is a contiguous array of integer values, it
isn't.

If you had declared it as:
 
       "int A[3][4][5]"

you would have such a contiguous array, which you could pass through
MPI_Send, but you don't.

Because you have allocated each of your rows separately via

        A[i][j] = new int[ln];

the rows are not necessarily contiguous, which is why you have the value "25" occupying every 6th element of B!

Even declaring it as A[3][4][5] you can still have problems on a system that is not big-endian. That is because on a big-endian system (such as my IBM p690 POWER4) "&A[0][0][0]" is the address of the first byte of the integer stored in that location, while on a little-endian system (such as my IBM M-pro Intel) it is the address of the lowest byte of the integer.

On my little-endian system I lose the upper byte of the first integer (I'm not using LAM-MPI, and LAM may compensate for this - I don't know)!

You will have to recode, either to pass individual rows across, rather than planes. Or you could alter the allocation part to allocate planes instead of rows. Either way your code won't work as it stands, nor with the "for" loops inverted as I said on the last e-mail (which you still need to do).

I hope this helps.

Regards
        Neil

-- 
+-----------------+---------------------------------+------------------+
| 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 |
   +-----------------------------------------------------------------+