Skip to content

Commit 642656a

Browse files
committed
io/romio: do not use removed functions
This commit attempts to update the romio io component to not use functions removed in MPI-3.0 (2012). This is a first cut and will probably need to be reviewed for correctness. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent 9a38ba5 commit 642656a

26 files changed

+138
-146
lines changed

ompi/mca/io/romio314/romio/adio/ad_nfs/ad_nfs_read.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
164164
ADIO_Offset abs_off_in_filetype=0;
165165
int req_len, partial_read;
166166
MPI_Count filetype_size, etype_size, buftype_size;
167-
MPI_Aint filetype_extent, buftype_extent;
167+
MPI_Aint filetype_extent, buftype_extent, lb;
168168
int buf_count, buftype_is_contig, filetype_is_contig;
169169
ADIO_Offset userbuf_off;
170170
ADIO_Offset off, req_off, disp, end_offset=0, readbuf_off, start_off;
@@ -187,9 +187,9 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
187187
return;
188188
}
189189

190-
MPI_Type_extent(fd->filetype, &filetype_extent);
190+
MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent);
191191
MPI_Type_size_x(datatype, &buftype_size);
192-
MPI_Type_extent(datatype, &buftype_extent);
192+
MPI_Type_get_extent(datatype, &lb, &buftype_extent);
193193
etype_size = fd->etype_size;
194194

195195
bufsize = buftype_size * count;

ompi/mca/io/romio314/romio/adio/ad_nfs/ad_nfs_write.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count,
267267
ADIO_Offset abs_off_in_filetype=0;
268268
int req_len;
269269
MPI_Count filetype_size, etype_size, buftype_size;
270-
MPI_Aint filetype_extent, buftype_extent;
270+
MPI_Aint filetype_extent, buftype_extent, lb;
271271
int buf_count, buftype_is_contig, filetype_is_contig;
272272
ADIO_Offset userbuf_off;
273273
ADIO_Offset off, req_off, disp, end_offset=0, writebuf_off, start_off;
@@ -289,9 +289,9 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count,
289289
return;
290290
}
291291

292-
MPI_Type_extent(fd->filetype, &filetype_extent);
292+
MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent);
293293
MPI_Type_size_x(datatype, &buftype_size);
294-
MPI_Type_extent(datatype, &buftype_extent);
294+
MPI_Type_get_extent(datatype, &lb, &buftype_extent);
295295
etype_size = fd->etype_size;
296296

297297
bufsize = buftype_size * count;

ompi/mca/io/romio314/romio/adio/ad_testfs/ad_testfs_seek.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ADIO_Offset ADIOI_TESTFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset,
3030
int size_in_filetype;
3131
int filetype_is_contig;
3232
MPI_Count filetype_size;
33-
MPI_Aint etype_size, filetype_extent;
33+
MPI_Aint etype_size, filetype_extent, lb;
3434

3535
*error_code = MPI_SUCCESS;
3636

@@ -47,7 +47,7 @@ ADIO_Offset ADIOI_TESTFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset,
4747
flat_file = ADIOI_Flatlist;
4848
while (flat_file->type != fd->filetype) flat_file = flat_file->next;
4949

