Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] MPI_File_get_size fails for files > 2 GB in Fortran
From: George Bosilca (bosilca_at_[hidden])
Date: 2010-12-20 16:31:48


There is a hint for F77 users at the bottom of the page. It suggests to use INTEGER*MPI_OFFSET_KIND as type for the SIZE. I guess if we cast it correctly, and the users follow the MPI specification, this should work.

  george.

On Dec 20, 2010, at 15:04 , Edgar Gabriel wrote:

> well, but that is fortran90, bot f77
>
> On 12/20/2010 1:55 PM, George Bosilca wrote:
>> Not really. The Fortran prototype from our man page is:
>>
>> INCLUDE ’mpif.h’
>> MPI_FILE_GET_SIZE(FH, SIZE, IERROR)
>> INTEGER FH, ERROR
>> INTEGER(KIND=MPI_OFFSET_KIND) SIZE
>>
>> So the size is of type MPI_OFSET_KIND which is INTEGER*8 (signed). There is still a mismatch between of C and the Fortran version (size_t vs. ssize_t on my platform), but let's save this for later.
>>
>> george.
>>
>> On Dec 20, 2010, at 14:48 , Edgar Gabriel wrote:
>>
>>> well, but the f77 interface defines that to be an integer, unless you
>>> want to change the fortran API, you will have to map it to an MPI_Fint
>>> in my opinion.
>>>
>>> Edgar
>>>
>>> On 12/20/2010 1:36 PM, George Bosilca wrote:
>>>> Nice catch. The sizes are MPI_Offset in C, and therefore we should not cast them as MPI_Fint. I'll take a look, but I doubt it will be before next year. Meanwhile, patches are always welcomed.
>>>>
>>>> george.
>>>>
>>>> On Dec 20, 2010, at 10:59 , William George wrote:
>>>>
>>>>>
>>>>> In Fortran, calls to MPI_File_get_size return a negative value
>>>>> when the file is larger that 2GB.
>>>>>
>>>>> I am using Open MPI 1.4.3 on an x86_64 system. This happens with OpenMPI
>>>>> compiled with Intel compilers or GCC, so I don't think it has
>>>>> anything to do with the particular compiler in use.
>>>>>
>>>>> I can fix this by removing the cast to MPI_Fint in
>>>>> the function mpi_file_get_size_ in ompi/mpi/f77/file_get_size_f.c.
>>>>>
>>>>> Changing:
>>>>> *size = (MPI_Fint) c_size;
>>>>>
>>>>> To:
>>>>>
>>>>> *size = c_size;
>>>>>
>>>>>
>>>>> But my guess is that this is not a proper fix.
>>>>>
>>>>> There are a few other suspicious casts to MPI_Fint in the f77
>>>>> directory too that probably cause similar problems:
>>>>>
>>>>> $ $ grep \(MPI_Fint\) *.c
>>>>> address_f.c: *address = (MPI_Fint) addr;
>>>>> file_get_position_f.c: *offset = (MPI_Fint) c_offset;
>>>>> file_get_position_shared_f.c: *offset = (MPI_Fint) c_offset;
>>>>> file_get_size_f.c: *size = (MPI_Fint) c_size;
>>>>> file_get_view_f.c: *disp = (MPI_Fint) c_disp;
>>>>> type_extent_f.c: *extent = (MPI_Fint)c_extent;
>>>>>
>>>>>
>>>>> I can also fix this problem by compiling OpenMPI with
>>>>> the flag -i8, but promoting all Fortran INTEGERs to 8-bytes
>>>>> does not seem correct either.
>>>>>
>>>>> So - is this a configuration problem, a compile problem.
>>>>> a source code bug, or what? Is there an MPI_FOffsetint
>>>>> and/or MPI_FAddressint type that should be used
>>>>> in these casts?
>>>>>
>>>>>
>>>>> Regards,
>>>>> --
>>>>> Bill
>>>>>
>>>>> William L. George
>>>>> National Institute of Standards and Technology
>>>>> ITL - Applied and Computational Mathematics Division, Stop 8911
>>>>> 100 Bureau Drive
>>>>> Gaithersburg, MD 20899-8911
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> devel mailing list
>>>>> devel_at_[hidden]
>>>>> http://www.open-mpi.org/mailman/listinfo.cgi/devel
>>>>
>>>>
>>>> _______________________________________________
>>>> devel mailing list
>>>> devel_at_[hidden]
>>>> http://www.open-mpi.org/mailman/listinfo.cgi/devel
>>>
>>> --
>>> Edgar Gabriel
>>> Assistant Professor
>>> Parallel Software Technologies Lab http://pstl.cs.uh.edu
>>> Department of Computer Science University of Houston
>>> Philip G. Hoffman Hall, Room 524 Houston, TX-77204, USA
>>> Tel: +1 (713) 743-3857 Fax: +1 (713) 743-3335
>>>
>>> _______________________________________________
>>> devel mailing list
>>> devel_at_[hidden]
>>> http://www.open-mpi.org/mailman/listinfo.cgi/devel
>>
>>
>> _______________________________________________
>> devel mailing list
>> devel_at_[hidden]
>> http://www.open-mpi.org/mailman/listinfo.cgi/devel
>
> --
> Edgar Gabriel
> Assistant Professor
> Parallel Software Technologies Lab http://pstl.cs.uh.edu
> Department of Computer Science University of Houston
> Philip G. Hoffman Hall, Room 524 Houston, TX-77204, USA
> Tel: +1 (713) 743-3857 Fax: +1 (713) 743-3335
>
> _______________________________________________
> devel mailing list
> devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/devel