Skip to content
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
10 changes: 6 additions & 4 deletions ompi/mca/fs/ufs/fs_ufs_file_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ mca_fs_ufs_file_open (struct ompi_communicator_t *comm,

if ( 0 == rank ) {
/* MODE_CREATE and MODE_EXCL can only be set by one process */
if ( access_mode & MPI_MODE_CREATE )
amode = amode | O_CREAT;
if (access_mode & MPI_MODE_EXCL)
amode = amode | O_EXCL;
if ( !(fh->f_flags & OMPIO_SHAREDFP_IS_SET)) {
if ( access_mode & MPI_MODE_CREATE )
amode = amode | O_CREAT;
if (access_mode & MPI_MODE_EXCL)
amode = amode | O_EXCL;
}
fh->fd = open (filename, amode, perm);
ret = fh->fd;
}
Expand Down
54 changes: 25 additions & 29 deletions ompi/mca/io/ompio/io_ompio_file_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ ompio_io_ompio_file_open (ompi_communicator_t *comm,
/* No need to duplicate the communicator if the file_open is called
from the sharedfp component, since the comm used as an input
is already a dup of the user level comm. */
ompio_fh->f_flags |= OMPIO_SHAREDFP_IS_SET;
ompio_fh->f_comm = comm;
}

Expand Down Expand Up @@ -195,26 +194,9 @@ ompio_io_ompio_file_open (ompi_communicator_t *comm,
** function will return an error code.
*/
}

/* open the file once more for the shared file pointer if required.
** Can be disabled by the user if no shared file pointer operations
** are used by his application.
*/
if ( NULL != ompio_fh->f_sharedfp &&
true == use_sharedfp &&
(!mca_io_ompio_sharedfp_lazy_open ||
!strcmp (ompio_fh->f_sharedfp_component->mca_component_name,
"addproc") )) {
ret = ompio_fh->f_sharedfp->sharedfp_file_open(comm,
filename,
amode,
info,
ompio_fh);

if ( OMPI_SUCCESS != ret ) {
goto fn_fail;
}
}
}
else {
ompio_fh->f_flags |= OMPIO_SHAREDFP_IS_SET;
}

/*Determine topology information if set*/
Expand All @@ -231,15 +213,31 @@ ompio_io_ompio_file_open (ompi_communicator_t *comm,
info,
ompio_fh);




if ( OMPI_SUCCESS != ret ) {
ret = MPI_ERR_FILE;
goto fn_fail;
}


if ( true == use_sharedfp ) {
/* open the file once more for the shared file pointer if required.
** Can be disabled by the user if no shared file pointer operations
** are used by his application.
*/
if ( NULL != ompio_fh->f_sharedfp &&
!mca_io_ompio_sharedfp_lazy_open ) {
ret = ompio_fh->f_sharedfp->sharedfp_file_open(comm,
filename,
amode,
info,
ompio_fh);

if ( OMPI_SUCCESS != ret ) {
goto fn_fail;
}
}
}

/* If file has been opened in the append mode, move the internal
file pointer of OMPIO to the very end of the file. */
if ( ompio_fh->f_amode & MPI_MODE_APPEND ) {
Expand All @@ -251,16 +249,14 @@ ompio_io_ompio_file_open (ompi_communicator_t *comm,
ompi_io_ompio_set_explicit_offset (ompio_fh, current_size);
if ( true == use_sharedfp ) {
if ( NULL != ompio_fh->f_sharedfp &&
(!mca_io_ompio_sharedfp_lazy_open ||
!strcmp (ompio_fh->f_sharedfp_component->mca_component_name,
"addproc") )) {
!mca_io_ompio_sharedfp_lazy_open ) {

shared_fp_base_module = ompio_fh->f_sharedfp;
ret = shared_fp_base_module->sharedfp_seek(ompio_fh,current_size, MPI_SEEK_SET);
}
else {
opal_output(1, "mca_common_ompio_file_open: Could not adjust position of "
"shared file pointer whith MPI_MODE_APPEND\n");
"shared file pointer with MPI_MODE_APPEND\n");
ret = MPI_ERR_OTHER;
goto fn_fail;
}
Expand Down Expand Up @@ -412,7 +408,7 @@ ompio_io_ompio_file_close (mca_io_ompio_file_t *ompio_fh)
}


if (MPI_COMM_NULL != ompio_fh->f_comm && (ompio_fh->f_flags & OMPIO_SHAREDFP_IS_SET) ) {
if (MPI_COMM_NULL != ompio_fh->f_comm && !(ompio_fh->f_flags & OMPIO_SHAREDFP_IS_SET) ) {
ompi_comm_free (&ompio_fh->f_comm);
}

Expand Down
10 changes: 7 additions & 3 deletions ompi/mca/io/ompio/io_ompio_file_set_view.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2016 University of Houston. All rights reserved.
* Copyright (c) 2008-2017 University of Houston. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
Expand Down Expand Up @@ -98,8 +98,12 @@ int mca_io_ompio_set_view_internal(mca_io_ompio_file_t *fh,
}

/* Reset the flags first */
fh->f_flags = 0;

if ( fh->f_flags & OMPIO_CONTIGUOUS_FVIEW ) {
fh->f_flags &= ~OMPIO_CONTIGUOUS_FVIEW;
}
if ( fh->f_flags & OMPIO_UNIFORM_FVIEW ) {
fh->f_flags &= ~OMPIO_UNIFORM_FVIEW;
}
fh->f_flags |= OMPIO_FILE_VIEW_IS_SET;
fh->f_datarep = strdup (datarep);
datatype_duplicate (filetype, &fh->f_orig_filetype );
Expand Down