Skip to content

Commit 1fee8ef

Browse files
committed
Merge pull request open-mpi#539 from edgargabriel/pr/commits-of-week34
Pr/commits of week 34
2 parents dac0018 + f6b3df2 commit 1fee8ef

16 files changed

+261
-102
lines changed

ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@
350350
}
351351

352352
for(l=0;l<fh->f_procs_per_group;l++){
353-
353+
sendtype[l] = MPI_DATATYPE_NULL;
354354
disp_index[l] = 1;
355355

356356
if (NULL != blocklen_per_process[l]){
@@ -804,8 +804,11 @@
804804
free (global_buf);
805805
global_buf = NULL;
806806
}
807-
for (i = 0; i < fh->f_procs_per_group; i++)
808-
ompi_datatype_destroy(sendtype+i);
807+
for (i = 0; i < fh->f_procs_per_group; i++) {
808+
if ( MPI_DATATYPE_NULL != sendtype[i] ){
809+
ompi_datatype_destroy(&sendtype[i]);
810+
}
811+
}
809812
if (NULL != sendtype){
810813
free(sendtype);
811814
sendtype=NULL;
@@ -851,6 +854,16 @@
851854
#endif
852855

853856
exit:
857+
if (!(fh->f_flags & OMPIO_CONTIGUOUS_MEMORY)) {
858+
if (NULL != receive_buf) {
859+
free (receive_buf);
860+
receive_buf = NULL;
861+
}
862+
}
863+
if (NULL != global_buf) {
864+
free (global_buf);
865+
global_buf = NULL;
866+
}
854867
if (NULL != sorted) {
855868
free (sorted);
856869
sorted = NULL;
@@ -878,6 +891,28 @@
878891
}
879892
if (fh->f_procs_in_group[fh->f_aggregator_index] == fh->f_rank) {
880893

894+
if (NULL != sorted_file_offsets){
895+
free(sorted_file_offsets);
896+
sorted_file_offsets = NULL;
897+
}
898+
if (NULL != file_offsets_for_agg){
899+
free(file_offsets_for_agg);
900+
file_offsets_for_agg = NULL;
901+
}
902+
if (NULL != memory_displacements){
903+
free(memory_displacements);
904+
memory_displacements= NULL;
905+
}
906+
if (NULL != sendtype){
907+
for (i = 0; i < fh->f_procs_per_group; i++) {
908+
if ( MPI_DATATYPE_NULL != sendtype[i] ) {
909+
ompi_datatype_destroy(&sendtype[i]);
910+
}
911+
}
912+
free(sendtype);
913+
sendtype=NULL;
914+
}
915+
881916
if (NULL != disp_index){
882917
free(disp_index);
883918
disp_index = NULL;

ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh,
372372
}
373373

374374
for(l=0;l<fh->f_procs_per_group;l++){
375+
recvtype[i] = MPI_DATATYPE_NULL;
375376
disp_index[l] = 1;
376377

377378
if (NULL != blocklen_per_process[l]){
@@ -952,9 +953,12 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh,
952953
free (fh->f_io_array);
953954
fh->f_io_array = NULL;
954955
}
955-
for (i =0; i< fh->f_procs_per_group; i++)
956-
ompi_datatype_destroy(recvtype+i);
957956
if (NULL != recvtype){
957+
for (i =0; i< fh->f_procs_per_group; i++) {
958+
if ( MPI_DATATYPE_NULL != recvtype[i] ) {
959+
ompi_datatype_destroy(&recvtype[i]);
960+
}
961+
}
958962
free(recvtype);
959963
recvtype=NULL;
960964
}
@@ -992,6 +996,28 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh,
992996

993997
exit :
994998
if (fh->f_procs_in_group[fh->f_aggregator_index] == fh->f_rank) {
999+
if (NULL != sorted_file_offsets){
1000+
free(sorted_file_offsets);
1001+
sorted_file_offsets = NULL;
1002+
}
1003+
if(NULL != file_offsets_for_agg){
1004+
free(file_offsets_for_agg);
1005+
file_offsets_for_agg = NULL;
1006+
}
1007+
if (NULL != memory_displacements){
1008+
free(memory_displacements);
1009+
memory_displacements = NULL;
1010+
}
1011+
if (NULL != recvtype){
1012+
for (i =0; i< fh->f_procs_per_group; i++) {
1013+
if ( MPI_DATATYPE_NULL != recvtype[i] ) {
1014+
ompi_datatype_destroy(&recvtype[i]);
1015+
}
1016+
}
1017+
free(recvtype);
1018+
recvtype=NULL;
1019+
}
1020+
9951021
if (NULL != fh->f_io_array) {
9961022
free (fh->f_io_array);
9971023
fh->f_io_array = NULL;
@@ -1032,7 +1058,17 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh,
10321058
}
10331059

10341060
}
1035-
1061+
1062+
if (! (fh->f_flags & OMPIO_CONTIGUOUS_MEMORY)) {
1063+
if (NULL != send_buf) {
1064+
free (send_buf);
1065+
send_buf = NULL;
1066+
}
1067+
}
1068+
if (NULL != global_buf) {
1069+
free (global_buf);
1070+
global_buf = NULL;
1071+
}
10361072
if (NULL != sorted) {
10371073
free (sorted);
10381074
sorted = NULL;

ompi/mca/io/ompio/io_ompio.c

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ int ompi_io_ompio_set_file_defaults (mca_io_ompio_file_t *fh)
106106
{
107107

108108
if (NULL != fh) {
109-
ompi_datatype_t *types[2], *default_file_view;
109+
ompi_datatype_t *types[2];
110110
int blocklen[2] = {1, 1};
111111
OPAL_PTRDIFF_TYPE d[2], base;
112112
int i;
@@ -132,27 +132,22 @@ int ompi_io_ompio_set_file_defaults (mca_io_ompio_file_t *fh)
132132
fh->f_init_num_aggrs = -1;
133133
fh->f_init_aggr_list = NULL;
134134

135-
ompi_datatype_create_contiguous(MCA_IO_DEFAULT_FILE_VIEW_SIZE,
136-
&ompi_mpi_byte.dt,
137-
&default_file_view);
138-
ompi_datatype_commit (&default_file_view);
139-
140-
fh->f_etype = &ompi_mpi_byte.dt;
141-
fh->f_filetype = default_file_view;
142-
ompi_datatype_duplicate ( &ompi_mpi_byte.dt, &fh->f_orig_filetype );
143-
144135

145136
/* Default file View */
146137
fh->f_iov_type = MPI_DATATYPE_NULL;
147138
fh->f_stripe_size = mca_io_ompio_bytes_per_agg;
148139
/*Decoded iovec of the file-view*/
149140
fh->f_decoded_iov = NULL;
150-
141+
142+
fh->f_etype = NULL;
143+
fh->f_filetype = NULL;
144+
fh->f_orig_filetype = NULL;
145+
151146
mca_io_ompio_set_view_internal(fh,
152147
0,
153148
&ompi_mpi_byte.dt,
154-
default_file_view,
155-
"native",
149+
&ompi_mpi_byte.dt,
150+
"native",
156151
fh->f_info);
157152

158153

@@ -425,6 +420,18 @@ int ompi_io_ompio_generate_current_file_view (struct mca_io_ompio_file_t *fh,
425420
}
426421
}
427422
fp = fopen("fileview_info.out", "w+");
423+
if ( NULL == fp ) {
424+
for (i=0; i<fh->f_size; i++) {
425+
free(adj_matrix[i]);
426+
}
427+
free(adj_matrix);
428+
free(sorted);
429+
free(all_process);
430+
free(per_process);
431+
free(recvcounts);
432+
free(displs);
433+
return MPI_ERR_OTHER;
434+
}
428435
fprintf(fp,"FILEVIEW\n");
429436
column_list = (int *) malloc ( m * sizeof(int));
430437
if (NULL == column_list){
@@ -1445,20 +1452,21 @@ int ompi_io_ompio_distribute_file_view (mca_io_ompio_file_t *fh,
14451452
}
14461453
*/
14471454
exit:
1448-
for (i=0 ; i<num_aggregators ; i++) {
1449-
if (NULL != broken[i]) {
1450-
free (broken[i]);
1455+
1456+
if (NULL != broken) {
1457+
for (i=0 ; i<num_aggregators ; i++) {
1458+
if (NULL != broken[i]) {
1459+
free (broken[i]);
1460+
}
14511461
}
1462+
free (broken);
14521463
}
14531464
if (NULL != req) {
14541465
free (req);
14551466
}
14561467
if (NULL != sendreq) {
14571468
free (sendreq);
14581469
}
1459-
if (NULL != broken) {
1460-
free (broken);
1461-
}
14621470
free (num_entries);
14631471
free (broken_index);
14641472
if (NULL != displs) {

ompi/mca/io/ompio/io_ompio_file_open.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,13 @@ mca_io_ompio_file_open (ompi_communicator_t *comm,
5353
return OMPI_ERR_OUT_OF_RESOURCE;
5454
}
5555

56-
56+
/*save pointer back to the file_t structure */
57+
data->ompio_fh.f_fh = fh;
5758

5859
ret = ompio_io_ompio_file_open(comm,filename,amode,info,&data->ompio_fh,use_sharedfp);
5960

6061
if ( OMPI_SUCCESS == ret ) {
6162
fh->f_flags |= OMPIO_FILE_IS_OPEN;
62-
/*save pointer back to the file_t structure */
63-
data->ompio_fh.f_fh = fh;
6463
}
6564

6665

0 commit comments

Comments
 (0)