[MPICH] Crash using MPI_PACK on windows but not on Linux
biswanath.chowdhury at l-3com.com
biswanath.chowdhury at l-3com.com
Thu Nov 16 11:06:00 CST 2006
Hi All,
I am trying to use MPI_PACK in my f90 code and it does not work on
Windows. The example program
from "MPI User's guide in Fortran" by Dr Peter S. Pacheco and Woo Chat
Ming also does not work.
The fortran compiler is Compaq Visual Fortran 6.6C and I am using the
installation from "mpich2-1.0.3-1-win32-ia32.msi".
The code works if a new type is created using MPI_TYPE_CREATE_STRUCT.
The MPI_PACK code
works on Linux with MPICH2-1.0.3.
The example code is attached. Does anyone know whether MPI_PACK can be
used on Windows XP?
Also, is there anyway to search the discussion list archive?
Thanks,
Biswanath
> !*******************************************************************************
> subroutine Get_data4(a, b, n, my_rank)
>
> use mpi
>
> real a
> real b
> integer n
> integer my_rank
> !
>
> integer ierr, size_int, size_real, size_t
> !character buffer(100)
> character, allocatable,dimension(:) :: buffer
> integer position
> ! in the buffer
>
> call MPI_PACK_SIZE(1, MPI_INTEGER, MPI_COMM_WORLD, size_int, ierr )
>
> call MPI_PACK_SIZE(2, MPI_REAL, MPI_COMM_WORLD, size_real, ierr )
>
> size_t = size_int + size_real
>
> ALLOCATE(buffer(size_t),STAT=ios)
>
> !
> if (my_rank .EQ. 0) then
>
> ! Now pack the data into buffer. Position = 0
> ! says start at beginning of buffer.
> position = 0
> !
> ! Position is in/out
> call MPI_PACK(a, 1, MPI_REAL , buffer, size_t, &
> position, MPI_COMM_WORLD, ierr )
> ! Position has been incremented: it now refer-
> ! ences the first free location in buffer.
> !
> call MPI_PACK(b, 1, MPI_REAL , buffer, size_t, &
> position, MPI_COMM_WORLD, ierr )
> ! Position has been incremented again.
> !
> call MPI_PACK(n, 1, MPI_INTEGER, buffer, size_t, &
> position, MPI_COMM_WORLD, ierr )
> ! Position has been incremented again.
> !
> ! Now broadcast contents of buffer
> call MPI_BCAST(buffer, size_t, MPI_PACKED, 0, &
> MPI_COMM_WORLD, ierr )
>
> write(6,*)'id = ',my_rank,' a, b, n = ',a, b, n
>
> call flush(6)
>
> else
> call MPI_BCAST(buffer, size_t, MPI_PACKED, 0, &
> MPI_COMM_WORLD, ierr )
> !
> ! Now unpack the contents of buffer
> position = 0
> call MPI_UNPACK(buffer, size_t, position, a, 1, &
> MPI_REAL , MPI_COMM_WORLD, ierr )
> ! Once again position has been incremented:
> ! it now references the beginning of b.
> !
> call MPI_UNPACK(buffer, size_t, position, b, 1, &
> MPI_REAL , MPI_COMM_WORLD, ierr )
> call MPI_UNPACK(buffer, size_t, position, n, 1, &
> MPI_INTEGER, MPI_COMM_WORLD, ierr )
>
> write(6,*)'id = ',my_rank,' a, b, n = ',a, b, n
>
> call flush(6)
>
> endif
>
>
> DEALLOCATE(buffer,STAT=ios)
>
> return
> end
More information about the mpich-discuss
mailing list