Skip to content

mpi_file_open fails on symlink with Lustre filesystem #12141

@anton-seaice

Description

@anton-seaice

Background information

What version of Open MPI are you using? (e.g., v3.0.5, v4.0.2, git branch name and hash, etc.)

v4.1.4

Describe how Open MPI was installed (e.g., from a source/distribution tarball, from a git clone, from an operating system distribution package, etc.)

From source tarball

Please describe the system on which you are running


Details of the problem

When I attempt to open a file through its symlink, it fails with the error :

get_stripe failed: 61 (No data available)
MPI_ERR_OTHER: known error not in list

The expected result is that the symlink to the file opens the same way the file does.

This is my minimal test example:

program mpi_file_open_example
  implicit none

  include 'mpif.h'
  
  integer, parameter :: nprocs = 4
  integer :: rank, ierr, file_handle, status, len 
  character(len=MPI_MAX_ERROR_STRING) :: error_string
  character(len=80) :: filename = "parallel_file.txt", link = "link_to_parallel_file.txt"

  ! Confirm the link can be opened using open
  open(newunit=file_handle, file=link, status="old", action="read", &
  iostat=ierr, iomsg=error_string)
  if (ierr /= 0) then
    print *, trim(error_string)
    call abort()
  end if
    close(file_handle)

  
  ! Initialize MPI
  call MPI_Init(ierr)
  call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierr)

  ! Open the file in parallel
  write(*, *) "Open the file in parallel: "
  call MPI_File_open(MPI_COMM_WORLD, filename, &
                     MPI_MODE_RDONLY, MPI_INFO_NULL, file_handle, ierr)
    
  if (ierr /= MPI_SUCCESS) then
    call MPI_Error_string(ierr, error_string, len, ierr)
    write(*, *) "Error opening ", trim(filename), " : ", trim(error_string)
  else
    write(*, *) "Success opening ", trim(filename)
  end if
  
  ! Close the file
  call MPI_File_close(file_handle, ierr)

  write(*, *) "==================="

  ! Open the symlink in parallel
  write(*, *) "Open the symlink in parallel: "
  call MPI_File_open(MPI_COMM_WORLD, link, &
                     MPI_MODE_RDONLY, MPI_INFO_NULL, file_handle, ierr)
    
  if (ierr /= MPI_SUCCESS) then
    call MPI_Error_string(ierr, error_string, len, ierr)
    write(*, *) "Error opening ", trim(link), " : ", trim(error_string)
  else
    write(*, *) "Success opening ", trim(link)
  end if

  ! Close the file
  call MPI_File_close(file_handle, ierr)

  ! Finalize MPI
  call MPI_Finalize(ierr)
  
end program mpi_file_open_example

to reproduce:

module purge
module load intel-compiler/2021.6.0 openmpi/4.1.4
mpifort mpi_file_open.f90 -o mpi_file_open.exe

touch parallel_file.txt
ln -s parallel_file.txt link_to_parallel_file.txt

./mpi_file_open.exe 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions