Skip to content

Commit dedeee9

Browse files
committed
finishing the changes for the non-blocking and split cpllective I/O operations. Everything except for the
interface changes to the io framework is done.
1 parent 3b11a8b commit dedeee9

File tree

1 file changed

+50
-39
lines changed

1 file changed

+50
-39
lines changed

ompi/mca/io/ompio/io_ompio_file_write.c

Lines changed: 50 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,45 @@ int mca_io_ompio_file_write_ordered_end (ompi_file_t *fp,
726726

727727
/* Split collectives . Not really used but infrastructure is in place */
728728
/**********************************************************************/
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+
729768
int mca_io_ompio_file_write_at_all_begin (ompi_file_t *fh,
730769
OMPI_MPI_OFFSET_TYPE offset,
731770
void *buf,
@@ -736,7 +775,7 @@ int mca_io_ompio_file_write_at_all_begin (ompi_file_t *fh,
736775
mca_io_ompio_data_t *data;
737776

738777
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 );
740779
return ret;
741780
}
742781

@@ -747,17 +786,13 @@ int ompio_io_ompio_file_write_at_all_begin (mca_io_ompio_file_t *fh,
747786
struct ompi_datatype_t *datatype)
748787
{
749788
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);
754789

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;
761796
return ret;
762797
}
763798

@@ -769,8 +804,7 @@ int mca_io_ompio_file_write_at_all_end (ompi_file_t *fh,
769804
mca_io_ompio_data_t *data;
770805

771806
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 );
774808
return ret;
775809
}
776810

@@ -779,33 +813,10 @@ int ompio_io_ompio_file_write_at_all_end (mca_io_ompio_file_t *fh,
779813
ompi_status_public_t * status)
780814
{
781815
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 );
806817

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;
809820
return ret;
810821
}
811822

0 commit comments

Comments
 (0)