Commit a9bbc658 authored by Rob Latham's avatar Rob Latham

move flattend resolution to a separate function

if we do this "flatten type, then find it in the global linked list" in
a separate function, we can make that function thread-safe instead of
sprinking lock/unlock code through 50 locations in ROMIO
Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@anl.gov>
parent 094d7b91
......@@ -534,9 +534,7 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
if (!buftype_is_contig) {
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
}
MPI_Type_extent(datatype, &buftype_extent);
......
......@@ -658,9 +658,7 @@ static void ADIOI_Exch_and_write(ADIO_File fd, const void *buf, MPI_Datatype
ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
if (!buftype_is_contig) {
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(dataype);
}
MPI_Type_extent(datatype, &buftype_extent);
......
......@@ -241,10 +241,7 @@ void ADIOI_GRIDFTP_ReadDiscontig(ADIO_File fd, void *buf, int count,
/* from here we can assume btype_extent==btype_size */
/* Flatten out fd->filetype so we know which blocks to skip */
ADIOI_Flatten_datatype(fd->filetype);
flat_file = ADIOI_Flatlist;
while (flat_file->type != fd->filetype && flat_file->next!=NULL)
flat_file = flat_file->next;
flat_file = ADIOI_Flatten_and_find(fd->filetype);
/* Figure out how big the area to read is */
start=(globus_off_t)(offset*etype_size);
......
......@@ -242,10 +242,7 @@ void ADIOI_GRIDFTP_WriteDiscontig(ADIO_File fd, void *buf, int count,
/* from here we can assume btype_extent==btype_size */
/* Flatten out fd->filetype so we know which blocks to skip */
ADIOI_Flatten_datatype(fd->filetype);
flat_file = ADIOI_Flatlist;
while (flat_file->type != fd->filetype && flat_file->next!=NULL)
flat_file = flat_file->next;
flat_file = ADIOI_Flatten_and_find(fd->filetype);
/* Figure out how big the area to write is */
/* ASSUMPTION: ftype_size is an integer multiple of btype_size or vice versa. */
......
......@@ -415,10 +415,7 @@ static void ADIOI_LUSTRE_Exch_and_write(ADIO_File fd, const void *buf,
ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
if (!buftype_is_contig) {
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype)
flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
}
MPI_Type_extent(datatype, &buftype_extent);
/* I need to check if there are any outstanding nonblocking writes to
......
......@@ -209,10 +209,7 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
/* Different buftype to different filetype */
if (!buftype_is_contig && filetype_is_contig) {
/* noncontiguous in memory, contiguous in file. */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype)
flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :
fd->disp + (ADIO_Offset)etype_size * offset;
......@@ -436,10 +433,7 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
}
else {
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
k = num = buf_count = 0;
i_offset = flat_buf->indices[0];
......
......@@ -215,9 +215,7 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
/* noncontiguous in memory, contiguous in file. */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :
fd->disp + etype_size * offset;
......@@ -460,9 +458,7 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
else {
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
k = num = buf_count = 0;
i = (int) (flat_buf->indices[0]);
......
......@@ -318,9 +318,7 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count,
/* noncontiguous in memory, contiguous in file. */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :
fd->disp + etype_size * offset;
......@@ -565,9 +563,7 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count,
else {
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
k = num = buf_count = 0;
i = (int) (flat_buf->indices[0]);
......
......@@ -112,9 +112,7 @@ void ADIOI_PIOFS_WriteStrided(ADIO_File fd, void *buf, int count,
/* noncontiguous in memory, contiguous in file. use writev */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
/* There is a limit of 16 on the number of iovecs for readv/writev! */
......@@ -258,9 +256,7 @@ void ADIOI_PIOFS_WriteStrided(ADIO_File fd, void *buf, int count,
else {
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
k = num = buf_count = 0;
indx = flat_buf->indices[0];
......
......@@ -171,9 +171,7 @@ void ADIOI_PVFS_ReadStridedListIO(ADIO_File fd, void *buf, int count,
int64_t file_offsets;
int32_t file_lengths;
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :
fd->disp + etype_size * offset;
......@@ -415,9 +413,7 @@ void ADIOI_PVFS_ReadStridedListIO(ADIO_File fd, void *buf, int count,
else {
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
size_read = 0;
n_filetypes = st_n_filetypes;
......
......@@ -150,9 +150,7 @@ void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count,
ADIO_Offset combine_buf_remain;
/* noncontiguous in memory, contiguous in file. use writev */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
/* allocate our "combine buffer" to pack data into before writing */
combine_buf = (char *) ADIOI_Malloc(fd->hints->ind_wr_buffer_size);
......@@ -366,9 +364,7 @@ void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count,
else {
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
k = num = buf_count = 0;
indx = flat_buf->indices[0];
......@@ -539,9 +535,7 @@ void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count,
int64_t file_offsets;
int32_t file_lengths;
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
off = fd->disp + etype_size * offset;
......@@ -808,9 +802,7 @@ void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count,
else {
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
size_wrote = 0;
n_filetypes = st_n_filetypes;
......
......@@ -82,10 +82,7 @@ int ADIOI_PVFS2_StridedListIO(ADIO_File fd, void *buf, int count,
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
if (buftype_is_contig == 0)
{
ADIOI_Flatten_datatype(datatype);
flat_buf_p = ADIOI_Flatlist;
while (flat_buf_p->type != datatype)
flat_buf_p = flat_buf_p->next;
flat_buf_p = ADIOI_Flatten_and_find(datatype);
}
else
{
......@@ -108,10 +105,7 @@ int ADIOI_PVFS2_StridedListIO(ADIO_File fd, void *buf, int count,
/* TODO: why does avery say this should already have been
* flattened in Open, but also says contig types don't get
* flattened */
ADIOI_Flatten_datatype(fd->filetype);
flat_file_p = ADIOI_Flatlist;
while (flat_file_p->type != fd->filetype)
flat_file_p = flat_file_p->next;
flat_file_p = ADIOI_Flatten_and_find(fd->filetype);
}
else
{
......
......@@ -93,9 +93,7 @@ void ADIOI_PVFS2_OldReadStrided(ADIO_File fd, void *buf, int count,
int64_t file_offset;
int32_t file_length;
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :
fd->disp + etype_size * offset;
......@@ -469,9 +467,7 @@ void ADIOI_PVFS2_OldReadStrided(ADIO_File fd, void *buf, int count,
else {
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
size_read = 0;
n_filetypes = st_n_filetypes;
......
......@@ -109,9 +109,7 @@ void ADIOI_PVFS2_OldWriteStrided(ADIO_File fd, const void *buf, int count,
int64_t file_offset;
int32_t file_length;
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
off = fd->disp + etype_size * offset;
......@@ -515,9 +513,7 @@ void ADIOI_PVFS2_OldWriteStrided(ADIO_File fd, const void *buf, int count,
else {
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
size_wrote = 0;
n_filetypes = st_n_filetypes;
......
......@@ -95,9 +95,7 @@ void ADIOI_ZOIDFS_ReadStrided(ADIO_File fd, void *buf, int count,
uint64_t file_offsets;
uint64_t file_lengths;
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :
fd->disp + etype_size * offset;
......@@ -410,9 +408,7 @@ void ADIOI_ZOIDFS_ReadStrided(ADIO_File fd, void *buf, int count,
else {
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
size_read = 0;
n_filetypes = st_n_filetypes;
......
......@@ -109,9 +109,7 @@ void ADIOI_ZOIDFS_WriteStrided(ADIO_File fd, void *buf, int count,
uint64_t file_offsets;
uint64_t file_lengths;
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
off = fd->disp + etype_size * offset;
......@@ -441,9 +439,7 @@ void ADIOI_ZOIDFS_WriteStrided(ADIO_File fd, void *buf, int count,
else {
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
size_wrote = 0;
n_filetypes = st_n_filetypes;
......
......@@ -150,10 +150,7 @@ void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type,
flat_mem_p->blocklens[0] = memtype_sz*count;
}
else {
ADIOI_Flatten_datatype(datatype);
flat_mem_p = ADIOI_Flatlist;
while (flat_mem_p->type != datatype)
flat_mem_p = flat_mem_p->next;
flat_mem_p = ADIOI_Flatten_and_find(datatype);
}
MPI_Type_extent(fd->filetype, &filetype_extent);
......
......@@ -589,7 +589,6 @@ static void ADIOI_Iread_and_exch(ADIOI_NBC_Request *nbc_req, int *error_code)
int i, j;
ADIO_Offset st_loc = -1, end_loc = -1;
ADIOI_Flatlist_node *flat_buf = NULL;
int coll_bufsize;
*error_code = MPI_SUCCESS; /* changed below if error */
......@@ -671,10 +670,7 @@ static void ADIOI_Iread_and_exch(ADIOI_NBC_Request *nbc_req, int *error_code)
ADIOI_Datatype_iscontig(datatype, &vars->buftype_is_contig);
if (!vars->buftype_is_contig) {
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
vars->flat_buf = flat_buf;
vars->flat_buf = ADIOI_Flatten_and_find(datatype);
}
MPI_Type_extent(datatype, &vars->buftype_extent);
......
......@@ -636,7 +636,6 @@ static void ADIOI_Iexch_and_write(ADIOI_NBC_Request *nbc_req, int *error_code)
int i, j;
ADIO_Offset st_loc = -1, end_loc = -1;
ADIOI_Flatlist_node *flat_buf = NULL;
int info_flag, coll_bufsize;
char *value;
......@@ -719,10 +718,7 @@ static void ADIOI_Iexch_and_write(ADIOI_NBC_Request *nbc_req, int *error_code)
ADIOI_Datatype_iscontig(datatype, &vars->buftype_is_contig);
if (!vars->buftype_is_contig) {
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
vars->flat_buf = flat_buf;
vars->flat_buf = ADIOI_Flatten_and_find(datatype);
}
MPI_Type_extent(datatype, &vars->buftype_extent);
......
......@@ -601,9 +601,7 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
if (!buftype_is_contig) {
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
}
MPI_Type_extent(datatype, &buftype_extent);
......
......@@ -115,9 +115,7 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count,
/* noncontiguous in memory, contiguous in file. */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :
fd->disp + (ADIO_Offset)etype_size * offset;
......@@ -321,9 +319,7 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count,
else {
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
k = num = buf_count = 0;
i_offset = flat_buf->indices[0];
......
......@@ -57,9 +57,7 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count,
int b_count;
/* noncontiguous in memory, contiguous in file. */
ADIOI_Flatten_datatype(buftype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != buftype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(buftype);
off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :
fd->disp + etype_size * offset;
......@@ -289,9 +287,7 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count,
ADIO_Offset i_offset, tmp_bufsize = 0;
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(buftype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != buftype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(buftype);
b_index = buf_count = 0;
i_offset = flat_buf->indices[0];
......
......@@ -402,9 +402,7 @@ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype
ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
if (!buftype_is_contig) {
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
}
MPI_Type_extent(datatype, &buftype_extent);
......
......@@ -84,9 +84,7 @@ void ADIOI_NOLOCK_WriteStrided(ADIO_File fd, const void *buf, int count,
ADIO_Offset combine_buf_remain;
/* noncontiguous in memory, contiguous in file. use writev */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
/* allocate our "combine buffer" to pack data into before writing */
combine_buf = (char *) ADIOI_Malloc(fd->hints->ind_wr_buffer_size);
......@@ -311,9 +309,7 @@ void ADIOI_NOLOCK_WriteStrided(ADIO_File fd, const void *buf, int count,
else {
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
k = num = buf_count = 0;
indx = flat_buf->indices[0];
......
......@@ -180,9 +180,7 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
/* noncontiguous in memory, contiguous in file. */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :
fd->disp + (ADIO_Offset)etype_size * offset;
......@@ -395,9 +393,7 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
else {
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(datatype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != datatype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(datatype);
k = num = buf_count = 0;
i_offset = flat_buf->indices[0];
......
......@@ -58,9 +58,7 @@ void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, const void *buf, int count,
int b_count;
/* noncontiguous in memory, contiguous in file. */
ADIOI_Flatten_datatype(buftype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != buftype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(buftype);
off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :
fd->disp + (ADIO_Offset)etype_size * offset;
......@@ -289,9 +287,7 @@ void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, const void *buf, int count,
ADIO_Offset i_offset, tmp_bufsize = 0;
/* noncontiguous in memory as well as in file */
ADIOI_Flatten_datatype(buftype);
flat_buf = ADIOI_Flatlist;
while (flat_buf->type != buftype) flat_buf = flat_buf->next;
flat_buf = ADIOI_Flatten_and_find(buftype);
b_index = buf_count = 0;
i_offset = flat_buf->indices[0];
......
......@@ -1195,3 +1195,12 @@ void ADIOI_Delete_flattened(MPI_Datatype datatype)
ADIOI_Free(flat);
}
}
ADIOI_Flatlist_node * ADIOI_Flatten_and_find(MPI_Datatype datatype)
{
ADIOI_Flatlist_node *node;
ADIOI_Flatten_datatype(datatype);
node = ADIOI_Flatlist;
while (node->type != datatype) node = node->next;
return node;
}
......@@ -109,9 +109,7 @@ void ADIOI_OneSidedWriteAggregation(ADIO_File fd,
if (!bufTypeIsContig) {
/* Flatten the non-contiguous source datatype.
*/
ADIOI_Flatten_datatype(datatype);
flatBuf = ADIOI_Flatlist;
while (flatBuf->type != datatype) flatBuf = flatBuf->next;
flatBuf = ADIOI_Flatten_and_find(datatype);
MPI_Type_extent(datatype, &bufTypeExtent);
#ifdef onesidedtrace
printf("flatBuf->count is %d bufTypeExtent is %d\n", flatBuf->count,bufTypeExtent);
......@@ -1126,9 +1124,7 @@ void ADIOI_OneSidedReadAggregation(ADIO_File fd,
if (!bufTypeIsContig) {
/* Flatten the non-contiguous source datatype.
*/
ADIOI_Flatten_datatype(datatype);
flatBuf = ADIOI_Flatlist;
while (flatBuf->type != datatype) flatBuf = flatBuf->next;
flatBuf = ADIOI_Flatten_and_find(datatype);
MPI_Type_extent(datatype, &bufTypeExtent);
}
#ifdef onesidedtrace
......
......@@ -351,6 +351,7 @@ void ADIOI_Flatten_datatype(MPI_Datatype type);
void ADIOI_Flatten(MPI_Datatype type, ADIOI_Flatlist_node *flat,
ADIO_Offset st_offset, MPI_Count *curr_index);
void ADIOI_Delete_flattened(MPI_Datatype datatype);
ADIOI_Flatlist_node * ADIOI_Flatten_and_find(MPI_Datatype);
MPI_Count ADIOI_Count_contiguous_blocks(MPI_Datatype type, MPI_Count *curr_index);
void ADIOI_Complete_async(int *error_code);
void *ADIOI_Malloc_fn(size_t size, int lineno, const char *fname);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment