Skip to content

Commit bb15224

Browse files
authored
Merge pull request #5286 from edgargabriel/topic/sharedfp-revamp
sharedfp/all components: revamp internal operations
2 parents 733cac8 + bc0f60d commit bb15224

30 files changed

+516
-885
lines changed

ompi/mca/common/ompio/common_ompio_file_open.c

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ static mca_common_ompio_generate_current_file_view_fn_t generate_current_file_vi
4545
static mca_common_ompio_get_mca_parameter_value_fn_t get_mca_parameter_value_fn;
4646

4747
int mca_common_ompio_file_open (ompi_communicator_t *comm,
48-
const char *filename,
49-
int amode,
50-
opal_info_t *info,
51-
ompio_file_t *ompio_fh, bool use_sharedfp)
48+
const char *filename,
49+
int amode,
50+
opal_info_t *info,
51+
ompio_file_t *ompio_fh, bool use_sharedfp)
5252
{
5353
int ret = OMPI_SUCCESS;
5454
int remote_arch;
@@ -92,8 +92,6 @@ int mca_common_ompio_file_open (ompi_communicator_t *comm,
9292
ompio_fh->f_fstype = NONE;
9393
ompio_fh->f_amode = amode;
9494
ompio_fh->f_info = info;
95-
ompio_fh->f_atomicity = 0;
96-
ompio_fh->f_fs_block_size = 4096;
9795

9896
/* set some function pointers required for fcoll, fbtls and sharedfp modules*/
9997
ompio_fh->f_generate_current_file_view=generate_current_file_view_fn;
@@ -164,20 +162,22 @@ int mca_common_ompio_file_open (ompi_communicator_t *comm,
164162
#endif
165163
goto fn_fail;
166164
}
167-
168-
if (OMPI_SUCCESS != (ret = mca_fcoll_base_file_select (ompio_fh,
169-
NULL))) {
170-
opal_output(1, "mca_fcoll_base_file_select() failed\n");
171-
goto fn_fail;
172-
}
173165

166+
/* Set default file view */
167+
mca_common_ompio_set_view(ompio_fh,
168+
0,
169+
&ompi_mpi_byte.dt,
170+
&ompi_mpi_byte.dt,
171+
"native",
172+
info);
173+
174+
174175
if ( true == use_sharedfp ) {
175176
/* open the file once more for the shared file pointer if required.
176177
** Can be disabled by the user if no shared file pointer operations
177178
** are used by his application.
178179
*/
179-
if ( NULL != ompio_fh->f_sharedfp &&
180-
!OMPIO_MCA_GET(ompio_fh, sharedfp_lazy_open) ) {
180+
if ( NULL != ompio_fh->f_sharedfp ) {
181181
ret = ompio_fh->f_sharedfp->sharedfp_file_open(comm,
182182
filename,
183183
amode,
@@ -201,8 +201,7 @@ int mca_common_ompio_file_open (ompi_communicator_t *comm,
201201
&current_size);
202202
mca_common_ompio_set_explicit_offset (ompio_fh, current_size);
203203
if ( true == use_sharedfp ) {
204-
if ( NULL != ompio_fh->f_sharedfp &&
205-
!OMPIO_MCA_GET(ompio_fh, sharedfp_lazy_open) ) {
204+
if ( NULL != ompio_fh->f_sharedfp ) {
206205
shared_fp_base_module = ompio_fh->f_sharedfp;
207206
ret = shared_fp_base_module->sharedfp_seek(ompio_fh,current_size, MPI_SEEK_SET);
208207
if ( MPI_SUCCESS != ret ) {
@@ -346,6 +345,7 @@ int mca_common_ompio_file_close (ompio_file_t *ompio_fh)
346345

347346
if (MPI_DATATYPE_NULL != ompio_fh->f_iov_type) {
348347
ompi_datatype_destroy (&ompio_fh->f_iov_type);
348+
ompio_fh->f_iov_type=MPI_DATATYPE_NULL;
349349
}
350350

351351
if ( MPI_DATATYPE_NULL != ompio_fh->f_etype ) {
@@ -409,7 +409,8 @@ int mca_common_ompio_set_file_defaults (ompio_file_t *fh)
409409
fh->f_perm = OMPIO_PERM_NULL;
410410
fh->f_flags = 0;
411411
fh->f_bytes_per_agg = OMPIO_MCA_GET(fh, bytes_per_agg);
412-
fh->f_datarep = strdup ("native");
412+
fh->f_atomicity = 0;
413+
fh->f_fs_block_size = 4096;
413414

414415
fh->f_offset = 0;
415416
fh->f_disp = 0;
@@ -434,17 +435,10 @@ int mca_common_ompio_set_file_defaults (ompio_file_t *fh)
434435
fh->f_stripe_size = 0;
435436
/*Decoded iovec of the file-view*/
436437
fh->f_decoded_iov = NULL;
437-
fh->f_etype = NULL;
438-
fh->f_filetype = NULL;
439-
fh->f_orig_filetype = NULL;
440-
441-
mca_common_ompio_set_view(fh,
442-
0,
443-
&ompi_mpi_byte.dt,
444-
&ompi_mpi_byte.dt,
445-
"native",
446-
fh->f_info);
447-
438+
fh->f_etype = MPI_DATATYPE_NULL;
439+
fh->f_filetype = MPI_DATATYPE_NULL;
440+
fh->f_orig_filetype = MPI_DATATYPE_NULL;
441+
fh->f_datarep = NULL;
448442

449443
/*Create a derived datatype for the created iovec */
450444
types[0] = &ompi_mpi_long.dt;

ompi/mca/common/ompio/common_ompio_file_view.c

Lines changed: 5 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-2017 University of Houston. All rights reserved.
12+
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
1313
* Copyright (c) 2017-2018 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* Copyright (c) 2017 IBM Corporation. All rights reserved.
@@ -281,6 +281,10 @@ int mca_common_ompio_set_view (ompio_file_t *fh,
281281
goto exit;
282282
}
283283

284+
if ( NULL != fh->f_sharedfp ) {
285+
ret = fh->f_sharedfp->sharedfp_seek( fh, 0, MPI_SEEK_SET);
286+
}
287+
284288
exit:
285289
for( i = 0; i < fh->f_size; i++){
286290
free(contg_groups[i].procs_in_contg_group);

ompi/mca/fs/lustre/fs_lustre_file_open.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,10 @@ mca_fs_lustre_file_open (struct ompi_communicator_t *comm,
115115
errno = 0;
116116
if (0 == fh->f_rank) {
117117
/* MODE_CREATE and MODE_EXCL can only be set by one process */
118-
if ( !(fh->f_flags & OMPIO_SHAREDFP_IS_SET)) {
119-
if ( access_mode & MPI_MODE_CREATE )
120-
amode = amode | O_CREAT;
121-
if (access_mode & MPI_MODE_EXCL)
122-
amode = amode | O_EXCL;
123-
}
118+
if ( access_mode & MPI_MODE_CREATE )
119+
amode = amode | O_CREAT;
120+
if (access_mode & MPI_MODE_EXCL)
121+
amode = amode | O_EXCL;
124122

125123
if ( (fs_lustre_stripe_size>0 || fs_lustre_stripe_width>0) &&
126124
( amode&O_CREAT) &&

ompi/mca/fs/ufs/fs_ufs_file_open.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,11 @@ mca_fs_ufs_file_open (struct ompi_communicator_t *comm,
7676
errno = 0;
7777
if ( 0 == rank ) {
7878
/* MODE_CREATE and MODE_EXCL can only be set by one process */
79-
if ( !(fh->f_flags & OMPIO_SHAREDFP_IS_SET)) {
80-
if ( access_mode & MPI_MODE_CREATE )
81-
amode = amode | O_CREAT;
82-
if (access_mode & MPI_MODE_EXCL)
83-
amode = amode | O_EXCL;
84-
}
79+
if ( access_mode & MPI_MODE_CREATE )
80+
amode = amode | O_CREAT;
81+
if (access_mode & MPI_MODE_EXCL)
82+
amode = amode | O_EXCL;
83+
8584
fh->fd = open (filename, amode, perm);
8685
if ( 0 > fh->fd ) {
8786
if ( EACCES == errno ) {

ompi/mca/io/ompio/io_ompio.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2008-2016 University of Houston. All rights reserved.
13+
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
1414
* Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved.
1515
* Copyright (c) 2012-2013 Inria. All rights reserved.
1616
* Copyright (c) 2015-2018 Research Organization for Information Science
@@ -542,9 +542,6 @@ int mca_io_ompio_get_mca_parameter_value ( char *mca_parameter_name, int name_le
542542
else if ( !strncmp ( mca_parameter_name, "grouping_option", name_length )) {
543543
return mca_io_ompio_grouping_option;
544544
}
545-
else if ( !strncmp ( mca_parameter_name, "sharedfp_lazy_open", name_length )) {
546-
return mca_io_ompio_sharedfp_lazy_open;
547-
}
548545
else if ( !strncmp ( mca_parameter_name, "coll_timing_info", name_length )) {
549546
return mca_io_ompio_coll_timing_info;
550547
}

ompi/mca/io/ompio/io_ompio.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ extern int mca_io_ompio_cycle_buffer_size;
4848
extern int mca_io_ompio_bytes_per_agg;
4949
extern int mca_io_ompio_num_aggregators;
5050
extern int mca_io_ompio_record_offset_info;
51-
extern int mca_io_ompio_sharedfp_lazy_open;
5251
extern int mca_io_ompio_grouping_option;
5352
extern int mca_io_ompio_max_aggregators_ratio;
5453
extern int mca_io_ompio_aggregators_cutoff_threshold;

ompi/mca/io/ompio/io_ompio_component.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ int mca_io_ompio_bytes_per_agg = OMPIO_PREALLOC_MAX_BUF_SIZE;
3939
int mca_io_ompio_num_aggregators = -1;
4040
int mca_io_ompio_record_offset_info = 0;
4141
int mca_io_ompio_coll_timing_info = 0;
42-
int mca_io_ompio_sharedfp_lazy_open = 0;
4342
int mca_io_ompio_max_aggregators_ratio=8;
4443
int mca_io_ompio_aggregators_cutoff_threshold=3;
4544
int mca_io_ompio_overwrite_amode = 1;
@@ -194,15 +193,6 @@ static int register_component(void)
194193
&mca_io_ompio_num_aggregators);
195194

196195

197-
mca_io_ompio_sharedfp_lazy_open = 0;
198-
(void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
199-
"sharedfp_lazy_open",
200-
"lazy allocation of internal shared file pointer structures",
201-
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
202-
OPAL_INFO_LVL_9,
203-
MCA_BASE_VAR_SCOPE_READONLY,
204-
&mca_io_ompio_sharedfp_lazy_open);
205-
206196
mca_io_ompio_grouping_option = 5;
207197
(void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
208198
"grouping_option",

ompi/mca/io/ompio/io_ompio_file_set_view.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ int mca_io_ompio_file_set_view (ompi_file_t *fp,
6565
int ret=OMPI_SUCCESS;
6666
mca_common_ompio_data_t *data;
6767
ompio_file_t *fh;
68-
ompio_file_t *sh;
6968

7069
data = (mca_common_ompio_data_t *) fp->f_io_selected_data;
7170

@@ -76,12 +75,6 @@ int mca_io_ompio_file_set_view (ompi_file_t *fp,
7675

7776
OPAL_THREAD_LOCK(&fp->f_lock);
7877
ret = mca_common_ompio_set_view(fh, disp, etype, filetype, datarep, info);
79-
80-
if ( NULL != fh->f_sharedfp_data) {
81-
sh = ((struct mca_sharedfp_base_data_t *)fh->f_sharedfp_data)->sharedfh;
82-
ret = mca_common_ompio_set_view(sh, disp, etype, filetype, datarep, info);
83-
}
84-
8578
OPAL_THREAD_UNLOCK(&fp->f_lock);
8679
return ret;
8780
}

ompi/mca/sharedfp/individual/sharedfp_individual.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ typedef struct mca_sharedfp_individual_header_record_s{
139139

140140
mca_sharedfp_individual_header_record* mca_sharedfp_individual_insert_headnode(void);
141141

142-
int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh);
142+
int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh, ompio_file_t *ompio_fh );
143143
int mca_sharedfp_individual_get_timestamps_and_reclengths(double **buff, long **rec_length, MPI_Offset **offbuff,struct mca_sharedfp_base_data_t *sh);
144144
int mca_sharedfp_individual_create_buff(double **ts,MPI_Offset **off,int totalnodes,int size);
145145
int mca_sharedfp_individual_sort_timestamps(double **ts,MPI_Offset **off, int **ranks, int totalnodes);

0 commit comments

Comments
 (0)