[MPICH] disp argument in MPI_File_set_view() in Fortran
Rajeev Thakur
thakur at mcs.anl.gov
Sun Jan 28 11:48:33 CST 2007
The problem is that if you just pass 0 in Fortran, the Fortran compiler will
pass it as a pointer to a 4-byte integer (assuming integers are 4 bytes on
your system), whereas file offsets and displacements on the same system are
8 bytes, and the MPI library is expecting a pointer to an 8-byte integer.
This is one of the common user errors that I mention in an MPI or MPI-IO
tutorial.
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: Sunday, January 28, 2007 2:19 AM
> To: mpich-discuss at mcs.anl.gov
> Subject: [MPICH] disp argument in MPI_File_set_view() in Fortran
>
>
> I am testing a Fortran MPI I/O code. I found that when
> setting the file
> view, if I used "0" directly for the disp argument in
> MPI_File_set_view()
> call, then MPI_File_write() or MPI_File_write_at() will fail.
>
> But if I used a variable of type
> integer(KIND=MPI_OFFSET_KIND) and set it
> to 0 and used it in the disp argument, everything works fine.
> I also can
> see all Fortran test codes in ROMIO test directory written in
> this way.
>
> I looked into ADIO implementation, in particular, ad_nfs_write.c and
> ad_pvfs_write.c. I put a print statement to print the offset
> value passed
> into functions ADIOI_NFS_WriteContig() and
> ADIOI_PVFS_WriteContig() and I
> got a very large number, like 85899346160, although it should be very
> small or 0 in my test code. I believe there is something
> fishy in type
> casting when passing the offset variable among functions in ROMIO.
> However, C seems not having this problem.
>
> I am using mpich2-1.0.5 on a Linux cluster running athlon
> i386 and RedHat
> 2.4.21-32.0.1.EL. MPICH is compiled with gcc, gfortran 4.0.0.
>
> Wei-keng
>
>
>
More information about the mpich-discuss
mailing list