From c902624b59fde8bf1ea5df2344da213c436e4bc0 Mon Sep 17 00:00:00 2001 From: Vishwanath Venkatesan Date: Wed, 24 Apr 2013 19:27:26 +0000 Subject: [PATCH] Using ompi_type_destroy to free ompi_datatype. This had to be updated in all the collective algorithms. Hopefully this will fix all warnings. This commit was SVN r28385. --- .../dynamic/fcoll_dynamic_file_read_all.c | 2 ++ .../dynamic/fcoll_dynamic_file_write_all.c | 7 ++-- .../fcoll/static/fcoll_static_file_read_all.c | 2 ++ .../static/fcoll_static_file_write_all.c | 2 ++ .../two_phase/fcoll_two_phase_file_read_all.c | 33 ++++++++----------- .../fcoll_two_phase_file_write_all.c | 9 +++-- 6 files changed, 29 insertions(+), 26 deletions(-) diff --git a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c index 39a157822a..3c33647442 100644 --- a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c +++ b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c @@ -824,6 +824,8 @@ free (global_buf); global_buf = NULL; } + for (i = 0; i < fh->f_procs_per_group; i++) + ompi_datatype_destroy(sendtype+i); if (NULL != sendtype){ free(sendtype); sendtype=NULL; diff --git a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c index a766fe27ad..a9f9062e25 100644 --- a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c +++ b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c @@ -745,10 +745,9 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, MPI_BYTE, &recvtype[i]); ompi_datatype_commit(&recvtype[i]); - - ompi_datatype_type_size (recvtype[i], - &datatype_size); + opal_datatype_type_size(&recvtype[i]->super, + &datatype_size); if (datatype_size){ @@ -978,6 +977,8 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, free (fh->f_io_array); fh->f_io_array = NULL; } + for (i =0; i< fh->f_procs_per_group; i++) + ompi_datatype_destroy(recvtype+i); if (NULL != recvtype){ free(recvtype); recvtype=NULL; diff --git a/ompi/mca/fcoll/static/fcoll_static_file_read_all.c b/ompi/mca/fcoll/static/fcoll_static_file_read_all.c index 2f1df5d3ea..7e070f1058 100644 --- a/ompi/mca/fcoll/static/fcoll_static_file_read_all.c +++ b/ompi/mca/fcoll/static/fcoll_static_file_read_all.c @@ -849,6 +849,8 @@ mca_fcoll_static_file_read_all (mca_io_ompio_file_t *fh, free (fh->f_io_array); fh->f_io_array = NULL; } + for (i = 0; i < fh->f_procs_per_group; i++) + ompi_datatype_destroy(sendtype+i); if (NULL != sendtype){ free(sendtype); sendtype=NULL; diff --git a/ompi/mca/fcoll/static/fcoll_static_file_write_all.c b/ompi/mca/fcoll/static/fcoll_static_file_write_all.c index 2cb4abd672..fcb576edf6 100644 --- a/ompi/mca/fcoll/static/fcoll_static_file_write_all.c +++ b/ompi/mca/fcoll/static/fcoll_static_file_write_all.c @@ -887,6 +887,8 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh, free (fh->f_io_array); fh->f_io_array = NULL; } + for (i = 0; i < fh->f_procs_per_group; i++) + ompi_datatype_destroy(recvtype+i); if (NULL != recvtype){ free(recvtype); recvtype=NULL; diff --git a/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_read_all.c b/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_read_all.c index 5e2ab656eb..5184820e73 100644 --- a/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_read_all.c +++ b/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_read_all.c @@ -518,13 +518,15 @@ static int two_phase_read_and_exch(mca_io_ompio_file_t *fh, int *partial_send=NULL, *start_pos=NULL, req_len=0, flag=0; int *recd_from_proc=NULL; MPI_Aint buftype_extent=0; - int byte_size = 0; + size_t byte_size = 0; OMPI_MPI_OFFSET_TYPE st_loc=-1, end_loc=-1, off=0, done=0, for_next_iter=0; OMPI_MPI_OFFSET_TYPE size=0, req_off=0, real_size=0, real_off=0, len=0; OMPI_MPI_OFFSET_TYPE for_curr_iter=0; char *read_buf=NULL, *tmp_buf=NULL; + MPI_Datatype byte = MPI_BYTE; - MPI_Type_size(MPI_BYTE, &byte_size); + opal_datatype_type_size(&byte->super, + &byte_size); for (i = 0; i < fh->f_size; i++){ if (others_req[i].count) { @@ -827,8 +829,7 @@ static int two_phase_exchange_data(mca_io_ompio_file_t *fh, int ret = OMPI_SUCCESS; char **recv_buf = NULL; MPI_Request *requests=NULL; - // MPI_Datatype *send_type=NULL; - ompi_datatype_t **send_type = NULL; + MPI_Datatype send_type; @@ -846,7 +847,7 @@ static int two_phase_exchange_data(mca_io_ompio_file_t *fh, fh->f_comm->c_coll.coll_alltoall_module); if ( OMPI_SUCCESS != ret ){ - return ret; + goto exit; } @@ -891,10 +892,11 @@ static int two_phase_exchange_data(mca_io_ompio_file_t *fh, } } else{ - + recv_buf = (char **)malloc(fh->f_size * sizeof(char *)); if (NULL == recv_buf){ - return OMPI_ERR_OUT_OF_RESOURCE; + ret = OMPI_ERR_OUT_OF_RESOURCE; + goto exit; } for (i=0; i < fh->f_size; i++) @@ -926,32 +928,23 @@ static int two_phase_exchange_data(mca_io_ompio_file_t *fh, others_req[i].lens[k] = partial_send[i]; } - send_type = (ompi_datatype_t **) malloc (sizeof(ompi_datatype_t *)); - if (NULL == send_type){ - ret = OMPI_ERR_OUT_OF_RESOURCE; - goto exit; - } - ompi_datatype_create_hindexed(count[i], &(others_req[i].lens[start_pos[i]]), &(others_req[i].mem_ptrs[start_pos[i]]), MPI_BYTE, - send_type); + &send_type); - ompi_datatype_commit(send_type); + ompi_datatype_commit(&send_type); ret = MCA_PML_CALL(isend(MPI_BOTTOM, 1, - send_type[0], + send_type, i, fh->f_rank+i+100*iter, MCA_PML_BASE_SEND_STANDARD, fh->f_comm, requests+nprocs_recv+j)); - if (NULL != send_type){ - free(send_type); - send_type = NULL; - } + ompi_datatype_destroy(&send_type); if (partial_send[i]) others_req[i].lens[k] = tmp; j++; diff --git a/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_write_all.c b/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_write_all.c index f6db9ed6de..d0dc96fc6a 100644 --- a/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_write_all.c +++ b/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_write_all.c @@ -577,7 +577,7 @@ static int two_phase_exch_and_write(mca_io_ompio_file_t *fh, MPI_Aint buftype_extent; int hole; size_t byte_size; - + MPI_Datatype byte = MPI_BYTE; #if DEBUG_ON int ii,jj; #endif @@ -585,7 +585,8 @@ static int two_phase_exch_and_write(mca_io_ompio_file_t *fh, char *write_buf=NULL; - ompi_datatype_type_size(MPI_BYTE, &byte_size); + opal_datatype_type_size(&byte->super, + &byte_size); for (i = 0; i < fh->f_size; i++){ if (others_req[i].count) { @@ -1149,11 +1150,13 @@ static int two_phase_exchage_data(mca_io_ompio_file_t *fh, } } - //for (i=0; i