Skip to content

Commit

Permalink
romio: Fix wrong communicator use in ADIOI_GEN_OpenColl
Browse files Browse the repository at this point in the history
When ADIOI_GEN_OpenColl is called in ADIO_CREAT mode,
file creation is done by calling ADIOI_xxx_Open with
MPI_COMM_SELF by rank == fd->hints->ranklist[0].
If successful, the file is closed with ADIOI_xxx_Close,
and later the file will be opened by all without creation flag.

The problem is that the communicator of ADIOI_GEN_OpenColl
is passed to ADIOI_xxx_Close instead of MPI_COMM_SELF.
If a collective call is made using this communicator
in ADIOI_xxx_Close, it may hang.
  • Loading branch information
range3 committed Jan 25, 2024
1 parent 846075e commit 0c436b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mpi/romio/adio/common/ad_opencoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ void ADIOI_GEN_OpenColl(ADIO_File fd, int rank, int access_mode, int *error_code
tmp_comm = fd->comm;
fd->comm = MPI_COMM_SELF;
(*(fd->fns->ADIOI_xxx_Open)) (fd, error_code);
fd->comm = tmp_comm;
MPI_Bcast(error_code, 1, MPI_INT, fd->hints->ranklist[0], fd->comm);
MPI_Bcast(error_code, 1, MPI_INT, fd->hints->ranklist[0], tmp_comm);
/* if no error, close the file and reopen normally below */
if (*error_code == MPI_SUCCESS)
(*(fd->fns->ADIOI_xxx_Close)) (fd, error_code);
fd->comm = tmp_comm;

fd->access_mode = access_mode; /* back to original */
} else
Expand Down

0 comments on commit 0c436b2

Please sign in to comment.