[MPICH] MPI_GET_ADDRESS

William Gropp gropp at mcs.anl.gov
Thu Apr 20 18:00:43 CDT 2006


At 04:52 PM 4/20/2006, Kenneth Rempe wrote:


>I running been having problems with MPI_GET_ADDRESS on a  Linux box and on 
>a  AIX v 5.2 box. These machines both
>have more than 2GB of  memory ( real + swap ). I appears that when an 
>array of memory is allocated with an
>address above 2GB then MPI_GET_ADDRESS returns a incorrect (negative 
>address ) . I believe this is because the
>variable use to hold the address is a 4 byte signed integer so the max 
>value is 2^^31 or 2GB.  The follow code shows
>the problem.  On both my linux box and AIX box it fails with a memory 
>addressing error even though the memory
>has been allocated successfully. Has anybody seen this problem before and 
>is there any fix beside using a 64bit version of mpi?

What is the value of MPI_ADDRESS_KIND, and which Fortran compilers are you 
using? If MPICH was configured for a system that has 8 byte addresses, it 
should have set MPI_ADDRESS_KIND to the Fortran integer type that 
corresponds to that address size.

Bill



>      program memtest
>      use mpi
>      implicit none
>      integer (kind=MPI_ADDRESS_KIND) address
>      real, allocatable :: a1(:)
>      real, allocatable :: a2(:)
>      real, allocatable :: a3(:)
>      real, allocatable :: a4(:)
>      real, allocatable :: a5(:)
>      real, allocatable :: a6(:)
>      real, allocatable :: a7(:)
>      real, allocatable :: a8(:)
>      real, allocatable :: a9(:)  ! This should be beyond 2GB limit
>      integer, parameter :: space=67108864   ! 256 MB
>      integer            :: stat
>      integer            :: ierror
>
>      call MPI_INIT(ierror)
>      allocate(a1(space),stat=stat)
>      if(stat .ne. 0 ) stop 'memory allocation error a1'
>      call MPI_GET_ADDRESS(a1,address,ierror)
>      if( address .lt. 0 ) stop 'memory addressing error a1'
>
>      allocate(a2(space),stat=stat)
>      if(stat .ne. 0 ) stop 'memory allocation error a2 '
>      call MPI_GET_ADDRESS(a2,address,ierror)
>      if( address .lt. 0 ) stop 'memory addressing error a2'
>
>      allocate(a3(space),stat=stat)
>      if(stat .ne. 0 ) stop 'memory allocation error a3'
>      call MPI_GET_ADDRESS(a3,address,ierror)
>      if( address .lt. 0 ) stop 'memory addressing error a3'
>
>      allocate(a4(space),stat=stat)
>      if(stat .ne. 0 ) stop 'memory allocation error a4'
>      call MPI_GET_ADDRESS(a4,address,ierror)
>      if( address .lt. 0 ) stop 'memory addressing error a4'
>
>      allocate(a5(space),stat=stat)
>      if(stat .ne. 0 ) stop 'memory allocation error a5'
>      call MPI_GET_ADDRESS(a5,address,ierror)
>      if( address .lt. 0 ) stop 'memory addressing error a5'
>
>      allocate(a6(space),stat=stat)
>      if(stat .ne. 0 ) stop 'memory allocation error a6'
>      call MPI_GET_ADDRESS(a6,address,ierror)
>      if( address .lt. 0 ) stop 'memory addressing error a6'
>
>      allocate(a7(space),stat=stat)
>      if(stat .ne. 0 ) stop 'memory allocation error a7'
>      call MPI_GET_ADDRESS(a7,address,ierror)
>      if( address .lt. 0 ) stop 'memory addressing error a7'
>
>      allocate(a8(space),stat=stat)
>      if(stat .ne. 0 ) stop 'memory allocation error a8'
>      call MPI_GET_ADDRESS(a8,address,ierror)
>      if( address .lt. 0 ) stop 'memory addressing error a8'
>
>      allocate(a9(space),stat=stat)
>      if(stat .ne. 0 ) stop 'memory allocation error a9'
>      call MPI_GET_ADDRESS(a9,address,ierror)
>      if( address .lt. 0 ) stop 'memory addressing error a9'
>
>      stop 'Normal Termination'
>      end

William Gropp
http://www.mcs.anl.gov/~gropp 




More information about the mpich-discuss mailing list