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$
1414 *
1515 * Additional copyrights may follow
@@ -379,6 +379,36 @@ int mca_io_ompio_file_read_all (ompi_file_t *fh,
379379 return ret ;
380380}
381381
382+ int mca_io_ompio_file_iread_all (ompi_file_t * fh ,
383+ void * buf ,
384+ int count ,
385+ struct ompi_datatype_t * datatype ,
386+ ompi_request_t * * request )
387+ {
388+ int ret = OMPI_SUCCESS ;
389+ mca_io_ompio_data_t * data = NULL ;
390+ mca_io_ompio_file_t * fp = NULL ;
391+
392+ data = (mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
393+ fp = & data -> ompio_fh ;
394+
395+ if ( NULL != fp -> f_fcoll -> fcoll_file_iread_all ) {
396+ ret = fp -> f_fcoll -> fcoll_file_iread_all (& data -> ompio_fh ,
397+ buf ,
398+ count ,
399+ datatype ,
400+ request );
401+ }
402+ else {
403+ /* this fcoll component does not support non-blocking
404+ collective I/O operations. WE fake it with
405+ individual non-blocking I/O operations. */
406+ ret = ompio_io_ompio_file_iread ( fp , buf , count , datatype , request );
407+ }
408+
409+ return ret ;
410+ }
411+
382412
383413int mca_io_ompio_file_read_at_all (ompi_file_t * fh ,
384414 OMPI_MPI_OFFSET_TYPE offset ,
@@ -418,6 +448,41 @@ int ompio_io_ompio_file_read_at_all (mca_io_ompio_file_t *fh,
418448 return ret ;
419449}
420450
451+ int mca_io_ompio_file_iread_at_all (ompi_file_t * fh ,
452+ OMPI_MPI_OFFSET_TYPE offset ,
453+ void * buf ,
454+ int count ,
455+ struct ompi_datatype_t * datatype ,
456+ ompi_request_t * * request )
457+ {
458+ int ret = OMPI_SUCCESS ;
459+ mca_io_ompio_data_t * data ;
460+ mca_io_ompio_file_t * fp = NULL ;
461+ OMPI_MPI_OFFSET_TYPE prev_offset ;
462+ ompio_io_ompio_file_get_position (fh , & prev_offset );
463+
464+ ompi_io_ompio_set_explicit_offset (fh , offset );
465+
466+ data = (mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
467+ fp = & data -> fh_ompio ;
468+ if ( NULL != fp -> f_fcoll -> fcoll_file_iread_all ) {
469+ ret = fp -> f_fcoll -> fcoll_file_iread_all (& data -> ompio_fh ,
470+ buf ,
471+ count ,
472+ datatype ,
473+ request );
474+ }
475+ else {
476+ /* this fcoll component does not support non-blocking
477+ collective I/O operations. WE fake it with
478+ individual non-blocking I/O operations. */
479+ ret = ompio_io_ompio_file_iread ( fp , buf , count , datatype , request );
480+ }
481+
482+
483+ ompi_io_ompio_set_explicit_offset (fh , prev_offset );
484+ return ret ;
485+ }
421486
422487/* Infrastructure for shared file pointer operations
423488** (individual and ordered)*/
@@ -553,10 +618,15 @@ int mca_io_ompio_file_read_all_begin (ompi_file_t *fh,
553618 struct ompi_datatype_t * datatype )
554619{
555620 int ret = OMPI_SUCCESS ;
556- mca_io_ompio_data_t * data ;
557-
558- data = (mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
621+ mca_io_ompio_file_t * fp ;
559622
623+ fp = (mca_io_ompio_file_t * ) & fh -> f_io_selected_data -> fh_ompio ;
624+ if ( true == fp -> f_split_coll_in_use ) {
625+ printf ("Only one split collective I/O operation allowed per file handle at any given point in time!\n" );
626+ return MPI_ERR_OTHER ;
627+ }
628+ ret = mca_io_ompio_file_iread_all ( fh , buf , count , datatype , & fp -> f_split_coll_req );
629+ fp -> f_split_coll_in_use = true;
560630
561631 return ret ;
562632}
@@ -566,10 +636,13 @@ int mca_io_ompio_file_read_all_end (ompi_file_t *fh,
566636 ompi_status_public_t * status )
567637{
568638 int ret = OMPI_SUCCESS ;
569- mca_io_ompio_data_t * data ;
639+ mca_io_ompio_file_t * fp ;
570640
571- data = (mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
641+ fp = (mca_io_ompio_file_t * ) & fh -> f_io_selected_data -> fh_ompio ;
642+ ret = ompi_mpi_wait ( & fp -> f_split_coll_req , status );
572643
644+ /* remove the flag again */
645+ fp -> f_split_coll_in_use = false;
573646 return ret ;
574647}
575648
@@ -583,7 +656,7 @@ int mca_io_ompio_file_read_at_all_begin (ompi_file_t *fh,
583656 mca_io_ompio_data_t * data ;
584657
585658 data = (mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
586-
659+ ret = ompio_io_ompio_file_read_at_all_begin ( & data -> fh_ompio , offset , buf , count , datatype );
587660 return ret ;
588661}
589662
@@ -594,17 +667,13 @@ int ompio_io_ompio_file_read_at_all_begin (mca_io_ompio_file_t *fh,
594667 struct ompi_datatype_t * datatype )
595668{
596669 int ret = OMPI_SUCCESS ;
597- OMPI_MPI_OFFSET_TYPE prev_offset ;
598- ompio_io_ompio_file_get_position (fh , & prev_offset );
599670
600- ompi_io_ompio_set_explicit_offset (fh , offset );
601- /* It is OK to reset the position already here, althgouth
602- ** the operation might still be pending/ongoing, since
603- ** the entire array of <offset, length, memaddress> have
604- ** already been constructed in the file_read_all_begin operation
605- */
606-
607- ompi_io_ompio_set_explicit_offset (fh , prev_offset );
671+ if ( true == fh -> f_split_coll_in_use ) {
672+ printf ("Only one split collective I/O operation allowed per file handle at any given point in time!\n" );
673+ return MPI_ERR_REQUEST ;
674+ }
675+ ret = mca_io_ompio_file_iread_at_all ( fh , offset , buf , count , datatype , & fh -> f_split_coll_req );
676+ fh -> f_split_coll_in_use = true;
608677 return ret ;
609678}
610679
@@ -616,7 +685,7 @@ int mca_io_ompio_file_read_at_all_end (ompi_file_t *fh,
616685 mca_io_ompio_data_t * data ;
617686
618687 data = (mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
619-
688+ ret = ompio_io_ompio_file_read_at_all_end ( & data -> fh_ompio , but , status );
620689 return ret ;
621690}
622691
@@ -625,7 +694,9 @@ int ompio_io_ompio_file_read_at_all_end (mca_io_ompio_file_t *ompio_fh,
625694 ompi_status_public_t * status )
626695{
627696 int ret = OMPI_SUCCESS ;
697+ ret = ompi_mpi_wait ( & ompio_fh -> f_split_coll_req , status );
628698
629-
699+ /* remove the flag again */
700+ fp -> f_split_coll_in_use = false;
630701 return ret ;
631702}
0 commit comments