50-
MPI_Type_extent(fd->filetype, &filetype_extent);
50+
MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent);
5151
MPI_Type_size_x(fd->filetype, &filetype_size);
5252
if ( ! filetype_size ) {
5353
*error_code = MPI_SUCCESS;

ompi/mca/io/romio314/romio/adio/common/ad_aggregate_new.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -237,18 +237,18 @@ void ADIOI_Calc_file_realms_fsize (ADIO_File fd, int nprocs_for_coll,
237237
void ADIOI_Create_fr_simpletype (int size, int nprocs_for_coll,
238238
MPI_Datatype *simpletype)
239239
{
240-
int count=2, blocklens[2];
241-
MPI_Aint indices[2];
242-
MPI_Datatype old_types[2];
240+
int count=1, blocklens[1];
241+
MPI_Aint indices[1];
242+
MPI_Datatype old_types[1];
243+
MPI_Datatype inttype;
243244

244245
blocklens[0] = size;
245-
blocklens[1] = 1;
246246
indices[0] = 0;
247-
indices[1] = size*nprocs_for_coll;
248247
old_types[0] = MPI_BYTE;
249-
old_types[1] = MPI_UB;
250248

251-
MPI_Type_struct (count, blocklens, indices, old_types, simpletype);
249+
MPI_Type_create_struct (count, blocklens, indices, old_types, &inttype);
250+
MPI_Type_create_resized (inttype, 0, size*nprocs_for_coll, simpletype);
251+
MPI_Type_free (&inttype);
252252

253253
MPI_Type_commit (simpletype);
254254
}

ompi/mca/io/romio314/romio/adio/common/ad_coll_build_req_new.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ static inline int get_next_fr_off(ADIO_File fd,
279279
ADIO_Offset *fr_next_off_p,
280280
ADIO_Offset *fr_max_len_p)
281281
{
282-
MPI_Aint fr_extent = -1;
282+
MPI_Aint fr_extent = -1, lb;
283283
ADIO_Offset tmp_off, off_rem;
284284
ADIOI_Flatlist_node *fr_node_p = ADIOI_Flatlist;
285285
int i = -1, fr_dtype_ct = 0;
@@ -299,7 +299,7 @@ static inline int get_next_fr_off(ADIO_File fd,
299299

300300
/* Calculate how many times to loop through the fr_type
301301
* and where the next fr_off is. */
302-
MPI_Type_extent(*fr_type_p, &fr_extent);
302+
MPI_Type_get_extent(*fr_type_p, &lb, &fr_extent);
303303
tmp_off = off - fr_st_off;
304304
fr_dtype_ct = tmp_off / fr_extent;
305305
off_rem = tmp_off % fr_extent;

ompi/mca/io/romio314/romio/adio/common/ad_coll_exch_new.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type,
127127
MPI_Request *send_req_arr = NULL, *recv_req_arr = NULL;
128128
MPI_Status *statuses = NULL;
129129
ADIO_Offset disp_off_sz_ext_typesz[6];
130-
MPI_Aint memtype_extent, filetype_extent;
130+
MPI_Aint memtype_extent, filetype_extent, lb;
131131
int ret = -1;
132132

133133
/* parameters for datatypes */
@@ -143,7 +143,7 @@ void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type,
143143
* freed in the close and should have been flattened in the file
144144
* view. */
145145
MPI_Type_size_x(datatype, &memtype_sz);
146-
MPI_Type_extent(datatype, &memtype_extent);
146+
MPI_Type_get_extent(datatype, &lb, &memtype_extent);
147147
if (memtype_sz == memtype_extent) {
148148
memtype_is_contig = 1;
149149
flat_mem_p = ADIOI_Add_contig_flattened(datatype);
@@ -156,7 +156,7 @@ void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type,
156156
flat_mem_p = flat_mem_p->next;
157157
}
158158

159-
MPI_Type_extent(fd->filetype, &filetype_extent);
159+
MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent);
160160
MPI_Type_size_x(fd->filetype, &filetype_sz);
161161
if (filetype_extent == filetype_sz) {
162162
flat_file_p = ADIOI_Add_contig_flattened(fd->filetype);

ompi/mca/io/romio314/romio/adio/common/ad_darray.c

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ int ADIO_Type_create_darray(int size, int rank, int ndims,
2424
int order, MPI_Datatype oldtype,
2525
MPI_Datatype *newtype)
2626
{
27-
MPI_Datatype type_old, type_new=MPI_DATATYPE_NULL, types[3];
28-
int procs, tmp_rank, i, tmp_size, blklens[3], *coords;
29-
MPI_Aint *st_offsets, orig_extent, disps[3];
27+
MPI_Datatype type_old, type_new=MPI_DATATYPE_NULL, inttype;
28+
int procs, tmp_rank, i, tmp_size, blklen, *coords;
29+
MPI_Aint *st_offsets, orig_extent, disp, ub, lb;
3030

31-
MPI_Type_extent(oldtype, &orig_extent);
31+
MPI_Type_get_extent(oldtype, &lb, &orig_extent);
3232

3333
/* calculate position in Cartesian grid as MPI would (row-major
3434
ordering) */
@@ -77,11 +77,11 @@ int ADIO_Type_create_darray(int size, int rank, int ndims,
7777
}
7878

7979
/* add displacement and UB */
80-
disps[1] = st_offsets[0];
80+
disp = st_offsets[0];
8181
tmp_size = 1;
8282
for (i=1; i<ndims; i++) {
8383
tmp_size *= array_of_gsizes[i-1];
84-
disps[1] += (MPI_Aint)tmp_size*st_offsets[i];
84+
disp += (MPI_Aint)tmp_size*st_offsets[i];
8585
}
8686
/* rest done below for both Fortran and C order */
8787
}
@@ -115,26 +115,24 @@ int ADIO_Type_create_darray(int size, int rank, int ndims,
115115
}
116116

117117
/* add displacement and UB */
118-
disps[1] = st_offsets[ndims-1];
118+
disp = st_offsets[ndims-1];
119119
tmp_size = 1;
120120
for (i=ndims-2; i>=0; i--) {
121121
tmp_size *= array_of_gsizes[i+1];
122-
disps[1] += (MPI_Aint)tmp_size*st_offsets[i];
122+
disp += (MPI_Aint)tmp_size*st_offsets[i];
123123
}
124124
}
125125

126-
disps[1] *= orig_extent;
126+
disp *= orig_extent;
127127

128-
disps[2] = orig_extent;
129-
for (i=0; i<ndims; i++) disps[2] *= (MPI_Aint)array_of_gsizes[i];
128+
ub = orig_extent;
129+
for (i=0; i<ndims; i++) ub *= (MPI_Aint)array_of_gsizes[i];
130130

131-
disps[0] = 0;
132-
blklens[0] = blklens[1] = blklens[2] = 1;
133-
types[0] = MPI_LB;
134-
types[1] = type_new;
135-
types[2] = MPI_UB;
131+
blklen = 1;
136132

137-
MPI_Type_struct(3, blklens, disps, types, newtype);
133+
MPI_Type_create_struct(1, &blklen, &disp, &type_new, &inttype);
134+
MPI_Type_create_resized (inttype, 0, ub, newtype);
135+
MPI_Type_free (&inttype);
138136

139137
MPI_Type_free(&type_new);
140138
ADIOI_Free(st_offsets);
@@ -184,15 +182,15 @@ static int MPIOI_Type_block(int *array_of_gsizes, int dim, int ndims, int nprocs
184182
MPI_Type_contiguous(mysize, type_old, type_new);
185183
else {
186184
for (i=0; i<dim; i++) stride *= (MPI_Aint)array_of_gsizes[i];
187-
MPI_Type_hvector(mysize, 1, stride, type_old, type_new);
185+
MPI_Type_create_hvector(mysize, 1, stride, type_old, type_new);
188186
}
189187
}
190188
else {
191189
if (dim == ndims-1)
192190
MPI_Type_contiguous(mysize, type_old, type_new);
193191
else {
194192
for (i=ndims-1; i>dim; i--) stride *= (MPI_Aint)array_of_gsizes[i];
195-
MPI_Type_hvector(mysize, 1, stride, type_old, type_new);
193+
MPI_Type_create_hvector(mysize, 1, stride, type_old, type_new);
196194
}
197195

198196
}
@@ -217,7 +215,7 @@ static int MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nproc
217215
rank = coordinate of this process in dimension dim */
218216
int blksize, i, blklens[3], st_index, end_index, local_size, rem, count;
219217
MPI_Aint stride, disps[3];
220-
MPI_Datatype type_tmp, types[3];
218+
MPI_Datatype type_tmp, type_tmp1, types[3];
221219

222220
if (darg == MPI_DISTRIBUTE_DFLT_DARG) blksize = 1;
223221
else blksize = darg;
@@ -246,7 +244,7 @@ static int MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nproc
246244
for (i=0; i<dim; i++) stride *= (MPI_Aint)array_of_gsizes[i];
247245
else for (i=ndims-1; i>dim; i--) stride *= (MPI_Aint)array_of_gsizes[i];
248246

249-
MPI_Type_hvector(count, blksize, stride, type_old, type_new);
247+
MPI_Type_create_hvector(count, blksize, stride, type_old, type_new);
250248

251249
if (rem) {
252250
/* if the last block is of size less than blksize, include
@@ -259,7 +257,7 @@ static int MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nproc
259257
blklens[0] = 1;
260258
blklens[1] = rem;
261259

262-
MPI_Type_struct(2, blklens, disps, types, &type_tmp);
260+
MPI_Type_create_struct(2, blklens, disps, types, &type_tmp);
263261

264262
MPI_Type_free(type_new);
265263
*type_new = type_tmp;
@@ -269,14 +267,12 @@ static int MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nproc
269267
dimension correctly. */
270268
if ( ((order == MPI_ORDER_FORTRAN) && (dim == 0)) ||
271269
((order == MPI_ORDER_C) && (dim == ndims-1)) ) {
272-
types[0] = MPI_LB;
273-
disps[0] = 0;
274-
types[1] = *type_new;
275-
disps[1] = (MPI_Aint)rank * (MPI_Aint)blksize * orig_extent;
276-
types[2] = MPI_UB;
277-
disps[2] = orig_extent * (MPI_Aint)array_of_gsizes[dim];
278-
blklens[0] = blklens[1] = blklens[2] = 1;
279-
MPI_Type_struct(3, blklens, disps, types, &type_tmp);
270+
types[0] = *type_new;
271+
disps[0] = (MPI_Aint)rank * (MPI_Aint)blksize * orig_extent;
272+
blklens[0] = 1;
273+
MPI_Type_create_struct(1, blklens, disps, types, &type_tmp1);
274+
MPI_Type_create_resized (type_tmp1, 0, orig_extent * (MPI_Aint)array_of_gsizes[dim], &type_tmp);
275+
MPI_Type_free(&type_tmp1);
280276
MPI_Type_free(type_new);
281277
*type_new = type_tmp;
282278

ompi/mca/io/romio314/romio/adio/common/ad_end.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ int ADIOI_End_call(MPI_Comm comm, int keyval, void *attribute_val, void
7272
ADIOI_UNREFERENCED_ARG(attribute_val);
7373
ADIOI_UNREFERENCED_ARG(extra_state);
7474

75-
MPI_Keyval_free(&keyval);
75+
MPI_Comm_free_keyval (&keyval);
7676

7777
/* The end call will be called after all possible uses of this keyval, even
7878
* if a file was opened with MPI_COMM_SELF. Note, this assumes LIFO
7979
* MPI_COMM_SELF attribute destruction behavior mandated by MPI-2.2. */
8080
if (ADIOI_cb_config_list_keyval != MPI_KEYVAL_INVALID)
81-
MPI_Keyval_free(&ADIOI_cb_config_list_keyval);
81+
MPI_Comm_free_keyval (&ADIOI_cb_config_list_keyval);
8282

8383
ADIO_End(&error_code);
8484
return error_code;

ompi/mca/io/romio314/romio/adio/common/ad_io_coll.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void ADIOI_IOStridedColl (ADIO_File fd, void *buf, int count, int rdwr,
5454
int interleave_count = 0, i, nprocs, myrank, nprocs_for_coll;
5555
int cb_enable;
5656
ADIO_Offset bufsize;
57-
MPI_Aint extent;
57+
MPI_Aint extent, lb;
5858
#ifdef DEBUG2
5959
MPI_Aint bufextent;
6060
#endif
@@ -191,7 +191,7 @@ void ADIOI_IOStridedColl (ADIO_File fd, void *buf, int count, int rdwr,
191191
return;
192192
}
193193

194-
MPI_Type_extent(datatype, &extent);
194+
MPI_Type_get_extent(datatype, &lb, &extent);
195195
#ifdef DEBUG2
196196
bufextent = extent * count;
197197
#endif
@@ -702,7 +702,7 @@ void ADIOI_Calc_bounds (ADIO_File fd, int count, MPI_Datatype buftype,
702702
{
703703
MPI_Count filetype_size, buftype_size, etype_size;
704704
int sum;
705-
MPI_Aint filetype_extent;
705+
MPI_Aint filetype_extent, lb;
706706
ADIO_Offset total_io;
707707
int filetype_is_contig;
708708
ADIO_Offset i, remainder;
@@ -726,7 +726,7 @@ void ADIOI_Calc_bounds (ADIO_File fd, int count, MPI_Datatype buftype,
726726
ADIOI_Datatype_iscontig (fd->filetype, &filetype_is_contig);
727727

728728
MPI_Type_size_x (fd->filetype, &filetype_size);
729-
MPI_Type_extent (fd->filetype, &filetype_extent);
729+
MPI_Type_get_extent (fd->filetype, &lb, &filetype_extent);
730730
MPI_Type_size_x (fd->etype, &etype_size);
731731
MPI_Type_size_x (buftype, &buftype_size);
732732

@@ -884,7 +884,7 @@ void ADIOI_IOFiletype(ADIO_File fd, void *buf, int count,
884884
int user_ind_rd_buffer_size;
885885
int f_is_contig, m_is_contig;
886886
int user_ds_read, user_ds_write;
887-
MPI_Aint f_extent;
887+
MPI_Aint f_extent, lb;
888888
MPI_Count f_size;
889889
int f_ds_percent; /* size/extent */
890890

@@ -894,7 +894,7 @@ void ADIOI_IOFiletype(ADIO_File fd, void *buf, int count,
894894
else
895895
MPE_Log_event(5008, 0, NULL);
896896
#endif
897-
MPI_Type_extent(custom_ftype, &f_extent);
897+
MPI_Type_get_extent(custom_ftype, &lb, &f_extent);
898898
MPI_Type_size_x(custom_ftype, &f_size);
899899
f_ds_percent = 100 * f_size / f_extent;
900900

ompi/mca/io/romio314/romio/adio/common/ad_read_coll.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,7 @@ void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype
307307
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
308308

309309
MPI_Type_size_x(fd->filetype, &filetype_size);
310-
MPI_Type_extent(fd->filetype, &filetype_extent);
311-
MPI_Type_lb(fd->filetype, &filetype_lb);
310+
MPI_Type_get_extent(fd->filetype, &filetype_lb, &filetype_extent);
312311
MPI_Type_size_x(datatype, &buftype_size);
313312
etype_size = fd->etype_size;
314313

@@ -524,7 +523,7 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
524523
int req_len, flag, rank;
525524
MPI_Status status;
526525
ADIOI_Flatlist_node *flat_buf=NULL;
527-
MPI_Aint buftype_extent;
526+
MPI_Aint buftype_extent, lb;
528527
int coll_bufsize;
529528

530529
*error_code = MPI_SUCCESS; /* changed below if error */
@@ -605,7 +604,7 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
605604
flat_buf = ADIOI_Flatlist;
606605
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
607606
}
608-
MPI_Type_extent(datatype, &buftype_extent);
607+
MPI_Type_get_extent(datatype, &lb, &buftype_extent);
609608

610609
done = 0;
611610
off = st_loc;
@@ -685,7 +684,7 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
685684
if (req_off < real_off + real_size) {
686685
count[i]++;
687686
ADIOI_Assert((((ADIO_Offset)(MPIR_Upint)read_buf)+req_off-real_off) == (ADIO_Offset)(MPIR_Upint)(read_buf+req_off-real_off));
688-
MPI_Address(read_buf+req_off-real_off,
687+
MPI_Get_address(read_buf+req_off-real_off,
689688
&(others_req[i].mem_ptrs[j]));
690689
ADIOI_Assert((real_off + real_size - req_off) == (int)(real_off + real_size - req_off));
691690
send_size[i] += (int)(ADIOI_MIN(real_off + real_size - req_off,

0 commit comments

Comments
 (0)