Skip to content

Commit a96efb7

Browse files
committed
common/ompio: add comm_ompio_read_all/write_all functions
in preparation for adding support for the external32 data representation. Signed-off-by: Edgar Gabriel <egabriel@central.uh.edu>
1 parent d65fae1 commit a96efb7

File tree

5 files changed

+128
-74
lines changed

5 files changed

+128
-74
lines changed

ompi/mca/common/ompio/common_ompio.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,16 @@ OMPI_DECLSPEC int mca_common_ompio_file_iwrite_at (ompio_file_t *fh, OMPI_MPI_O
253253
const void *buf, int count, struct ompi_datatype_t *datatype,
254254
ompi_request_t **request);
255255

256+
OMPI_DECLSPEC int mca_common_ompio_file_write_all (ompio_file_t *fh, const void *buf,
257+
int count, struct ompi_datatype_t *datatype,
258+
ompi_status_public_t *status);
259+
256260
OMPI_DECLSPEC int mca_common_ompio_file_write_at_all (ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE offset, const void *buf,
257261
int count, struct ompi_datatype_t *datatype,
258262
ompi_status_public_t *status);
259263

264+
OMPI_DECLSPEC int mca_common_ompio_file_iwrite_all (ompio_file_t *fp, const void *buf,
265+
int count, struct ompi_datatype_t *datatype, ompi_request_t **request);
260266

261267
OMPI_DECLSPEC int mca_common_ompio_file_iwrite_at_all (ompio_file_t *fp, OMPI_MPI_OFFSET_TYPE offset, const void *buf,
262268
int count, struct ompi_datatype_t *datatype, ompi_request_t **request);
@@ -282,10 +288,16 @@ OMPI_DECLSPEC int mca_common_ompio_file_iread_at (ompio_file_t *fh, OMPI_MPI_OFF
282288
void *buf, int count, struct ompi_datatype_t *datatype,
283289
ompi_request_t **request);
284290

291+
OMPI_DECLSPEC int mca_common_ompio_file_read_all (ompio_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype,
292+
ompi_status_public_t * status);
293+
285294
OMPI_DECLSPEC int mca_common_ompio_file_read_at_all (ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE offset,
286295
void *buf, int count, struct ompi_datatype_t *datatype,
287296
ompi_status_public_t * status);
288297

298+
OMPI_DECLSPEC int mca_common_ompio_file_iread_all (ompio_file_t *fp, void *buf, int count, struct ompi_datatype_t *datatype,
299+
ompi_request_t **request);
300+
289301
OMPI_DECLSPEC int mca_common_ompio_file_iread_at_all (ompio_file_t *fp, OMPI_MPI_OFFSET_TYPE offset,
290302
void *buf, int count, struct ompi_datatype_t *datatype,
291303
ompi_request_t **request);

