[mvapich-discuss] mvapich2 and malloc

Bryan Putnam bfp at purdue.edu
Thu Jul 12 10:23:04 EDT 2007


Hi,

I've run across a piece of code that fails (hangs) with mvapich2,
but runs succesfully with mpich2 and mpich.  The problem seems to
occur when the number of bytes being allocated is greater than the
largest 32-bit integer. So, even though we used 64-bit compilers
to build this version of mvapich2, it appears that mvapich2 may be
using its own version of malloc that isn't able to handle 64-bit
addresses. Is this a known problem?

Thanks,
Bryan

I've appended the code for your enjoyment in case you'd like to experiment 
with it. It works OK with ncol=nrow=nsec=812, but fails with 813. In the 
later case, the # of bytes exceeds the max 32-bit integer.

      program alloc3
      use mpi
c     include 'mpif.h'
      integer me, nt, mpierr, status(MPI_STATUS_SIZE)
      integer*4 allocate_stat
      real*4, allocatable :: x(:,:,:)
c     real*8, allocatable :: x(:,:,:)

      call MPI_INIT(mpierr)
      call MPI_COMM_SIZE(MPI_COMM_WORLD, nt, mpierr)
      call MPI_COMM_RANK(MPI_COMM_WORLD, me, mpierr)

c     max int = 2147483647
c     813**3 * 4 = 2149471188
c     812**3 * 4 = 2141549312

      NCOL = 813
      NROW = 813
      NSEC = 813
c     NCOL = 812
c     NROW = 812
c     NSEC = 812

      ALLOCATE(X(NCOL,NROW,NSEC), STAT=ALLOCATE_STAT)
      IF( ALLOCATE_STAT .NE. 0)THEN
        print *,'Can not allocated memory in GET_PRJSPFTS_G'
      ENDIF
      
      
      
      DO I = 1,NSEC
        DO J = 1,NROW
          DO K = 1, NCOL
            X(K,J,I) = 0.0
          ENDDO
        ENDDO
        if(me.eq.0)print *,'finish initilize map3d sec',I
      ENDDO

      deallocate(x)

      call MPI_FINALIZE(mpierr)
      print *, "Done1"
      stop
      end


More information about the mvapich-discuss mailing list