Skip to content

Commit a40a132

Browse files
committed
Merge pull request open-mpi#495 from edgargabriel/pr/performance-tuning-2
Pr/performance tuning 2
2 parents 60d5125 + 318c06a commit a40a132

13 files changed

+111
-23
lines changed

ompi/mca/fcoll/base/fcoll_base_file_select.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ int mca_fcoll_base_query_table (struct mca_io_ompio_file_t *file, char *name)
262262
file->f_cc_size >= file->f_stripe_size) {
263263
return 1;
264264
}
265+
if ( 2 >= (int)file->f_size ){
266+
return 1;
267+
}
265268
}
266269
if (!strcmp (name, "dynamic")) {
267270
if ((int)file->f_cc_size < file->f_bytes_per_agg &&

ompi/mca/fcoll/individual/fcoll_individual_module.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ mca_fcoll_individual_component_file_query (mca_io_ompio_file_t *fh, int *priorit
6464
if (*priority < 50) {
6565
*priority = 50;
6666
}
67+
if ( 2 >= fh->f_size ) {
68+
*priority = 100;
69+
}
6770
}
6871

6972
return &individual;

ompi/mca/io/ompio/io_ompio.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ static int mca_io_ompio_merge_groups(mca_io_ompio_file_t *fh,
102102
int num_merge_aggrs);
103103

104104

105-
106105
int ompi_io_ompio_set_file_defaults (mca_io_ompio_file_t *fh)
107106
{
108107

@@ -133,15 +132,16 @@ int ompi_io_ompio_set_file_defaults (mca_io_ompio_file_t *fh)
133132
fh->f_init_num_aggrs = -1;
134133
fh->f_init_aggr_list = NULL;
135134

136-
ompi_datatype_create_contiguous(1048576,
135+
ompi_datatype_create_contiguous(MCA_IO_DEFAULT_FILE_VIEW_SIZE,
137136
&ompi_mpi_byte.dt,
138137
&default_file_view);
139138
ompi_datatype_commit (&default_file_view);
140139

141140
fh->f_etype = &ompi_mpi_byte.dt;
142141
fh->f_filetype = default_file_view;
143-
144-
142+
ompi_datatype_duplicate ( &ompi_mpi_byte.dt, &fh->f_orig_filetype );
143+
144+
145145
/* Default file View */
146146
fh->f_iov_type = MPI_DATATYPE_NULL;
147147
fh->f_stripe_size = mca_io_ompio_bytes_per_agg;

ompi/mca/io/ompio/io_ompio.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ OMPI_DECLSPEC extern int mca_io_ompio_coll_timing_info;
5757
#define OMPIO_CONTIGUOUS_FVIEW 0x00000010
5858
#define OMPIO_AGGREGATOR_IS_SET 0x00000020
5959
#define OMPIO_SHAREDFP_IS_SET 0x00000040
60+
6061
#define QUEUESIZE 2048
62+
#define MCA_IO_DEFAULT_FILE_VIEW_SIZE 4*1024*1024
6163

6264
#define OMPIO_MIN(a, b) (((a) < (b)) ? (a) : (b))
6365
#define OMPIO_MAX(a, b) (((a) < (b)) ? (b) : (a))
@@ -320,6 +322,7 @@ struct mca_io_ompio_file_t {
320322
size_t f_view_size;
321323
ompi_datatype_t *f_etype;
322324
ompi_datatype_t *f_filetype;
325+
ompi_datatype_t *f_orig_filetype; /* the fileview passed by the user to us */
323326
size_t f_etype_size;
324327

325328
/* contains IO requests that needs to be read/written */

ompi/mca/io/ompio/io_ompio_component.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "ompi/mca/io/io.h"
3232
#include "io_ompio.h"
3333

34-
int mca_io_ompio_cycle_buffer_size = OMPIO_PREALLOC_MAX_BUF_SIZE;
34+
int mca_io_ompio_cycle_buffer_size = -1;
3535
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;
@@ -162,10 +162,10 @@ static int register_component(void)
162162
MCA_BASE_VAR_SCOPE_READONLY,
163163
&mca_io_ompio_coll_timing_info);
164164

165-
mca_io_ompio_cycle_buffer_size = OMPIO_PREALLOC_MAX_BUF_SIZE;
165+
mca_io_ompio_cycle_buffer_size = -1;
166166
(void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
167167
"cycle_buffer_size",
168-
"Cycle buffer size of individual reads/writes",
168+
"Data size issued by individual reads/writes per call",
169169
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
170170
OPAL_INFO_LVL_9,
171171
MCA_BASE_VAR_SCOPE_READONLY,

ompi/mca/io/ompio/io_ompio_file_open.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,18 @@ ompio_io_ompio_file_close (mca_io_ompio_file_t *ompio_fh)
380380
ompi_datatype_destroy (&ompio_fh->f_iov_type);
381381
}
382382

383+
if ( MPI_DATATYPE_NULL != ompio_fh->f_etype ) {
384+
ompi_datatype_destroy (&ompio_fh->f_etype);
385+
}
386+
if ( MPI_DATATYPE_NULL != ompio_fh->f_filetype ){
387+
ompi_datatype_destroy (&ompio_fh->f_filetype);
388+
}
389+
390+
if ( MPI_DATATYPE_NULL != ompio_fh->f_orig_filetype ){
391+
ompi_datatype_destroy (&ompio_fh->f_orig_filetype);
392+
}
393+
394+
383395
if (MPI_COMM_NULL != ompio_fh->f_comm && (ompio_fh->f_flags & OMPIO_SHAREDFP_IS_SET) ) {
384396
ompi_comm_free (&ompio_fh->f_comm);
385397
}

ompi/mca/io/ompio/io_ompio_file_read.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,12 @@ int ompio_io_ompio_file_read (mca_io_ompio_file_t *fh,
106106
&decoded_iov,
107107
&iov_count);
108108

109-
bytes_per_cycle = mca_io_ompio_cycle_buffer_size;
109+
if ( -1 == mca_io_ompio_cycle_buffer_size ) {
110+
bytes_per_cycle = max_data;
111+
}
112+
else {
113+
bytes_per_cycle = mca_io_ompio_cycle_buffer_size;
114+
}
110115
cycles = ceil((float)max_data/bytes_per_cycle);
111116

112117
#if 0

ompi/mca/io/ompio/io_ompio_file_set_view.c

Lines changed: 37 additions & 10 deletions
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-2014 University of Houston. All rights reserved.
12+
* Copyright (c) 2008-2015 University of Houston. All rights reserved.
1313
* Copyright (c) 2015 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* $COPYRIGHT$
@@ -135,10 +135,16 @@ int mca_io_ompio_file_set_view (ompi_file_t *fp,
135135
{
136136
mca_io_ompio_data_t *data;
137137
mca_io_ompio_file_t *fh;
138+
size_t ftype_size;
139+
OPAL_PTRDIFF_TYPE ftype_extent, lb;
138140

139141
data = (mca_io_ompio_data_t *) fp->f_io_selected_data;
140142
fh = &data->ompio_fh;
141-
143+
144+
ompi_datatype_destroy (&fh->f_etype);
145+
ompi_datatype_destroy (&fh->f_filetype);
146+
ompi_datatype_destroy (&fh->f_orig_filetype);
147+
142148
if (NULL != fh->f_decoded_iov) {
143149
free (fh->f_decoded_iov);
144150
fh->f_decoded_iov = NULL;
@@ -154,14 +160,35 @@ int mca_io_ompio_file_set_view (ompi_file_t *fp,
154160

155161
fh->f_flags |= OMPIO_FILE_VIEW_IS_SET;
156162
fh->f_datarep = strdup (datarep);
157-
158-
mca_io_ompio_set_view_internal (fh,
159-
disp,
160-
etype,
161-
filetype,
162-
datarep,
163-
info);
163+
ompi_datatype_duplicate (filetype, &fh->f_orig_filetype );
164164

165+
opal_datatype_get_extent(&filetype->super, &lb, &ftype_extent);
166+
opal_datatype_type_size (&filetype->super, &ftype_size);
167+
168+
if ( etype == filetype &&
169+
ompi_datatype_is_predefined (filetype ) &&
170+
ftype_extent == (OPAL_PTRDIFF_TYPE)ftype_size ){
171+
ompi_datatype_t *newfiletype;
172+
ompi_datatype_create_contiguous(MCA_IO_DEFAULT_FILE_VIEW_SIZE,
173+
&ompi_mpi_byte.dt,
174+
&newfiletype);
175+
ompi_datatype_commit (&newfiletype);
176+
mca_io_ompio_set_view_internal (fh,
177+
disp,
178+
etype,
179+
newfiletype,
180+
datarep,
181+
info);
182+
ompi_datatype_destroy ( &newfiletype );
183+
}
184+
else {
185+
mca_io_ompio_set_view_internal (fh,
186+
disp,
187+
etype,
188+
filetype,
189+
datarep,
190+
info);
191+
}
165192

166193
if (OMPI_SUCCESS != mca_fcoll_base_file_select (&data->ompio_fh,
167194
NULL)) {
@@ -186,7 +213,7 @@ int mca_io_ompio_file_get_view (struct ompi_file_t *fp,
186213

187214
*disp = fh->f_disp;
188215
ompi_datatype_duplicate (fh->f_etype, etype);
189-
ompi_datatype_duplicate (fh->f_filetype, filetype);
216+
ompi_datatype_duplicate (fh->f_orig_filetype, filetype);
190217
strcpy (datarep, fh->f_datarep);
191218

192219
return OMPI_SUCCESS;

ompi/mca/io/ompio/io_ompio_file_write.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,12 @@ int ompio_io_ompio_file_write (mca_io_ompio_file_t *fh,
103103
&decoded_iov,
104104
&iov_count);
105105

106-
bytes_per_cycle = mca_io_ompio_cycle_buffer_size;
106+
if ( -1 == mca_io_ompio_cycle_buffer_size ) {
107+
bytes_per_cycle = max_data;
108+
}
109+
else {
110+
bytes_per_cycle = mca_io_ompio_cycle_buffer_size;
111+
}
107112
cycles = ceil((float)max_data/bytes_per_cycle);
108113

109114
#if 0

ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm,
5959
if ( NULL == sh ){
6060
opal_output(0, "mca_sharedfp_individual_file_open: Error, unable to malloc "
6161
"f_sharedfp_ptr struct\n");
62+
free (shfileHandle );
6263
return OMPI_ERR_OUT_OF_RESOURCE;
6364
}
6465

@@ -93,6 +94,8 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm,
9394
MPI_INFO_NULL, datafilehandle, false);
9495
if ( OMPI_SUCCESS != err) {
9596
opal_output(0, "mca_sharedfp_individual_file_open: Error during datafile file open\n");
97+
free (shfileHandle );
98+
free (sh);
9699
return err;
97100
}
98101

@@ -105,15 +108,32 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm,
105108
}
106109

107110
/* metadata filename created by appending .metadata.$rank to the original filename*/
108-
metadatafilename = (char*) malloc ( len );
111+
metadatafilename = (char*) malloc ( len );
112+
if ( NULL == metadatafilename ) {
113+
free (shfileHandle );
114+
free (sh);
115+
opal_output(0, "mca_sharedfp_individual_file_open: Error during memory allocation\n");
116+
return OMPI_ERR_OUT_OF_RESOURCE;
117+
}
109118
snprintf ( metadatafilename, len, "%s%s%d", filename, ".metadata.",rank);
110119

111120
metadatafilehandle = (mca_io_ompio_file_t *)malloc(sizeof(mca_io_ompio_file_t));
121+
if ( NULL == metadatafilehandle ) {
122+
free (shfileHandle );
123+
free (sh);
124+
free (metadatafilename);
125+
opal_output(0, "mca_sharedfp_individual_file_open: Error during memory allocation\n");
126+
return OMPI_ERR_OUT_OF_RESOURCE;
127+
}
112128
err = ompio_io_ompio_file_open ( MPI_COMM_SELF,metadatafilename,
113129
MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE,
114130
MPI_INFO_NULL, metadatafilehandle, false);
115131
if ( OMPI_SUCCESS != err) {
116132
opal_output(0, "mca_sharedfp_individual_file_open: Error during metadatafile file open\n");
133+
free (shfileHandle );
134+
free (sh);
135+
free (metadatafilename);
136+
free (metadatafilehandle);
117137
return err;
118138
}
119139

0 commit comments

Comments
 (0)