Intel® oneAPI HPC Toolkit
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.
1936 Discussions

Wrong limit on disp parameter in ILP64 version of MPI_File_set_view?



Both with some older (17.0.2) and the newest (19.0.3) Intel Fortran Compiler + Intel MPI I experience problems with the function MPI_File_set_view when using the 64-bit integer Fortran interface of Intel MPI (aka ILP64, using compiler switch -i8).

Whenever I set the write offset argument "disp" of this function outside of the int32 range, the call fails with the error code 201389836. However, the argument is of kind MPI_OFFSET_KIND, so it is supposed to support large values without any problems.

Curiously, this failure happens only with the ILP64 version, not with the LP64 version, which is the other way round than one would expect. As if there was an erroneous range check somewhere in the ILP64 interface before calling the underlying LP64 implementation, which actually supports large offsets.

Below is an example program that demonstrates the issue. The program writes an exactly 2-GiB integer array to a file, starting at offset 0. Then it attempts to position the next writing view at the end of the just written chunk and write one extra integer. It works well with Open MPI 4.0.0 ILP64 and Intel MPI 17.0.2/19.0.3 LP64 (prints 0) but fails with Intel MPI 17.0.2/19.0.3 ILP64 (prints 201389836). NB: This sample program is intended to be executed in single process only.

Did I hit a bug in Intel MPI?


program mpi_io_offset

    use iso_fortran_env, only: int32
    use mpi

    implicit none

    integer(int32), parameter :: mpiint = kind(MPI_COMM_WORLD)
    integer(int32), parameter :: mpiofs = MPI_OFFSET_KIND

    integer(mpiint) :: ierr, fh, stat(MPI_STATUS_SIZE), one = 1, num = 2**29
    integer(mpiofs) :: zero = 0, two_GiB_bytes

    integer(int32)              :: four_B_int = -1
    integer(int32), allocatable :: two_GiB_array(:)

    allocate (two_GiB_array(num))
    two_GiB_array(:) = 0
    two_GiB_bytes = num * 4_mpiofs

    call MPI_Init(ierr)
    call MPI_File_open(MPI_COMM_WORLD, 'file.bin', MPI_MODE_CREATE + MPI_MODE_WRONLY, MPI_INFO_NULL, fh, ierr)
    call MPI_File_set_size(fh, zero, ierr)
    call MPI_File_set_view(fh, zero, MPI_INTEGER4, MPI_INTEGER4, 'native', MPI_INFO_NULL, ierr)
    call MPI_File_write_all(fh, two_GiB_array, num, MPI_INTEGER4, stat, ierr)
    call MPI_File_set_view(fh, two_GiB_bytes, MPI_INTEGER4, MPI_INTEGER4, 'native', MPI_INFO_NULL, ierr)

    print *, ierr

    call MPI_File_write_all(fh, four_B_int, one, MPI_INTEGER4, stat, ierr)
    call MPI_File_close(fh, ierr)
    call MPI_Finalize(ierr)

end program mpi_io_offset


0 Kudos
2 Replies

This problem still persists in Intel oneAPI 2021 (or more specifically Intel(R) MPI Library for Linux* OS, Version 2021.1 Build 20201112).


The program still fails in ILP64 mode with Intel(R) MPI Library for Linux* OS, Version 2021.5 Build 20211102.