Skip to content

Commit 2215f29

Browse files
authored
Merge pull request #2783 from edgargabriel/pr/sharedfp-append-fix
Pr/sharedfp append fix
2 parents a61f7bd + 3eae0ee commit 2215f29

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

ompi/mca/common/ompio/common_ompio_file_open.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2008-2016 University of Houston. All rights reserved.
12+
* Copyright (c) 2008-2017 University of Houston. All rights reserved.
1313
* Copyright (c) 2015 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
@@ -204,10 +204,28 @@ int mca_common_ompio_file_open (ompi_communicator_t *comm,
204204
file pointer of OMPIO to the very end of the file. */
205205
if ( ompio_fh->f_amode & MPI_MODE_APPEND ) {
206206
OMPI_MPI_OFFSET_TYPE current_size;
207+
mca_sharedfp_base_module_t * shared_fp_base_module;
207208

208209
ompio_fh->f_fs->fs_file_get_size( ompio_fh,
209210
&current_size);
210211
mca_common_ompio_set_explicit_offset (ompio_fh, current_size);
212+
if ( true == use_sharedfp ) {
213+
if ( NULL != ompio_fh->f_sharedfp &&
214+
(!mca_io_ompio_sharedfp_lazy_open ||
215+
!strcmp (ompio_fh->f_sharedfp_component->mca_component_name,
216+
"addproc") )) {
217+
218+
shared_fp_base_module = ompio_fh->f_sharedfp;
219+
ret = shared_fp_base_module->sharedfp_seek(ompio_fh,current_size, MPI_SEEK_SET);
220+
}
221+
else {
222+
opal_output(1, "mca_common_ompio_file_open: Could not adjust position of "
223+
"shared file pointer whith MPI_MODE_APPEND\n");
224+
ret = MPI_ERR_OTHER;
225+
goto fn_fail;
226+
}
227+
}
228+
211229
}
212230

213231

ompi/mca/io/ompio/io_ompio_component.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ int mca_io_ompio_bytes_per_agg = OMPIO_PREALLOC_MAX_BUF_SIZE;
3636
int mca_io_ompio_num_aggregators = -1;
3737
int mca_io_ompio_record_offset_info = 0;
3838
int mca_io_ompio_coll_timing_info = 0;
39-
int mca_io_ompio_sharedfp_lazy_open = 1;
39+
int mca_io_ompio_sharedfp_lazy_open = 0;
4040

4141
int mca_io_ompio_grouping_option=5;
4242

@@ -193,7 +193,7 @@ static int register_component(void)
193193
&mca_io_ompio_num_aggregators);
194194

195195

196-
mca_io_ompio_sharedfp_lazy_open = 1;
196+
mca_io_ompio_sharedfp_lazy_open = 0;
197197
(void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
198198
"sharedfp_lazy_open",
199199
"lazy allocation of internal shared file pointer structures",

0 commit comments

Comments
 (0)