Skip to content

MPI_Info_dup: allocate info through ompi_info_allocate instead of OBJ_NEW #10349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions ompi/mca/io/romio341/src/io_romio341_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,16 @@ static int delete_select(const char *filename, struct opal_info_t *info,
// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call
// below with an MPI_Info, we need to create an equivalent MPI_Info. This
// isn't ideal but it only happens a few places.
ompi_info_t *ompi_info;
ompi_info = OBJ_NEW(ompi_info_t);
if (!ompi_info) { return(MPI_ERR_NO_MEM); }
opal_info_t *opal_info = &(ompi_info->super);
ompi_info_t ompi_info;
OBJ_CONSTRUCT(&ompi_info, ompi_info_t);
opal_info_t *opal_info = &(ompi_info.super);
opal_info_dup (info, &opal_info);

OPAL_THREAD_LOCK (&mca_io_romio341_mutex);
ret = ROMIO_PREFIX(MPI_File_delete)(filename, ompi_info);
ret = ROMIO_PREFIX(MPI_File_delete)(filename, &ompi_info);
OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex);

ompi_info_free(&ompi_info);
OBJ_DESTRUCT(&ompi_info);
return ret;
}

Expand Down
22 changes: 10 additions & 12 deletions ompi/mca/io/romio341/src/io_romio341_file_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,18 @@ mca_io_romio341_file_open (ompi_communicator_t *comm,
// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call
// below with an MPI_Info, we need to create an equivalent MPI_Info. This
// isn't ideal but it only happens a few places.
ompi_info_t *ompi_info;
ompi_info = OBJ_NEW(ompi_info_t);
if (!ompi_info) { return(MPI_ERR_NO_MEM); }
opal_info_t *opal_info = &(ompi_info->super);
ompi_info_t ompi_info;
OBJ_CONSTRUCT(&ompi_info, ompi_info_t);
opal_info_t *opal_info = &(ompi_info.super);
opal_info_dup (info, &opal_info);

data = (mca_io_romio341_data_t *) fh->f_io_selected_data;
// OPAL_THREAD_LOCK (&mca_io_romio341_mutex);
ret = ROMIO_PREFIX(MPI_File_open)(comm, filename, amode, ompi_info,
ret = ROMIO_PREFIX(MPI_File_open)(comm, filename, amode, &ompi_info,
&data->romio_fh);
// OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex);

ompi_info_free(&ompi_info);
OBJ_DESTRUCT(&ompi_info);
return ret;
}

Expand Down Expand Up @@ -206,20 +205,19 @@ mca_io_romio341_file_set_view (ompi_file_t *fh,
// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call
// below with an MPI_Info, we need to create an equivalent MPI_Info. This
// isn't ideal but it only happens a few places.
ompi_info_t *ompi_info;
ompi_info = OBJ_NEW(ompi_info_t);
if (!ompi_info) { return(MPI_ERR_NO_MEM); }
opal_info_t *opal_info = &(ompi_info->super);
ompi_info_t ompi_info;
OBJ_CONSTRUCT(&ompi_info, ompi_info_t);
opal_info_t *opal_info = &(ompi_info.super);
opal_info_dup (info, &opal_info);

data = (mca_io_romio341_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio341_mutex);
ret =
ROMIO_PREFIX(MPI_File_set_view) (data->romio_fh, disp, etype, filetype,
datarep, ompi_info);
datarep, &ompi_info);
OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex);

ompi_info_free(&ompi_info);
OBJ_DESTRUCT(&ompi_info);
return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/c/info_dup.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo) {
}
}

*newinfo = OBJ_NEW(ompi_info_t);
*newinfo = ompi_info_allocate();
if (NULL == *newinfo) {
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_NO_MEM,
FUNC_NAME);
Expand Down