[mpich-discuss] MPI_Info_get()

Rajeev Thakur thakur at mcs.anl.gov
Sun Mar 2 22:08:51 CST 2008


Thanks. We will fix it for the next release.

Rajeev 

> -----Original Message-----
> From: owner-mpich-discuss at mcs.anl.gov 
> [mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of Wei-keng Liao
> Sent: Saturday, March 01, 2008 10:18 PM
> To: mpich-discuss at mcs.anl.gov
> Subject: [mpich-discuss] MPI_Info_get()
> 
> 
> According to MPI-2, function MPI_Info_get() is defined as:
>   MPI_INFO_GET(info, key, valuelen, value, flag) "If such a 
> key exists, it sets flag to true and returns the value in 
> value, otherwise it sets flag to false and leaves value unchanged."
> 
> I found that C programs of mpich2-1.0.6p1 follow the 
> definition, but Fortran programs have problems for the otherwise case.
> I.e. when the flag is returned false, the content of value 
> was changed.
> Attached is a test program to reproduce the problem.
> 
> Wei-keng
> --------------------------------------------------------------
>         program main
>         use mpi
>         implicit none
> 
>         integer i, argc, fp, info, ierr
>         integer iargc
>         logical flag
>         character(len = 256) :: argv(2), value
> 
>         call MPI_Init(ierr)
> 
>         argc = IARGC()
>         if (argc .NE. 2) then
>             print *, 'Usage: filename key'
>             goto 999
>         endif
>         do i=1, argc
>             call getarg(i, argv(i))
>         enddo
> 
>         call MPI_File_open(MPI_COMM_WORLD, argv(1), &
>                            MPI_MODE_RDWR+MPI_MODE_CREATE, &
>                            MPI_INFO_NULL, fp, ierr)
>         call MPI_File_get_info(fp, info, ierr)
> 
>         value = "undefined"
>         call MPI_Info_get(info, argv(2), 256, value, flag, ierr)
> 
>         print*,'MPI_Info_get -- flag = ',flag
>         print*,'MPI File Info: ',trim(argv(2)),' = ',trim(value)
> 
>         call MPI_File_close(fp, ierr)
>         call MPI_Info_free(info, ierr)
>  999    call MPI_Finalize(ierr)
> 
>         end program main
> 
> 
> 




More information about the mpich-discuss mailing list