ompi/mca/common/ompio/common_ompio_file_read.c

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,21 @@ int mca_common_ompio_file_iread_at (ompio_file_t *fh,
376376

377377

378378
/* Infrastructure for collective operations */
379+
int mca_common_ompio_file_read_all (ompio_file_t *fh,
380+
void *buf,
381+
int count,
382+
struct ompi_datatype_t *datatype,
383+
ompi_status_public_t * status)
384+
{
385+
int ret = OMPI_SUCCESS;
386+
ret = fh->f_fcoll->fcoll_file_read_all (fh,
387+
buf,
388+
count,
389+
datatype,
390+
status);
391+
return ret;
392+
}
393+
379394
int mca_common_ompio_file_read_at_all (ompio_file_t *fh,
380395
OMPI_MPI_OFFSET_TYPE offset,
381396
void *buf,
@@ -388,28 +403,23 @@ int mca_common_ompio_file_read_at_all (ompio_file_t *fh,
388403
mca_common_ompio_file_get_position (fh, &prev_offset );
389404

390405
mca_common_ompio_set_explicit_offset (fh, offset);
391-
ret = fh->f_fcoll->fcoll_file_read_all (fh,
392-
buf,
393-
count,
394-
datatype,
395-
status);
396-
406+
ret = mca_common_ompio_file_read_all (fh,
407+
buf,
408+
count,
409+
datatype,
410+
status);
411+
397412
mca_common_ompio_set_explicit_offset (fh, prev_offset);
398413
return ret;
399414
}
400415

401-
int mca_common_ompio_file_iread_at_all (ompio_file_t *fp,
402-
OMPI_MPI_OFFSET_TYPE offset,
403-
void *buf,
404-
int count,
405-
struct ompi_datatype_t *datatype,
406-
ompi_request_t **request)
416+
int mca_common_ompio_file_iread_all (ompio_file_t *fp,
417+
void *buf,
418+
int count,
419+
struct ompi_datatype_t *datatype,
420+
ompi_request_t **request)
407421
{
408422
int ret = OMPI_SUCCESS;
409-
OMPI_MPI_OFFSET_TYPE prev_offset;
410-
411-
mca_common_ompio_file_get_position (fp, &prev_offset );
412-
mca_common_ompio_set_explicit_offset (fp, offset);
413423

414424
if ( NULL != fp->f_fcoll->fcoll_file_iread_all ) {
415425
ret = fp->f_fcoll->fcoll_file_iread_all (fp,
@@ -425,11 +435,33 @@ int mca_common_ompio_file_iread_at_all (ompio_file_t *fp,
425435
ret = mca_common_ompio_file_iread ( fp, buf, count, datatype, request );
426436
}
427437

438+
return ret;
439+
}
428440

441+
int mca_common_ompio_file_iread_at_all (ompio_file_t *fp,
442+
OMPI_MPI_OFFSET_TYPE offset,
443+
void *buf,
444+
int count,
445+
struct ompi_datatype_t *datatype,
446+
ompi_request_t **request)
447+
{
448+
int ret = OMPI_SUCCESS;
449+
OMPI_MPI_OFFSET_TYPE prev_offset;
450+
451+
mca_common_ompio_file_get_position (fp, &prev_offset );
452+
mca_common_ompio_set_explicit_offset (fp, offset);
453+
454+
ret = mca_common_ompio_file_iread_all (fp,
455+
buf,
456+
count,
457+
datatype,
458+
request);
459+
429460
mca_common_ompio_set_explicit_offset (fp, prev_offset);
430461
return ret;
431462
}
432463

464+
433465
int mca_common_ompio_set_explicit_offset (ompio_file_t *fh,
434466
OMPI_MPI_OFFSET_TYPE offset)
435467
{

ompi/mca/common/ompio/common_ompio_file_write.c

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,20 @@ int mca_common_ompio_file_iwrite_at (ompio_file_t *fh,
352352

353353
/* Collective operations */
354354
/******************************************************************/
355+
int mca_common_ompio_file_write_all (ompio_file_t *fh,
356+
const void *buf,
357+
int count,
358+
struct ompi_datatype_t *datatype,
359+
ompi_status_public_t *status)
360+
{
361+
int ret = OMPI_SUCCESS;
362+
ret = fh->f_fcoll->fcoll_file_write_all (fh,
363+
buf,
364+
count,
365+
datatype,
366+
status);
367+
return ret;
368+
}
355369

356370
int mca_common_ompio_file_write_at_all (ompio_file_t *fh,
357371
OMPI_MPI_OFFSET_TYPE offset,
@@ -365,30 +379,23 @@ int mca_common_ompio_file_write_at_all (ompio_file_t *fh,
365379
mca_common_ompio_file_get_position (fh, &prev_offset );
366380

367381
mca_common_ompio_set_explicit_offset (fh, offset);
368-
ret = fh->f_fcoll->fcoll_file_write_all (fh,
369-
buf,
370-
count,
371-
datatype,
372-
status);
373-
382+
ret = mca_common_ompio_file_write_all (fh,
383+
buf,
384+
count,
385+
datatype,
386+
status);
387+
374388
mca_common_ompio_set_explicit_offset (fh, prev_offset);
375389
return ret;
376390
}
377391

378-
int mca_common_ompio_file_iwrite_at_all (ompio_file_t *fp,
379-
OMPI_MPI_OFFSET_TYPE offset,
380-
const void *buf,
381-
int count,
382-
struct ompi_datatype_t *datatype,
383-
ompi_request_t **request)
392+
int mca_common_ompio_file_iwrite_all (ompio_file_t *fp,
393+
const void *buf,
394+
int count,
395+
struct ompi_datatype_t *datatype,
396+
ompi_request_t **request)
384397
{
385-
386398
int ret = OMPI_SUCCESS;
387-
OMPI_MPI_OFFSET_TYPE prev_offset;
388-
389-
mca_common_ompio_file_get_position (fp, &prev_offset );
390-
391-
mca_common_ompio_set_explicit_offset (fp, offset);
392399

393400
if ( NULL != fp->f_fcoll->fcoll_file_iwrite_all ) {
394401
ret = fp->f_fcoll->fcoll_file_iwrite_all (fp,
@@ -404,11 +411,32 @@ int mca_common_ompio_file_iwrite_at_all (ompio_file_t *fp,
404411
ret = mca_common_ompio_file_iwrite ( fp, buf, count, datatype, request );
405412
}
406413

414+
return ret;
415+
}
416+
417+
418+
int mca_common_ompio_file_iwrite_at_all (ompio_file_t *fp,
419+
OMPI_MPI_OFFSET_TYPE offset,
420+
const void *buf,
421+
int count,
422+
struct ompi_datatype_t *datatype,
423+
ompi_request_t **request)
424+
{
425+
426+
int ret = OMPI_SUCCESS;
427+
OMPI_MPI_OFFSET_TYPE prev_offset;
428+
429+
mca_common_ompio_file_get_position (fp, &prev_offset );
430+
mca_common_ompio_set_explicit_offset (fp, offset);
431+
432+
ret = mca_common_ompio_file_iwrite_all ( fp, buf, count, datatype, request );
433+
407434
mca_common_ompio_set_explicit_offset (fp, prev_offset);
408435
return ret;
409436
}
410437

411438

439+
412440
/* Helper function used by both read and write operations */
413441
/**************************************************************/
414442

ompi/mca/io/ompio/io_ompio_file_read.c

Lines changed: 11 additions & 20 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-2018 University of Houston. All rights reserved.
12+
* Copyright (c) 2008-2019 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$
@@ -137,12 +137,11 @@ int mca_io_ompio_file_read_all (ompi_file_t *fh,
137137
data = (mca_common_ompio_data_t *) fh->f_io_selected_data;
138138

139139
OPAL_THREAD_LOCK(&fh->f_lock);
140-
ret = data->ompio_fh.
141-
f_fcoll->fcoll_file_read_all (&data->ompio_fh,
142-
buf,
143-
count,
144-
datatype,
145-
status);
140+
ret = mca_common_ompio_file_read_all (&data->ompio_fh,
141+
buf,
142+
count,
143+
datatype,
144+
status);
146145
OPAL_THREAD_UNLOCK(&fh->f_lock);
147146
if ( MPI_STATUS_IGNORE != status ) {
148147
size_t size;
@@ -168,19 +167,11 @@ int mca_io_ompio_file_iread_all (ompi_file_t *fh,
168167
fp = &data->ompio_fh;
169168

170169
OPAL_THREAD_LOCK(&fh->f_lock);
171-
if ( NULL != fp->f_fcoll->fcoll_file_iread_all ) {
172-
ret = fp->f_fcoll->fcoll_file_iread_all (&data->ompio_fh,
173-
buf,
174-
count,
175-
datatype,
176-
request);
177-
}
178-
else {
179-
/* this fcoll component does not support non-blocking
180-
collective I/O operations. WE fake it with
181-
individual non-blocking I/O operations. */
182-
ret = mca_common_ompio_file_iread ( fp, buf, count, datatype, request );
183-
}
170+
ret = mca_common_ompio_file_iread_all (&data->ompio_fh,
171+
buf,
172+
count,
173+
datatype,
174+
request);
184175
OPAL_THREAD_UNLOCK(&fh->f_lock);
185176

186177
return ret;

ompi/mca/io/ompio/io_ompio_file_write.c

Lines changed: 11 additions & 20 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-2018 University of Houston. All rights reserved.
12+
* Copyright (c) 2008-2019 University of Houston. All rights reserved.
1313
* Copyright (c) 2015-2018 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* $COPYRIGHT$
@@ -143,12 +143,11 @@ int mca_io_ompio_file_write_all (ompi_file_t *fh,
143143
data = (mca_common_ompio_data_t *) fh->f_io_selected_data;
144144

145145
OPAL_THREAD_LOCK(&fh->f_lock);
146-
ret = data->ompio_fh.
147-
f_fcoll->fcoll_file_write_all (&data->ompio_fh,
148-
buf,
149-
count,
150-
datatype,
151-
status);
146+
ret = mca_common_ompio_file_write_all (&data->ompio_fh,
147+
buf,
148+
count,
149+
datatype,
150+
status);
152151
OPAL_THREAD_UNLOCK(&fh->f_lock);
153152
if ( MPI_STATUS_IGNORE != status ) {
154153
size_t size;
@@ -192,19 +191,11 @@ int mca_io_ompio_file_iwrite_all (ompi_file_t *fh,
192191
fp = &data->ompio_fh;
193192

194193
OPAL_THREAD_LOCK(&fh->f_lock);
195-
if ( NULL != fp->f_fcoll->fcoll_file_iwrite_all ) {
196-
ret = fp->f_fcoll->fcoll_file_iwrite_all (&data->ompio_fh,
197-
buf,
198-
count,
199-
datatype,
200-
request);
201-
}
202-
else {
203-
/* this fcoll component does not support non-blocking
204-
collective I/O operations. WE fake it with
205-
individual non-blocking I/O operations. */
206-
ret = mca_common_ompio_file_iwrite ( fp, buf, count, datatype, request );
207-
}
194+
ret = mca_common_ompio_file_iwrite_all (&data->ompio_fh,
195+
buf,
196+
count,
197+
datatype,
198+
request);
208199
OPAL_THREAD_UNLOCK(&fh->f_lock);
209200

210201
return ret;

0 commit comments

Comments
 (0)