diff -ruNp romio-orig/adio/common/ad_read_coll.c romio/adio/common/ad_read_coll.c --- romio-orig/adio/common/ad_read_coll.c 2007-07-13 08:59:55.000454903 -0400 +++ romio/adio/common/ad_read_coll.c 2007-07-13 09:29:53.000527998 -0400 @@ -133,6 +133,8 @@ void ADIOI_GEN_ReadStridedColl(ADIO_File if (fd->hints->cb_read == ADIOI_HINT_DISABLE || (!interleave_count && (fd->hints->cb_read == ADIOI_HINT_AUTO))) { + int filerange_is_contig = 0; + /* don't do aggregation */ if (fd->hints->cb_read != ADIOI_HINT_DISABLE) { ADIOI_Free(offset_list); @@ -143,8 +145,13 @@ void ADIOI_GEN_ReadStridedColl(ADIO_File fd->fp_ind = orig_fp; ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + if (!filetype_is_contig) + ADIOI_Filetype_range_iscontig(fd, offset, file_ptr_type, + datatype, count, &filerange_is_contig); + + if (buftype_is_contig && (filetype_is_contig || + filerange_is_contig)) { - if (buftype_is_contig && filetype_is_contig) { if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { off = fd->disp + (fd->etype_size) * offset; ADIO_ReadContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET, diff -ruNp romio-orig/adio/common/ad_write_coll.c romio/adio/common/ad_write_coll.c --- romio-orig/adio/common/ad_write_coll.c 2007-07-13 08:59:55.000611711 -0400 +++ romio/adio/common/ad_write_coll.c 2007-07-13 09:30:07.000435793 -0400 @@ -129,6 +129,8 @@ void ADIOI_GEN_WriteStridedColl(ADIO_Fil if (fd->hints->cb_write == ADIOI_HINT_DISABLE || (!interleave_count && (fd->hints->cb_write == ADIOI_HINT_AUTO))) { + int filerange_is_contig = 0; + /* use independent accesses */ if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { ADIOI_Free(offset_list); @@ -139,8 +141,12 @@ void ADIOI_GEN_WriteStridedColl(ADIO_Fil fd->fp_ind = orig_fp; ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + if (!filetype_is_contig) + ADIOI_Filetype_range_iscontig(fd, offset, file_ptr_type, + datatype, count, &filerange_is_contig); - if (buftype_is_contig && filetype_is_contig) { + if (buftype_is_contig && (filetype_is_contig || + filerange_is_contig)) { if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { off = fd->disp + (fd->etype_size) * offset; ADIO_WriteContig(fd, buf, count, datatype, diff -ruNp romio-orig/adio/common/iscontig.c romio/adio/common/iscontig.c --- romio-orig/adio/common/iscontig.c 2007-07-13 08:59:55.000785894 -0400 +++ romio/adio/common/iscontig.c 2007-07-13 09:03:24.000419200 -0400 @@ -5,6 +5,7 @@ */ #include "adio.h" +#include "adio_extern.h" /* #ifdef MPISGI #include "mpisgi2.h" #endif */ @@ -101,3 +102,85 @@ void ADIOI_Datatype_iscontig(MPI_Datatyp in other cases as well.*/ } #endif + +void ADIOI_Filetype_range_start(ADIO_File fd, ADIO_Offset offset, int file_ptr_type, + int *start_index, int *start_ftype, int *start_offset, int *start_io_size) +{ + ADIOI_Flatlist_node *flat_file; + ADIO_Offset disp, abs_off_in_filetype=0; + MPI_Aint filetype_extent; + + int i, st_io_size=0, st_index=0; + int sum, n_etypes_in_filetype, size_in_filetype; + int n_filetypes, etype_in_filetype; + int flag, filetype_size, etype_size; + + flat_file = ADIOI_Flatlist; + while (flat_file->type != fd->filetype) flat_file = flat_file->next; + disp = fd->disp; + + MPI_Type_size(fd->filetype, &filetype_size); + MPI_Type_extent(fd->filetype, &filetype_extent); + etype_size = fd->etype_size; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; /* in bytes */ + n_filetypes = -1; + flag = 0; + while (!flag) { + n_filetypes++; + for (i=0; icount; i++) { + if (disp + flat_file->indices[i] + + (ADIO_Offset) n_filetypes*filetype_extent + flat_file->blocklens[i] + >= offset) { + st_index = i; + st_io_size = (int) (disp + flat_file->indices[i] + + (ADIO_Offset) n_filetypes*filetype_extent + + flat_file->blocklens[i] - offset); + flag = 1; + break; + } + } + } + } else { + n_etypes_in_filetype = filetype_size/etype_size; + n_filetypes = (int) (offset / n_etypes_in_filetype); + etype_in_filetype = (int) (offset % n_etypes_in_filetype); + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i=0; icount; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + st_io_size = sum - size_in_filetype; + abs_off_in_filetype = flat_file->indices[i] + + size_in_filetype - (sum - flat_file->blocklens[i]); + break; + } + } + + /* abs. offset in bytes in the file */ + offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + abs_off_in_filetype; + } + + *start_index = st_index; + *start_io_size = st_io_size; + *start_offset = offset; + *start_ftype = n_filetypes; +} + +void ADIOI_Filetype_range_iscontig(ADIO_File fd, ADIO_Offset offset, + int file_ptr_type, MPI_Datatype datatype, int count, int *flag) +{ + int srclen, datatype_size; + int st_index, st_ftype, st_offset, st_io_size; + + MPI_Type_size(datatype, &datatype_size); + srclen = datatype_size * count; + + ADIOI_Filetype_range_start(fd, offset, file_ptr_type, + &st_index, &st_ftype, &st_offset, &st_io_size); + *flag = st_io_size >= srclen ? 1 : 0; +} + diff -ruNp romio-orig/adio/include/adioi.h romio/adio/include/adioi.h --- romio-orig/adio/include/adioi.h 2007-07-13 08:59:56.000018889 -0400 +++ romio/adio/include/adioi.h 2007-07-13 09:02:25.000302029 -0400 @@ -304,6 +304,10 @@ void *ADIOI_Calloc_fn(size_t nelem, size void *ADIOI_Realloc_fn(void *ptr, size_t size, int lineno, char *fname); void ADIOI_Free_fn(void *ptr, int lineno, char *fname); void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag); +void ADIOI_Filetype_range_iscontig(ADIO_File fd, ADIO_Offset offset, + int file_ptr_type, MPI_Datatype datatype, int count, int *flag); +void ADIOI_Filetype_range_start(ADIO_File fd, ADIO_Offset offset, int file_ptr_type, + int *start_index, int *start_ftype, int *start_offset, int *start_io_size); void ADIOI_Get_position(ADIO_File fd, ADIO_Offset *offset); void ADIOI_Get_eof_offset(ADIO_File fd, ADIO_Offset *eof_offset); void ADIOI_Get_byte_offset(ADIO_File fd, ADIO_Offset offset,