From 8f6b29e95bbf1448ece0fbf5ca4d39427c7fe2c0 Mon Sep 17 00:00:00 2001 From: Vishwanath Venkatesan Date: Thu, 13 Oct 2011 19:50:45 +0000 Subject: [PATCH] Fixing the default file view issue and merging contiguous lengths and offsets for explicit offset case. This commit was SVN r25281. --- ompi/mca/io/ompio/io_ompio.c | 97 ++++++++++++++++++++++++++++++------ 1 file changed, 83 insertions(+), 14 deletions(-) diff --git a/ompi/mca/io/ompio/io_ompio.c b/ompi/mca/io/ompio/io_ompio.c index 223fc4dace..096f298c68 100644 --- a/ompi/mca/io/ompio/io_ompio.c +++ b/ompi/mca/io/ompio/io_ompio.c @@ -77,29 +77,29 @@ int ompi_io_ompio_set_file_defaults (mca_io_ompio_file_t *fh) fh->f_procs_in_group = NULL; fh->f_procs_per_group = -1; - ompi_datatype_create_contiguous(1048576, &ompi_mpi_byte.dt, &default_file_view); fh->f_etype = default_file_view; - fh->f_filetype = default_file_view; + fh->f_filetype = default_file_view; /* Default file View */ fh->f_iov_type = MPI_DATATYPE_NULL; fh->f_iov_count = 1; - fh->f_decoded_iov = (struct iovec*)malloc(fh->f_iov_count * - sizeof(struct iovec)); + fh->f_decoded_iov = (struct iovec*)malloc(fh->f_iov_count * + sizeof(struct iovec)); if (NULL == fh->f_decoded_iov) { opal_output (1, "OUT OF MEMORY\n"); return OMPI_ERR_OUT_OF_RESOURCE; } + fh->f_cc_size = 1; fh->f_stripe_size = mca_io_ompio_bytes_per_agg; - fh->f_decoded_iov[0].iov_len = 1; + fh->f_decoded_iov[0].iov_len = 1048576; fh->f_decoded_iov[0].iov_base = 0; - /* - * Create a derived datatype for the created iovec - */ + + /*Create a derived datatype for the created iovec */ + types[0] = &ompi_mpi_long.dt; types[1] = &ompi_mpi_long.dt; MPI_Address( fh->f_decoded_iov, d); @@ -115,8 +115,8 @@ int ompi_io_ompio_set_file_defaults (mca_io_ompio_file_t *fh) &fh->f_iov_type); ompi_datatype_commit (&fh->f_iov_type); - fh->f_view_extent = 1; - fh->f_view_size = 1; + fh->f_view_extent = 1048576; + fh->f_view_size = 1048576; fh->f_etype_size = 1; return OMPI_SUCCESS; @@ -140,6 +140,17 @@ int ompi_io_ompio_generate_current_file_view (mca_io_ompio_file_t *fh, size_t sum_previous_counts = 0; int j, k; int block = 1; + + /*Merging if the data is split-up */ + int merge = 0, i; + int merge_count = 0; + struct iovec *merged_iov = NULL; + size_t merge_length = 0; + IOVBASE_TYPE * merge_offset = 0; + + + + /* allocate an initial iovec, will grow if needed */ @@ -203,8 +214,65 @@ int ompi_io_ompio_generate_current_file_view (mca_io_ompio_file_t *fh, fh->f_position_in_file_view = sum_previous_counts; fh->f_index_in_file_view = j; - *iov_count = k; - *f_iov = iov; + + /* Merging Contiguous entries in case of using default fileview*/ + merged_iov = (struct iovec *)malloc(k*sizeof(struct iovec)); + for(i=0;if_rank, merge_count); + for (i=0;if_rank, merged_iov[i].iov_base, merged_iov[i].iov_len); + } + #endif + *iov_count = merge_count; + *f_iov = merged_iov; + + return OMPI_SUCCESS; } @@ -327,8 +395,9 @@ int ompi_io_ompio_decode_datatype (mca_io_ompio_file_t *fh, } remaining_length -= temp_data; - /* + #if 0 if (0 == fh->f_rank) { + printf ("%d Entries: \n",*iovec_count); for (i=0 ; i<*iovec_count ; i++) { printf ("\t{%p, %d}\n", @@ -336,7 +405,7 @@ int ompi_io_ompio_decode_datatype (mca_io_ompio_file_t *fh, (*iov)[i].iov_len); } } - */ + #endif if (remaining_length != 0) { printf( "Not all raw description was been extracted (%lu bytes missing)\n", (unsigned long) remaining_length );