@@ -726,6 +726,45 @@ int mca_io_ompio_file_write_ordered_end (ompi_file_t *fp,
726
726
727
727
/* Split collectives . Not really used but infrastructure is in place */
728
728
/**********************************************************************/
729
+ int mca_io_ompio_file_write_all_begin (ompi_file_t * fh ,
730
+ void * buf ,
731
+ int count ,
732
+ struct ompi_datatype_t * datatype )
733
+ {
734
+ int ret = OMPI_SUCCESS ;
735
+ mca_io_ompio_file_t * fp ;
736
+ mca_io_ompio_data_t * data ;
737
+
738
+ data = (mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
739
+ fp = & data -> ompio_fh ;
740
+ if ( true == fp -> f_split_coll_in_use ) {
741
+ printf ("Only one split collective I/O operation allowed per file handle at any given point in time!\n" );
742
+ return MPI_ERR_OTHER ;
743
+ }
744
+ ret = mca_io_ompio_file_iwrite_all ( fh , buf , count , datatype , & fp -> f_split_coll_req );
745
+ fp -> f_split_coll_in_use = true;
746
+
747
+ return ret ;
748
+ }
749
+
750
+ int mca_io_ompio_file_write_all_end (ompi_file_t * fh ,
751
+ void * buf ,
752
+ ompi_status_public_t * status )
753
+ {
754
+ int ret = OMPI_SUCCESS ;
755
+ mca_io_ompio_file_t * fp ;
756
+ mca_io_ompio_data_t * data ;
757
+
758
+ data = (mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
759
+ fp = & data -> ompio_fh ;
760
+ ret = ompi_request_wait ( & fp -> f_split_coll_req , status );
761
+
762
+ /* remove the flag again */
763
+ fp -> f_split_coll_in_use = false;
764
+ return ret ;
765
+ }
766
+
767
+
729
768
int mca_io_ompio_file_write_at_all_begin (ompi_file_t * fh ,
730
769
OMPI_MPI_OFFSET_TYPE offset ,
731
770
void * buf ,
@@ -736,7 +775,7 @@ int mca_io_ompio_file_write_at_all_begin (ompi_file_t *fh,
736
775
mca_io_ompio_data_t * data ;
737
776
738
777
data = (mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
739
- ret = ompio_io_ompio_file_write_at_all_begin (& data -> ompio_fh , offset , buf , count , datatype );
778
+ ret = ompio_io_ompio_file_write_at_all_begin ( & data -> ompio_fh , offset , buf , count , datatype );
740
779
return ret ;
741
780
}
742
781
@@ -747,17 +786,13 @@ int ompio_io_ompio_file_write_at_all_begin (mca_io_ompio_file_t *fh,
747
786
struct ompi_datatype_t * datatype )
748
787
{
749
788
int ret = OMPI_SUCCESS ;
750
- OMPI_MPI_OFFSET_TYPE prev_offset ;
751
- ompio_io_ompio_file_get_position (fh , & prev_offset );
752
-
753
- ompi_io_ompio_set_explicit_offset (fh , offset );
754
789
755
- /* It is OK to reset the position already here, althgouth
756
- ** the operation might still be pending/ongoing, since
757
- ** the entire array of <offset, length, memaddress> have
758
- ** already been constructed in the file_write_all_begin operation
759
- */
760
- ompi_io_ompio_set_explicit_offset ( fh , prev_offset ) ;
790
+ if ( true == fh -> f_split_coll_in_use ) {
791
+ printf ( "Only one split collective I/O operation allowed per file handle at any given point in time!\n" );
792
+ return MPI_ERR_REQUEST ;
793
+ }
794
+ ret = mca_io_ompio_file_iwrite_at_all ( fh -> f_fh , offset , buf , count , datatype , & fh -> f_split_coll_req );
795
+ fh -> f_split_coll_in_use = true ;
761
796
return ret ;
762
797
}
763
798
@@ -769,8 +804,7 @@ int mca_io_ompio_file_write_at_all_end (ompi_file_t *fh,
769
804
mca_io_ompio_data_t * data ;
770
805
771
806
data = (mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
772
- ret = ompio_io_ompio_file_write_at_all_end (& data -> ompio_fh ,buf ,status );
773
-
807
+ ret = ompio_io_ompio_file_read_at_all_end ( & data -> ompio_fh , buf , status );
774
808
return ret ;
775
809
}
776
810
@@ -779,33 +813,10 @@ int ompio_io_ompio_file_write_at_all_end (mca_io_ompio_file_t *fh,
779
813
ompi_status_public_t * status )
780
814
{
781
815
int ret = OMPI_SUCCESS ;
782
-
783
-
784
- return ret ;
785
- }
786
-
787
- int mca_io_ompio_file_write_all_begin (ompi_file_t * fh ,
788
- void * buf ,
789
- int count ,
790
- struct ompi_datatype_t * datatype )
791
- {
792
- int ret = OMPI_SUCCESS ;
793
- mca_io_ompio_data_t * data ;
794
-
795
- data = (mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
796
-
797
- return ret ;
798
- }
799
-
800
- int mca_io_ompio_file_write_all_end (ompi_file_t * fh ,
801
- void * buf ,
802
- ompi_status_public_t * status )
803
- {
804
- int ret = OMPI_SUCCESS ;
805
- mca_io_ompio_data_t * data ;
816
+ ret = ompi_request_wait ( & fh -> f_split_coll_req , status );
806
817
807
- data = ( mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
808
-
818
+ /* remove the flag again */
819
+ fh -> f_split_coll_in_use = false;
809
820
return ret ;
810
821
}
811
822
0 commit comments