[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2-198-g6fafa6d
Service Account
noreply at mpich.org
Thu Feb 18 11:01:03 CST 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".
The branch, master has been updated
via 6fafa6da19a200a6aeb147e58cfadbece3ef6685 (commit)
via a1f75282dfa0a868041b2a0a73d5d4925a5cebaa (commit)
via 1cafb32fe3c82fd6f79f528857fd1e12b3a2ec0e (commit)
via db4e7a4c8ccf64dec93b47f02b295ab610ba1b46 (commit)
via 226fb3468fee4f15a634948b6359e2fbb1084426 (commit)
from 7fee8d6406c73130f6ca311294fa37570455bf87 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/6fafa6da19a200a6aeb147e58cfadbece3ef6685
commit 6fafa6da19a200a6aeb147e58cfadbece3ef6685
Author: Rob Latham <robl at mcs.anl.gov>
Date: Fri Oct 2 14:18:58 2015 -0500
promote types to address 64-to-32 warnings
Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>
diff --git a/src/mpi/romio/adio/common/flatten.c b/src/mpi/romio/adio/common/flatten.c
index 5b5d887..d6b1013 100644
--- a/src/mpi/romio/adio/common/flatten.c
+++ b/src/mpi/romio/adio/common/flatten.c
@@ -122,14 +122,14 @@ ADIOI_Flatlist_node *ADIOI_Flatten_datatype(MPI_Datatype datatype)
void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat,
ADIO_Offset st_offset, MPI_Count *curr_index)
{
- int i, k, m, n, basic_num, nonzeroth, is_hindexed_block=0;
+ int k, m, n, is_hindexed_block=0;
int lb_updated=0;
int combiner, old_combiner, old_is_contig;
int nints, nadds, ntypes, old_nints, old_nadds, old_ntypes;
/* By using ADIO_Offset we preserve +/- sign and
avoid >2G integer arithmetic problems */
ADIO_Offset top_count;
- MPI_Count j, old_size, prev_index, num;
+ MPI_Count i, j, old_size, prev_index, basic_num, num, nonzeroth;
MPI_Aint old_extent;/* Assume extents are non-negative */
int *ints;
MPI_Aint *adds; /* Make no assumptions about +/- sign on these */
@@ -145,15 +145,15 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat,
DBG_FPRINTF(stderr,"ADIOI_Flatten:: nints %#X, nadds %#X, ntypes %#X\n",nints, nadds, ntypes);
for(i=0; i< nints; ++i)
{
- DBG_FPRINTF(stderr,"ADIOI_Flatten:: ints[%d]=%#X\n",i,ints[i]);
+ DBG_FPRINTF(stderr,"ADIOI_Flatten:: ints[%lld]=%#X\n",i,ints[i]);
}
for(i=0; i< nadds; ++i)
{
- DBG_FPRINTF(stderr,"ADIOI_Flatten:: adds[%d]="MPI_AINT_FMT_HEX_SPEC"\n",i,adds[i]);
+ DBG_FPRINTF(stderr,"ADIOI_Flatten:: adds[%lld]="MPI_AINT_FMT_HEX_SPEC"\n",i,adds[i]);
}
for(i=0; i< ntypes; ++i)
{
- DBG_FPRINTF(stderr,"ADIOI_Flatten:: types[%d]=%#llX\n",i,(unsigned long long)(unsigned long)types[i]);
+ DBG_FPRINTF(stderr,"ADIOI_Flatten:: types[%lld]=%#llX\n",i,(unsigned long long)(unsigned long)types[i]);
}
#endif
/* Chapter 4, page 83: when processing datatypes, note this item from the
http://git.mpich.org/mpich.git/commitdiff/a1f75282dfa0a868041b2a0a73d5d4925a5cebaa
commit a1f75282dfa0a868041b2a0a73d5d4925a5cebaa
Author: Rob Latham <robl at mcs.anl.gov>
Date: Wed Sep 30 15:55:09 2015 -0500
Removed unused variable
Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>
diff --git a/src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c b/src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c
index 0046a24..1d40c86 100644
--- a/src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c
+++ b/src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c
@@ -20,7 +20,7 @@ void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
char *value;
int flag;
ADIO_Offset stripe_val[3], str_factor = -1, str_unit=0, start_iodev=-1;
- int err, myrank;
+ int myrank;
static char myname[] = "ADIOI_LUSTRE_SETINFO";
value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
http://git.mpich.org/mpich.git/commitdiff/1cafb32fe3c82fd6f79f528857fd1e12b3a2ec0e
commit 1cafb32fe3c82fd6f79f528857fd1e12b3a2ec0e
Author: Rob Latham <robl at mcs.anl.gov>
Date: Tue Jan 19 16:34:39 2016 -0600
make romio flattening handle built-in types
we were not putting built-in types on the flattened type list. Now
that we store flattened information as an attribute on that type there's
no reason to treat built-in type special.
Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>
diff --git a/src/mpi/romio/adio/common/ad_aggregate_new.c b/src/mpi/romio/adio/common/ad_aggregate_new.c
index fa6fa1e..53b0210 100644
--- a/src/mpi/romio/adio/common/ad_aggregate_new.c
+++ b/src/mpi/romio/adio/common/ad_aggregate_new.c
@@ -78,7 +78,7 @@ void ADIOI_Calc_file_realms (ADIO_File fd, ADIO_Offset min_st_offset,
MPI_Type_contiguous ((max_end_offset - min_st_offset + 1), MPI_BYTE,
file_realm_types);
MPI_Type_commit (file_realm_types);
- ADIOI_Add_contig_flattened (*file_realm_types);
+ ADIOI_Flatten_datatype(*file_realm_types);
}
else if (fd->file_realm_st_offs == NULL) {
file_realm_st_offs = (ADIO_Offset *)
diff --git a/src/mpi/romio/adio/common/ad_coll_exch_new.c b/src/mpi/romio/adio/common/ad_coll_exch_new.c
index 3c957c9..7d02090 100644
--- a/src/mpi/romio/adio/common/ad_coll_exch_new.c
+++ b/src/mpi/romio/adio/common/ad_coll_exch_new.c
@@ -58,51 +58,6 @@ void ADIOI_Print_flatlist_node(ADIOI_Flatlist_node *flatlist_node_p)
fprintf(stderr, "\n");
}
-/* delete this function when the flatten code adds a flatteed representation to
- * built-in datatypes */
-/* Since ADIOI_Flatten_datatype won't add a contig datatype to the
- * ADIOI_Flatlist, we can force it to do so with this function. */
-ADIOI_Flatlist_node * ADIOI_Add_contig_flattened(MPI_Datatype contig_type)
-{
-#if 0
- MPI_Count contig_type_sz = -1;
- ADIOI_Flatlist_node *flat_node_p = ADIOI_Flatlist;
-
- /* Add contig type to the end of the list if it doesn't already
- * exist. */
- while (flat_node_p->next)
- {
- if (flat_node_p->type == contig_type)
- return flat_node_p;
- flat_node_p = flat_node_p->next;
- }
- if (flat_node_p->type == contig_type)
- return flat_node_p;
-
- MPI_Type_size_x(contig_type, &contig_type_sz);
- if ((flat_node_p->next = (ADIOI_Flatlist_node *) ADIOI_Malloc
- (sizeof(ADIOI_Flatlist_node))) == NULL)
- {
- fprintf(stderr, "ADIOI_Add_contig_flattened: malloc next failed\n");
- }
- flat_node_p = flat_node_p->next;
- flat_node_p->type = contig_type;
- if ((flat_node_p->blocklens = (ADIO_Offset *) ADIOI_Malloc(sizeof(ADIO_Offset))) == NULL)
- {
- fprintf(stderr, "ADIOI_Flatlist_node: malloc blocklens failed\n");
- }
- if ((flat_node_p->indices = (ADIO_Offset *)
- ADIOI_Malloc(sizeof(ADIO_Offset))) == NULL)
- {
- fprintf(stderr, "ADIOI_Flatlist_node: malloc indices failed\n");
- }
- flat_node_p->blocklens[0] = contig_type_sz;
- flat_node_p->indices[0] = 0;
- flat_node_p->count = 1;
- flat_node_p->next = NULL;
-#endif
- return NULL;
-}
/* ADIOI_Exchange_file_views - Sends all the aggregators the file
* views and file view states of the clients. It fills in the
@@ -150,7 +105,7 @@ void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type,
MPI_Type_extent(datatype, &memtype_extent);
if (memtype_sz == memtype_extent) {
memtype_is_contig = 1;
- flat_mem_p = ADIOI_Add_contig_flattened(datatype);
+ flat_mem_p = ADIOI_Flatten_and_find(datatype);
flat_mem_p->blocklens[0] = memtype_sz*count;
}
else {
diff --git a/src/mpi/romio/adio/common/ad_set_view.c b/src/mpi/romio/adio/common/ad_set_view.c
index 1e9e803..449cf22 100644
--- a/src/mpi/romio/adio/common/ad_set_view.c
+++ b/src/mpi/romio/adio/common/ad_set_view.c
@@ -48,10 +48,8 @@ void ADIO_Set_view(ADIO_File fd, ADIO_Offset disp, MPI_Datatype etype,
MPI_Type_contiguous(1, filetype, ©_filetype);
MPI_Type_commit(©_filetype);
fd->filetype = copy_filetype;
- ADIOI_Flatten_datatype(fd->filetype);
- /* this function will not flatten the filetype if it turns out
- to be all contiguous. */
}
+ ADIOI_Flatten_datatype(fd->filetype);
MPI_Type_size_x(fd->etype, &(fd->etype_size));
fd->disp = disp;
diff --git a/src/mpi/romio/adio/common/flatten.c b/src/mpi/romio/adio/common/flatten.c
index af8beae..5b5d887 100644
--- a/src/mpi/romio/adio/common/flatten.c
+++ b/src/mpi/romio/adio/common/flatten.c
@@ -11,6 +11,24 @@
#define FLATTEN_DEBUG 1
#endif
+static ADIOI_Flatlist_node* flatlist_node_new(MPI_Datatype datatype,
+ MPI_Count count)
+{
+ ADIOI_Flatlist_node * flat;
+ flat = ADIOI_Malloc(sizeof(ADIOI_Flatlist_node));
+
+ flat->type = datatype;
+ flat->blocklens = NULL;
+ flat->indices = NULL;
+ flat->lb_idx = flat->ub_idx = -1;
+ flat->refct = 1;
+ flat->count = count;
+
+ flat->blocklens = (ADIO_Offset *) ADIOI_Malloc(flat->count * sizeof(ADIO_Offset));
+ flat->indices = (ADIO_Offset *) ADIOI_Malloc(flat->count * sizeof(ADIO_Offset));
+ return flat;
+}
+
void ADIOI_Optimize_flattened(ADIOI_Flatlist_node *flat_type);
/* flatten datatype and add it to Flatlist */
ADIOI_Flatlist_node *ADIOI_Flatten_datatype(MPI_Datatype datatype)
@@ -18,7 +36,7 @@ ADIOI_Flatlist_node *ADIOI_Flatten_datatype(MPI_Datatype datatype)
#ifdef HAVE_MPIR_TYPE_FLATTEN
MPI_Aint flatten_idx;
#endif
- MPI_Count curr_index=0;
+ MPI_Count flat_count, curr_index=0;
int is_contig, flag;
ADIOI_Flatlist_node *flat;
@@ -31,12 +49,9 @@ ADIOI_Flatlist_node *ADIOI_Flatten_datatype(MPI_Datatype datatype)
/* check if necessary to flatten. */
- /* is it entirely contiguous? */
- ADIOI_Datatype_iscontig(datatype, &is_contig);
#ifdef FLATTEN_DEBUG
DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: is_contig %#X\n",is_contig);
#endif
- if (is_contig) return NULL;
/* has it already been flattened? */
MPI_Type_get_attr(datatype, ADIOI_Flattened_type_keyval, &flat, &flag);
@@ -47,26 +62,26 @@ ADIOI_Flatlist_node *ADIOI_Flatten_datatype(MPI_Datatype datatype)
return flat;
}
- /* flatten and add to the list */
- flat = ADIOI_Malloc(sizeof(ADIOI_Flatlist_node));
-
- flat->type = datatype;
- flat->blocklens = NULL;
- flat->indices = NULL;
- flat->lb_idx = flat->ub_idx = -1;
- flat->refct = 1;
-
- flat->count = ADIOI_Count_contiguous_blocks(datatype, &curr_index);
-#ifdef FLATTEN_DEBUG
- DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: count %llX, cur_idx = %#llX\n",flat->count,curr_index);
-#endif
-/* DBG_FPRINTF(stderr, "%d\n", flat->count);*/
-
- if (flat->count) {
- flat->blocklens = (ADIO_Offset *) ADIOI_Malloc(flat->count * sizeof(ADIO_Offset));
- flat->indices = (ADIO_Offset *) ADIOI_Malloc(flat->count * sizeof(ADIO_Offset));
+ /* is it entirely contiguous? */
+ ADIOI_Datatype_iscontig(datatype, &is_contig);
+ /* it would be great if ADIOI_Count_contiguous_blocks and the rest of the
+ * flattening code operated on the built-in named types, but
+ * it recursively processes types, stopping when it hits a named type. So
+ * we will do the little bit of work that named types require right here,
+ * and avoid touching the scary flattening code. */
+
+ if (is_contig)
+ flat_count = 1;
+ else {
+ flat_count = ADIOI_Count_contiguous_blocks(datatype, &curr_index);
}
-
+ /* flatten and add to datatype */
+ flat = flatlist_node_new(datatype, flat_count);
+ if (is_contig) {
+ MPI_Type_size_x(datatype, &(flat->blocklens[0]));
+ flat->indices[0] = 0;
+ } else {
+
curr_index = 0;
#ifdef HAVE_MPIR_TYPE_FLATTEN
flatten_idx = (MPI_Aint) flat->count;
@@ -94,6 +109,7 @@ ADIOI_Flatlist_node *ADIOI_Flatten_datatype(MPI_Datatype datatype)
);
}
#endif
+ }
MPI_Type_set_attr(datatype, ADIOI_Flattened_type_keyval, flat);
return flat;
http://git.mpich.org/mpich.git/commitdiff/db4e7a4c8ccf64dec93b47f02b295ab610ba1b46
commit db4e7a4c8ccf64dec93b47f02b295ab610ba1b46
Author: Rob Latham <robl at mcs.anl.gov>
Date: Mon Sep 21 17:39:21 2015 -0500
more places need to uses flatten_and_find
to lay the groundwork for more invasive type changes (using attributes
instead of global linked list) we need any place that follows the
global linked list of flattened types to use this accessor function
instead. Missed a few of those places in the change from last month.
Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>
diff --git a/src/mpi/romio/adio/ad_lustre/ad_lustre_wrstr.c b/src/mpi/romio/adio/ad_lustre/ad_lustre_wrstr.c
index 338d479..638636c 100644
--- a/src/mpi/romio/adio/ad_lustre/ad_lustre_wrstr.c
+++ b/src/mpi/romio/adio/ad_lustre/ad_lustre_wrstr.c
@@ -252,10 +252,7 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
fd->fp_ind = off;
} else {
/* noncontiguous in file */
- /* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype)
- flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
disp = fd->disp;
if (file_ptr_type == ADIO_INDIVIDUAL) {
diff --git a/src/mpi/romio/adio/ad_nfs/ad_nfs_read.c b/src/mpi/romio/adio/ad_nfs/ad_nfs_read.c
index e6a7141..8be751c 100644
--- a/src/mpi/romio/adio/ad_nfs/ad_nfs_read.c
+++ b/src/mpi/romio/adio/ad_nfs/ad_nfs_read.c
@@ -275,9 +275,7 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
else { /* noncontiguous in file */
-/* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
disp = fd->disp;
if (file_ptr_type == ADIO_INDIVIDUAL) {
diff --git a/src/mpi/romio/adio/ad_nfs/ad_nfs_write.c b/src/mpi/romio/adio/ad_nfs/ad_nfs_write.c
index 896338f..68f5d11 100644
--- a/src/mpi/romio/adio/ad_nfs/ad_nfs_write.c
+++ b/src/mpi/romio/adio/ad_nfs/ad_nfs_write.c
@@ -376,9 +376,7 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count,
else { /* noncontiguous in file */
-/* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
disp = fd->disp;
if (file_ptr_type == ADIO_INDIVIDUAL) {
diff --git a/src/mpi/romio/adio/ad_piofs/ad_piofs_write.c b/src/mpi/romio/adio/ad_piofs/ad_piofs_write.c
index 0d635a7..ffa5a87 100644
--- a/src/mpi/romio/adio/ad_piofs/ad_piofs_write.c
+++ b/src/mpi/romio/adio/ad_piofs/ad_piofs_write.c
@@ -171,9 +171,7 @@ void ADIOI_PIOFS_WriteStrided(ADIO_File fd, void *buf, int count,
/* find starting location in the file */
/* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
- disp = fd->disp;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
if (file_ptr_type == ADIO_INDIVIDUAL) {
offset = fd->fp_ind; /* in bytes */
diff --git a/src/mpi/romio/adio/ad_pvfs/ad_pvfs_read.c b/src/mpi/romio/adio/ad_pvfs/ad_pvfs_read.c
index 5bf5e5c..87b4394 100644
--- a/src/mpi/romio/adio/ad_pvfs/ad_pvfs_read.c
+++ b/src/mpi/romio/adio/ad_pvfs/ad_pvfs_read.c
@@ -244,8 +244,7 @@ void ADIOI_PVFS_ReadStridedListIO(ADIO_File fd, void *buf, int count,
/* noncontiguous in file */
/* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
disp = fd->disp;
diff --git a/src/mpi/romio/adio/ad_pvfs/ad_pvfs_write.c b/src/mpi/romio/adio/ad_pvfs/ad_pvfs_write.c
index b83c798..a1e4d18 100644
--- a/src/mpi/romio/adio/ad_pvfs/ad_pvfs_write.c
+++ b/src/mpi/romio/adio/ad_pvfs/ad_pvfs_write.c
@@ -267,8 +267,7 @@ void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count,
/* find starting location in the file */
/* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
disp = fd->disp;
if (file_ptr_type == ADIO_INDIVIDUAL) {
@@ -631,8 +630,7 @@ void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count,
/* noncontiguous in file */
/* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
disp = fd->disp;
diff --git a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_io_dtype.c b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_io_dtype.c
index 0901252..b96825a 100644
--- a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_io_dtype.c
+++ b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_io_dtype.c
@@ -28,7 +28,7 @@ int ADIOI_PVFS2_StridedDtypeIO(ADIO_File fd, void *buf, int count,
int i = -1;
MPI_Count etype_size;
PVFS_size pvfs_disp = -1;
- ADIOI_Flatlist_node *flat_file_p = ADIOI_Flatlist;
+ ADIOI_Flatlist_node *flat_file_p;
/* Use for offseting the PVFS2 filetype */
int pvfs_blk = 1;
@@ -79,11 +79,7 @@ int ADIOI_PVFS2_StridedDtypeIO(ADIO_File fd, void *buf, int count,
else
{
int flag = 0;
- /* Should have already been flattened in ADIO_Open*/
- while (flat_file_p->type != fd->filetype)
- {
- flat_file_p = flat_file_p->next;
- }
+ flat_file_p = ADIOI_Flatten_and_find(fd->filetype);
num_filetypes = -1;
while (!flag)
{
diff --git a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c
index ebb5f8f..d85dcf5 100644
--- a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c
+++ b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c
@@ -63,8 +63,7 @@ void ADIOI_PVFS2_OldReadStrided(ADIO_File fd, void *buf, int count,
* lines down below). We added a workaround, but common HDF5 file types
* are actually contiguous and do not need the expensive workarond */
if (!filetype_is_contig) {
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
if (flat_file->count == 1 && !buftype_is_contig)
filetype_is_contig = 1;
}
@@ -195,8 +194,7 @@ void ADIOI_PVFS2_OldReadStrided(ADIO_File fd, void *buf, int count,
/* noncontiguous in file */
/* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
disp = fd->disp;
initial_off = offset;
diff --git a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c
index 281064c..af7f734 100644
--- a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c
+++ b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c
@@ -79,8 +79,7 @@ void ADIOI_PVFS2_OldWriteStrided(ADIO_File fd, const void *buf, int count,
* lines down below). We added a workaround, but common HDF5 file types
* are actually contiguous and do not need the expensive workarond */
if (!filetype_is_contig) {
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
if (flat_file->count == 1 && !buftype_is_contig)
filetype_is_contig = 1;
}
@@ -237,8 +236,7 @@ void ADIOI_PVFS2_OldWriteStrided(ADIO_File fd, const void *buf, int count,
/* noncontiguous in file */
/* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_flie = ADIOI_Flatten_and_find(fd->filetype);
disp = fd->disp;
initial_off = offset;
diff --git a/src/mpi/romio/adio/ad_testfs/ad_testfs_seek.c b/src/mpi/romio/adio/ad_testfs/ad_testfs_seek.c
index df6d30a..9d10ee2 100644
--- a/src/mpi/romio/adio/ad_testfs/ad_testfs_seek.c
+++ b/src/mpi/romio/adio/ad_testfs/ad_testfs_seek.c
@@ -44,8 +44,7 @@ ADIO_Offset ADIOI_TESTFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset,
if (filetype_is_contig) off = fd->disp + etype_size * offset;
else {
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
MPI_Type_extent(fd->filetype, &filetype_extent);
MPI_Type_size_x(fd->filetype, &filetype_size);
diff --git a/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c b/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c
index 4178750..26407df 100644
--- a/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c
+++ b/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c
@@ -65,8 +65,7 @@ void ADIOI_ZOIDFS_ReadStrided(ADIO_File fd, void *buf, int count,
* lines down below). We added a workaround, but common HDF5 file types
* are actually contiguous and do not need the expensive workarond */
if (!filetype_is_contig) {
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
if (flat_file->count == 1 && !buftype_is_contig)
filetype_is_contig = 1;
}
@@ -190,8 +189,7 @@ void ADIOI_ZOIDFS_ReadStrided(ADIO_File fd, void *buf, int count,
/* noncontiguous in file */
/* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
disp = fd->disp;
initial_off = offset;
diff --git a/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c b/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c
index 9d417de..6c41f2a 100644
--- a/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c
+++ b/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c
@@ -79,8 +79,7 @@ void ADIOI_ZOIDFS_WriteStrided(ADIO_File fd, void *buf, int count,
* lines down below). We added a workaround, but common HDF5 file types
* are actually contiguous and do not need the expensive workarond */
if (!filetype_is_contig) {
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
if (flat_file->count == 1 && !buftype_is_contig)
filetype_is_contig = 1;
}
@@ -217,8 +216,7 @@ void ADIOI_ZOIDFS_WriteStrided(ADIO_File fd, void *buf, int count,
/* noncontiguous in file */
/* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
disp = fd->disp;
initial_off = offset;
diff --git a/src/mpi/romio/adio/common/ad_coll_build_req_new.c b/src/mpi/romio/adio/common/ad_coll_build_req_new.c
index 2ea9754..4e088c5 100644
--- a/src/mpi/romio/adio/common/ad_coll_build_req_new.c
+++ b/src/mpi/romio/adio/common/ad_coll_build_req_new.c
@@ -281,12 +281,11 @@ static inline int get_next_fr_off(ADIO_File fd,
{
MPI_Aint fr_extent = -1;
ADIO_Offset tmp_off, off_rem;
- ADIOI_Flatlist_node *fr_node_p = ADIOI_Flatlist;
+ ADIOI_Flatlist_node *fr_node_p;
int i = -1, fr_dtype_ct = 0;
/* Should have already been flattened in calc_file_realms() */
- while (fr_node_p->type != (*fr_type_p))
- fr_node_p = fr_node_p->next;
+ fr_node_p = ADIOI_Flatten_and_find(*fr_type_p);
assert(fr_node_p != NULL);
/* Did we get to the first region of the file realm? */
diff --git a/src/mpi/romio/adio/common/ad_coll_exch_new.c b/src/mpi/romio/adio/common/ad_coll_exch_new.c
index 8b14fcc..3c957c9 100644
--- a/src/mpi/romio/adio/common/ad_coll_exch_new.c
+++ b/src/mpi/romio/adio/common/ad_coll_exch_new.c
@@ -159,17 +159,12 @@ void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type,
MPI_Type_extent(fd->filetype, &filetype_extent);
MPI_Type_size_x(fd->filetype, &filetype_sz);
+ flat_file_p = ADIOI_Flatten_and_find(fd->filetype);
if (filetype_extent == filetype_sz) {
- flat_file_p = ADIOI_Add_contig_flattened(fd->filetype);
flat_file_p->blocklens[0] = memtype_sz*count;
filetype_extent = memtype_sz*count;
filetype_sz = filetype_extent;
}
- else {
- flat_file_p = ADIOI_Flatlist;
- while (flat_file_p->type != fd->filetype)
- flat_file_p = flat_file_p->next;
- }
disp_off_sz_ext_typesz[0] = fd->fp_ind;
disp_off_sz_ext_typesz[1] = fd->disp;
@@ -469,7 +464,7 @@ void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type,
#ifdef DEBUG
if (fd->is_agg == 1)
{
- ADIOI_Flatlist_node *fr_node_p = ADIOI_Flatlist;
+ ADIOI_Flatlist_node *fr_node_p;
for (i = 0; i < nprocs; i++)
{
fprintf(stderr, "client_file_view_state_arr[%d]=(fp_ind=%Ld,"
@@ -481,9 +476,8 @@ void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type,
client_file_view_state_arr[i].ext);
}
- while (fr_node_p->type !=
- fd->file_realm_types[fd->my_cb_nodes_index])
- fr_node_p = fr_node_p->next;
+ fr_node_p =
+ ADIOI_Flatten_and_find(fd->file_realm_types[fd->my-cb_nodes_index]);
assert(fr_node_p != NULL);
fprintf(stderr, "my file realm (idx=%d,st_off=%Ld) ",
diff --git a/src/mpi/romio/adio/common/ad_io_coll.c b/src/mpi/romio/adio/common/ad_io_coll.c
index 0afb43d..e2c4f16 100644
--- a/src/mpi/romio/adio/common/ad_io_coll.c
+++ b/src/mpi/romio/adio/common/ad_io_coll.c
@@ -733,8 +733,7 @@ void ADIOI_Calc_bounds (ADIO_File fd, int count, MPI_Datatype buftype,
end_byte_off = st_byte_off + total_io - 1;
}
else {
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
/* we need to take care of some weirdness since fd->fp_ind
points at an accessible byte in file. the first accessible
diff --git a/src/mpi/romio/adio/common/ad_read_coll.c b/src/mpi/romio/adio/common/ad_read_coll.c
index 3c5c946..4a73112 100644
--- a/src/mpi/romio/adio/common/ad_read_coll.c
+++ b/src/mpi/romio/adio/common/ad_read_coll.c
@@ -350,9 +350,7 @@ void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype
/* First calculate what size of offset_list and len_list to allocate */
- /* filetype already flattened in ADIO_Open or ADIO_Fcntl */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
disp = fd->disp;
#ifdef RDCOLL_DEBUG
diff --git a/src/mpi/romio/adio/common/ad_read_str.c b/src/mpi/romio/adio/common/ad_read_str.c
index c4712ca..08c1389 100644
--- a/src/mpi/romio/adio/common/ad_read_str.c
+++ b/src/mpi/romio/adio/common/ad_read_str.c
@@ -155,9 +155,7 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count,
else { /* noncontiguous in file */
-/* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
disp = fd->disp;
if (file_ptr_type == ADIO_INDIVIDUAL) {
diff --git a/src/mpi/romio/adio/common/ad_read_str_naive.c b/src/mpi/romio/adio/common/ad_read_str_naive.c
index 366f35a..aad8c5e 100644
--- a/src/mpi/romio/adio/common/ad_read_str_naive.c
+++ b/src/mpi/romio/adio/common/ad_read_str_naive.c
@@ -127,9 +127,7 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count,
*
*/
- /* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
disp = fd->disp;
if (file_ptr_type == ADIO_INDIVIDUAL) {
diff --git a/src/mpi/romio/adio/common/ad_seek.c b/src/mpi/romio/adio/common/ad_seek.c
index ceaf6f2..78fa5c1 100644
--- a/src/mpi/romio/adio/common/ad_seek.c
+++ b/src/mpi/romio/adio/common/ad_seek.c
@@ -37,8 +37,7 @@ ADIO_Offset ADIOI_GEN_SeekIndividual(ADIO_File fd, ADIO_Offset offset,
if (filetype_is_contig) off = fd->disp + etype_size * offset;
else {
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
MPI_Type_extent(fd->filetype, &filetype_extent);
MPI_Type_size_x(fd->filetype, &filetype_size);
diff --git a/src/mpi/romio/adio/common/ad_set_view.c b/src/mpi/romio/adio/common/ad_set_view.c
index 0befbb9..1e9e803 100644
--- a/src/mpi/romio/adio/common/ad_set_view.c
+++ b/src/mpi/romio/adio/common/ad_set_view.c
@@ -62,9 +62,7 @@ void ADIO_Set_view(ADIO_File fd, ADIO_Offset disp, MPI_Datatype etype,
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
if (filetype_is_contig) fd->fp_ind = disp;
else {
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype)
- flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
for (i=0; i<flat_file->count; i++) {
if (flat_file->blocklens[i]) {
fd->fp_ind = disp + flat_file->indices[i];
diff --git a/src/mpi/romio/adio/common/ad_write_nolock.c b/src/mpi/romio/adio/common/ad_write_nolock.c
index 535e4a8..e73e01a 100644
--- a/src/mpi/romio/adio/common/ad_write_nolock.c
+++ b/src/mpi/romio/adio/common/ad_write_nolock.c
@@ -204,10 +204,8 @@ void ADIOI_NOLOCK_WriteStrided(ADIO_File fd, const void *buf, int count,
/* find starting location in the file */
-/* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
- disp = fd->disp;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
+ disp = fd->disp;
if (file_ptr_type == ADIO_INDIVIDUAL) {
offset = fd->fp_ind; /* in bytes */
diff --git a/src/mpi/romio/adio/common/ad_write_str.c b/src/mpi/romio/adio/common/ad_write_str.c
index df213ca..878bc6e 100644
--- a/src/mpi/romio/adio/common/ad_write_str.c
+++ b/src/mpi/romio/adio/common/ad_write_str.c
@@ -220,9 +220,7 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
else { /* noncontiguous in file */
-/* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
disp = fd->disp;
if (file_ptr_type == ADIO_INDIVIDUAL) {
diff --git a/src/mpi/romio/adio/common/ad_write_str_naive.c b/src/mpi/romio/adio/common/ad_write_str_naive.c
index b236d35..74f8121 100644
--- a/src/mpi/romio/adio/common/ad_write_str_naive.c
+++ b/src/mpi/romio/adio/common/ad_write_str_naive.c
@@ -127,9 +127,7 @@ void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, const void *buf, int count,
*
*/
- /* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
disp = fd->disp;
if (file_ptr_type == ADIO_INDIVIDUAL) {
diff --git a/src/mpi/romio/adio/common/byte_offset.c b/src/mpi/romio/adio/common/byte_offset.c
index df0a240..94bcee5 100644
--- a/src/mpi/romio/adio/common/byte_offset.c
+++ b/src/mpi/romio/adio/common/byte_offset.c
@@ -25,9 +25,7 @@ void ADIOI_Get_byte_offset(ADIO_File fd, ADIO_Offset offset, ADIO_Offset *disp)
if (filetype_is_contig) *disp = fd->disp + etype_size * offset;
else {
-/* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
MPI_Type_size_x(fd->filetype, &filetype_size);
n_etypes_in_filetype = filetype_size/etype_size;
diff --git a/src/mpi/romio/adio/common/eof_offset.c b/src/mpi/romio/adio/common/eof_offset.c
index 0fb3539..a16bf6b 100644
--- a/src/mpi/romio/adio/common/eof_offset.c
+++ b/src/mpi/romio/adio/common/eof_offset.c
@@ -39,10 +39,7 @@ void ADIOI_Get_eof_offset(ADIO_File fd, ADIO_Offset *eof_offset)
*eof_offset = (fsize - fd->disp + etype_size - 1)/etype_size;
/* ceiling division in case fsize is not a multiple of etype_size;*/
else {
- /* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype)
- flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
MPI_Type_size_x(fd->filetype, &filetype_size);
MPI_Type_extent(fd->filetype, &filetype_extent);
diff --git a/src/mpi/romio/adio/common/get_fp_posn.c b/src/mpi/romio/adio/common/get_fp_posn.c
index 671dde3..68092fa 100644
--- a/src/mpi/romio/adio/common/get_fp_posn.c
+++ b/src/mpi/romio/adio/common/get_fp_posn.c
@@ -26,9 +26,7 @@ void ADIOI_Get_position(ADIO_File fd, ADIO_Offset *offset)
if (filetype_is_contig) *offset = (fd->fp_ind - fd->disp)/etype_size;
else {
-/* filetype already flattened in ADIO_Open */
- flat_file = ADIOI_Flatlist;
- while (flat_file->type != fd->filetype) flat_file = flat_file->next;
+ flat_file = ADIOI_Flatten_and_find(fd->filetype);
MPI_Type_size_x(fd->filetype, &filetype_size);
MPI_Type_extent(fd->filetype, &filetype_extent);
http://git.mpich.org/mpich.git/commitdiff/226fb3468fee4f15a634948b6359e2fbb1084426
commit 226fb3468fee4f15a634948b6359e2fbb1084426
Author: Rob Latham <robl at mcs.anl.gov>
Date: Mon Sep 21 15:27:54 2015 -0500
store flattened rep as an attribute on datatype
Instead of appending datatypes to a global linked list, store the
flattened representation on the datatype itself. Storing flattened
representation as attribute will be less error prone, simplifies
ROMIO bookkeeping and memory management, and gets rid of a few global
variables.
Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>
diff --git a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_rdcoll.c b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_rdcoll.c
index c8db75d..755ae63 100644
--- a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_rdcoll.c
+++ b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_rdcoll.c
@@ -464,7 +464,6 @@ void ADIOI_GPFS_ReadStridedColl(ADIO_File fd, void *buf, int count,
GPFSMPIO_T_CIO_REPORT( 0, fd, myrank, nprocs)
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
/* free all memory allocated for collective I/O */
for (i=0; i<nprocs; i++) {
diff --git a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_wrcoll.c b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_wrcoll.c
index d2c507c..19eff8e 100644
--- a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_wrcoll.c
+++ b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_wrcoll.c
@@ -471,7 +471,6 @@ void ADIOI_GPFS_WriteStridedColl(ADIO_File fd, const void *buf, int count,
GPFSMPIO_T_CIO_REPORT( 1, fd, myrank, nprocs)
/* free all memory allocated for collective I/O */
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
for (i=0; i<nprocs; i++) {
if (others_req[i].count) {
diff --git a/src/mpi/romio/adio/ad_lustre/ad_lustre_wrcoll.c b/src/mpi/romio/adio/ad_lustre/ad_lustre_wrcoll.c
index af5c40b..7250a21 100644
--- a/src/mpi/romio/adio/ad_lustre/ad_lustre_wrcoll.c
+++ b/src/mpi/romio/adio/ad_lustre/ad_lustre_wrcoll.c
@@ -233,9 +233,6 @@ void ADIOI_LUSTRE_WriteStridedColl(ADIO_File fd, const void *buf, int count,
*error_code = old_error;
- if (!buftype_is_contig)
- ADIOI_Delete_flattened(datatype);
-
/* free all memory allocated for collective I/O */
/* free others_req */
for (i = 0; i < nprocs; i++) {
diff --git a/src/mpi/romio/adio/ad_lustre/ad_lustre_wrstr.c b/src/mpi/romio/adio/ad_lustre/ad_lustre_wrstr.c
index 1e69575..338d479 100644
--- a/src/mpi/romio/adio/ad_lustre/ad_lustre_wrstr.c
+++ b/src/mpi/romio/adio/ad_lustre/ad_lustre_wrstr.c
@@ -522,6 +522,4 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */
#endif
- if (!buftype_is_contig)
- ADIOI_Delete_flattened(datatype);
}
diff --git a/src/mpi/romio/adio/ad_nfs/ad_nfs_read.c b/src/mpi/romio/adio/ad_nfs/ad_nfs_read.c
index a183c6d..e6a7141 100644
--- a/src/mpi/romio/adio/ad_nfs/ad_nfs_read.c
+++ b/src/mpi/romio/adio/ad_nfs/ad_nfs_read.c
@@ -545,5 +545,4 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
by ADIOI_BUFFERED_READ. */
#endif
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
}
diff --git a/src/mpi/romio/adio/ad_nfs/ad_nfs_write.c b/src/mpi/romio/adio/ad_nfs/ad_nfs_write.c
index 2df8df6..896338f 100644
--- a/src/mpi/romio/adio/ad_nfs/ad_nfs_write.c
+++ b/src/mpi/romio/adio/ad_nfs/ad_nfs_write.c
@@ -667,7 +667,6 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count,
keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */
#endif
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
fn_exit:
if (writebuf != NULL) ADIOI_Free(writebuf);
diff --git a/src/mpi/romio/adio/ad_piofs/ad_piofs_write.c b/src/mpi/romio/adio/ad_piofs/ad_piofs_write.c
index 252424a..0d635a7 100644
--- a/src/mpi/romio/adio/ad_piofs/ad_piofs_write.c
+++ b/src/mpi/romio/adio/ad_piofs/ad_piofs_write.c
@@ -336,5 +336,4 @@ void ADIOI_PIOFS_WriteStrided(ADIO_File fd, void *buf, int count,
keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */
#endif
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
}
diff --git a/src/mpi/romio/adio/ad_pvfs/ad_pvfs_read.c b/src/mpi/romio/adio/ad_pvfs/ad_pvfs_read.c
index 3495145..5bf5e5c 100644
--- a/src/mpi/romio/adio/ad_pvfs/ad_pvfs_read.c
+++ b/src/mpi/romio/adio/ad_pvfs/ad_pvfs_read.c
@@ -236,7 +236,6 @@ void ADIOI_PVFS_ReadStridedListIO(ADIO_File fd, void *buf, int count,
keep tracke of how much data was actually read adn placed in buf
by ADIOI_BUFFERED_READ. */
#endif
- ADIOI_Delete_flattened(datatype);
return;
} /* if (!buftype_is_contig && filetype_is_contig) */
@@ -779,6 +778,5 @@ void ADIOI_PVFS_ReadStridedListIO(ADIO_File fd, void *buf, int count,
by ADIOI_BUFFERED_READ. */
#endif
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
}
#endif /* HAVE_PVFS_LISTIO */
diff --git a/src/mpi/romio/adio/ad_pvfs/ad_pvfs_write.c b/src/mpi/romio/adio/ad_pvfs/ad_pvfs_write.c
index 5113ad3..b83c798 100644
--- a/src/mpi/romio/adio/ad_pvfs/ad_pvfs_write.c
+++ b/src/mpi/romio/adio/ad_pvfs/ad_pvfs_write.c
@@ -450,7 +450,6 @@ void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count,
keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */
#endif
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
}
#ifdef HAVE_PVFS_LISTIO
@@ -625,7 +624,6 @@ void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count,
keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */
#endif
- ADIOI_Delete_flattened(datatype);
return;
} /* if (!buftype_is_contig && filetype_is_contig) */
@@ -1162,6 +1160,5 @@ void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count,
keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */
#endif
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
}
#endif /* HAVE_PVFS_LISTIO */
diff --git a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_io_list.c b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_io_list.c
index 39befcc..7394605 100644
--- a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_io_list.c
+++ b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_io_list.c
@@ -325,18 +325,14 @@ error_state:
/* This is a temporary way of filling in status. The right way is to
keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */
#endif
- if (buftype_is_contig == 0)
- ADIOI_Delete_flattened(datatype);
- else
+ if (buftype_is_contig != 0)
{
ADIOI_Free(flat_buf_p->blocklens);
ADIOI_Free(flat_buf_p->indices);
ADIOI_Free(flat_buf_p);
}
- if (filetype_is_contig == 0)
- ADIOI_Delete_flattened(fd->filetype);
- else
+ if (filetype_is_contig != 0)
{
ADIOI_Free(flat_file_p->blocklens);
ADIOI_Free(flat_file_p->indices);
diff --git a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c
index b85c3d2..ebb5f8f 100644
--- a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c
+++ b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c
@@ -187,7 +187,6 @@ void ADIOI_PVFS2_OldReadStrided(ADIO_File fd, void *buf, int count,
keep tracke of how much data was actually read adn placed in buf
by ADIOI_BUFFERED_READ. */
#endif
- ADIOI_Delete_flattened(datatype);
return;
} /* if (!buftype_is_contig && filetype_is_contig) */
@@ -646,7 +645,6 @@ void ADIOI_PVFS2_OldReadStrided(ADIO_File fd, void *buf, int count,
(new_buffer_read < flat_file->blocklens[0])) )
{
- ADIOI_Delete_flattened(datatype);
ADIOI_GEN_ReadStrided_naive(fd, buf, count, datatype,
file_ptr_type, initial_off, status, error_code);
return;
@@ -904,6 +902,5 @@ error_state:
by ADIOI_BUFFERED_READ. */
#endif
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
}
diff --git a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c
index 2f412e2..281064c 100644
--- a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c
+++ b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c
@@ -230,7 +230,6 @@ void ADIOI_PVFS2_OldWriteStrided(ADIO_File fd, const void *buf, int count,
keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */
#endif
- ADIOI_Delete_flattened(datatype);
return;
} /* if (!buftype_is_contig && filetype_is_contig) */
@@ -692,7 +691,6 @@ void ADIOI_PVFS2_OldWriteStrided(ADIO_File fd, const void *buf, int count,
( (mem_list_count == MAX_ARRAY_SIZE) &&
(new_buffer_write < flat_file->blocklens[0])) )
{
- ADIOI_Delete_flattened(datatype);
ADIOI_GEN_WriteStrided_naive(fd, buf, count, datatype,
file_ptr_type, initial_off, status, error_code);
return;
@@ -959,5 +957,4 @@ error_state:
keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */
#endif
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
}
diff --git a/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c b/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c
index 7422ecf..4178750 100644
--- a/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c
+++ b/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c
@@ -182,7 +182,6 @@ void ADIOI_ZOIDFS_ReadStrided(ADIO_File fd, void *buf, int count,
keep tracke of how much data was actually read adn placed in buf
by ADIOI_BUFFERED_READ. */
#endif
- ADIOI_Delete_flattened(datatype);
return;
} /* if (!buftype_is_contig && filetype_is_contig) */
@@ -587,7 +586,6 @@ void ADIOI_ZOIDFS_ReadStrided(ADIO_File fd, void *buf, int count,
(new_buffer_read < flat_file->blocklens[0])) )
{
- ADIOI_Delete_flattened(datatype);
ADIOI_GEN_ReadStrided_naive(fd, buf, count, datatype,
file_ptr_type, initial_off, status, error_code);
return;
@@ -821,6 +819,5 @@ error_state:
by ADIOI_BUFFERED_READ. */
#endif
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
}
diff --git a/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c b/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c
index f078ed4..9d417de 100644
--- a/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c
+++ b/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c
@@ -210,7 +210,6 @@ void ADIOI_ZOIDFS_WriteStrided(ADIO_File fd, void *buf, int count,
keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */
#endif
- ADIOI_Delete_flattened(datatype);
return;
} /* if (!buftype_is_contig && filetype_is_contig) */
@@ -618,7 +617,6 @@ void ADIOI_ZOIDFS_WriteStrided(ADIO_File fd, void *buf, int count,
( (mem_list_count == MAX_ARRAY_SIZE) &&
(new_buffer_write < flat_file->blocklens[0])) )
{
- ADIOI_Delete_flattened(datatype);
ADIOI_GEN_WriteStrided_naive(fd, buf, count, datatype,
file_ptr_type, initial_off, status, error_code);
return;
@@ -853,5 +851,4 @@ error_state:
keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */
#endif
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
}
diff --git a/src/mpi/romio/adio/common/ad_close.c b/src/mpi/romio/adio/common/ad_close.c
index 49bc8ad..c107b23 100644
--- a/src/mpi/romio/adio/common/ad_close.c
+++ b/src/mpi/romio/adio/common/ad_close.c
@@ -13,7 +13,7 @@
void ADIO_Close(ADIO_File fd, int *error_code)
{
- int i, j, k, combiner, myrank, err, is_contig;
+ int i, j, k, combiner, myrank, err;
static char myname[] = "ADIO_CLOSE";
if (fd->async_count) {
@@ -81,14 +81,10 @@ void ADIO_Close(ADIO_File fd, int *error_code)
if (fd->hints->cb_pfr == ADIOI_HINT_ENABLE) {
/* AAR, FSIZE, and User provided uniform File realms */
if (1) {
- ADIOI_Delete_flattened (fd->file_realm_types[0]);
MPI_Type_free (&fd->file_realm_types[0]);
}
else {
for (i=0; i<fd->hints->cb_nodes; i++) {
- ADIOI_Datatype_iscontig(fd->file_realm_types[i], &is_contig);
- if (!is_contig)
- ADIOI_Delete_flattened(fd->file_realm_types[i]);
MPI_Type_free (&fd->file_realm_types[i]);
}
}
@@ -105,9 +101,6 @@ void ADIO_Close(ADIO_File fd, int *error_code)
MPI_Type_get_envelope(fd->etype, &i, &j, &k, &combiner);
if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->etype));
- ADIOI_Datatype_iscontig(fd->filetype, &is_contig);
- if (!is_contig) ADIOI_Delete_flattened(fd->filetype);
-
MPI_Type_get_envelope(fd->filetype, &i, &j, &k, &combiner);
if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->filetype));
diff --git a/src/mpi/romio/adio/common/ad_coll_exch_new.c b/src/mpi/romio/adio/common/ad_coll_exch_new.c
index 9db2d98..8b14fcc 100644
--- a/src/mpi/romio/adio/common/ad_coll_exch_new.c
+++ b/src/mpi/romio/adio/common/ad_coll_exch_new.c
@@ -58,10 +58,13 @@ void ADIOI_Print_flatlist_node(ADIOI_Flatlist_node *flatlist_node_p)
fprintf(stderr, "\n");
}
+/* delete this function when the flatten code adds a flatteed representation to
+ * built-in datatypes */
/* Since ADIOI_Flatten_datatype won't add a contig datatype to the
* ADIOI_Flatlist, we can force it to do so with this function. */
ADIOI_Flatlist_node * ADIOI_Add_contig_flattened(MPI_Datatype contig_type)
{
+#if 0
MPI_Count contig_type_sz = -1;
ADIOI_Flatlist_node *flat_node_p = ADIOI_Flatlist;
@@ -97,7 +100,8 @@ ADIOI_Flatlist_node * ADIOI_Add_contig_flattened(MPI_Datatype contig_type)
flat_node_p->indices[0] = 0;
flat_node_p->count = 1;
flat_node_p->next = NULL;
- return flat_node_p;
+#endif
+ return NULL;
}
/* ADIOI_Exchange_file_views - Sends all the aggregators the file
diff --git a/src/mpi/romio/adio/common/ad_end.c b/src/mpi/romio/adio/common/ad_end.c
index ea4dfeb..88af934 100644
--- a/src/mpi/romio/adio/common/ad_end.c
+++ b/src/mpi/romio/adio/common/ad_end.c
@@ -9,7 +9,6 @@
void ADIO_End(int *error_code)
{
- ADIOI_Flatlist_node *curr, *next;
ADIOI_Datarep *datarep, *datarep_next;
/* FPRINTF(stderr, "reached end\n"); */
@@ -18,17 +17,6 @@ void ADIO_End(int *error_code)
* that our reference to that errhandler is released */
PMPI_File_set_errhandler(MPI_FILE_NULL, MPI_ERRORS_RETURN);
-/* delete the flattened datatype list */
- curr = ADIOI_Flatlist;
- while (curr) {
- if (curr->blocklens) ADIOI_Free(curr->blocklens);
- if (curr->indices) ADIOI_Free(curr->indices);
- next = curr->next;
- ADIOI_Free(curr);
- curr = next;
- }
- ADIOI_Flatlist = NULL;
-
/* free file and info tables used for Fortran interface */
if (ADIOI_Ftable) ADIOI_Free(ADIOI_Ftable);
#ifndef HAVE_MPI_INFO
@@ -54,7 +42,6 @@ void ADIO_End(int *error_code)
}
-
/* This is the delete callback function associated with
ADIO_Init_keyval when MPI_COMM_SELF is freed */
@@ -75,6 +62,9 @@ int ADIOI_End_call(MPI_Comm comm, int keyval, void *attribute_val, void
if (ADIOI_cb_config_list_keyval != MPI_KEYVAL_INVALID)
MPI_Keyval_free(&ADIOI_cb_config_list_keyval);
+ if (ADIOI_Flattened_type_keyval != MPI_KEYVAL_INVALID)
+ MPI_Type_free_keyval(&ADIOI_Flattened_type_keyval);
+
ADIO_End(&error_code);
return error_code;
}
diff --git a/src/mpi/romio/adio/common/ad_init.c b/src/mpi/romio/adio/common/ad_init.c
index 88e75a5..4fd56c8 100644
--- a/src/mpi/romio/adio/common/ad_init.c
+++ b/src/mpi/romio/adio/common/ad_init.c
@@ -7,7 +7,6 @@
#include "adio.h"
-ADIOI_Flatlist_node *ADIOI_Flatlist = NULL;
ADIOI_Datarep *ADIOI_Datarep_head = NULL;
/* list of datareps registered by the user */
@@ -60,13 +59,6 @@ void ADIO_Init(int *argc, char ***argv, int *error_code)
MPIR_Ext_init();
#endif
-/* initialize the linked list containing flattened datatypes */
- ADIOI_Flatlist = (ADIOI_Flatlist_node *) ADIOI_Malloc(sizeof(ADIOI_Flatlist_node));
- ADIOI_Flatlist->type = MPI_DATATYPE_NULL;
- ADIOI_Flatlist->next = NULL;
- ADIOI_Flatlist->blocklens = NULL;
- ADIOI_Flatlist->indices = NULL;
-
#if defined(ROMIO_XFS) || defined(ROMIO_LUSTRE)
c = getenv("MPIO_DIRECT_READ");
if (c && (!strcmp(c, "true") || !strcmp(c, "TRUE")))
diff --git a/src/mpi/romio/adio/common/ad_io_coll.c b/src/mpi/romio/adio/common/ad_io_coll.c
index c52bea0..0afb43d 100644
--- a/src/mpi/romio/adio/common/ad_io_coll.c
+++ b/src/mpi/romio/adio/common/ad_io_coll.c
@@ -631,14 +631,11 @@ void ADIOI_IOStridedColl (ADIO_File fd, void *buf, int count, int rdwr,
if (fd->hints->cb_pfr != ADIOI_HINT_ENABLE) {
/* AAR, FSIZE, and User provided uniform File realms */
if (1) {
- ADIOI_Delete_flattened (fd->file_realm_types[0]);
MPI_Type_free (&fd->file_realm_types[0]);
}
else {
for (i=0; i<fd->hints->cb_nodes; i++) {
ADIOI_Datatype_iscontig(fd->file_realm_types[i], &is_contig);
- if (!is_contig)
- ADIOI_Delete_flattened(fd->file_realm_types[i]);
MPI_Type_free (&fd->file_realm_types[i]);
}
}
@@ -646,11 +643,6 @@ void ADIOI_IOStridedColl (ADIO_File fd, void *buf, int count, int rdwr,
ADIOI_Free (fd->file_realm_st_offs);
}
- /* This memtype must be deleted from the ADIOI_Flatlist or else it
- * will match incorrectly with other datatypes which use this
- * pointer. */
- ADIOI_Delete_flattened(datatype);
- ADIOI_Delete_flattened(fd->filetype);
if (fd->is_agg) {
if (buffered_io_size > 0)
@@ -959,9 +951,6 @@ void ADIOI_IOFiletype(ADIO_File fd, void *buf, int count,
status, error_code);
}
- /* Delete flattened temporary filetype */
- if (!f_is_contig)
- ADIOI_Delete_flattened (custom_ftype);
/* restore the user specified file view to cover our tracks */
fd->filetype = user_filetype;
diff --git a/src/mpi/romio/adio/common/ad_iread_coll.c b/src/mpi/romio/adio/common/ad_iread_coll.c
index e0f92c4..1fe1a68 100644
--- a/src/mpi/romio/adio/common/ad_iread_coll.c
+++ b/src/mpi/romio/adio/common/ad_iread_coll.c
@@ -515,12 +515,10 @@ static void ADIOI_GEN_IreadStridedColl_free(ADIOI_NBC_Request *nbc_req,
{
ADIOI_GEN_IreadStridedColl_vars *vars = nbc_req->data.rd.rsc_vars;
ADIO_File fd = vars->fd;
- MPI_Datatype datatype = vars->datatype;
ADIOI_Access *others_req = vars->others_req;
int nprocs = vars->nprocs;
int i;
- if (!vars->buftype_is_contig) ADIOI_Delete_flattened(datatype);
/* free all memory allocated for collective I/O */
for (i = 0; i < nprocs; i++) {
diff --git a/src/mpi/romio/adio/common/ad_iwrite_coll.c b/src/mpi/romio/adio/common/ad_iwrite_coll.c
index 9796d9a..9d50b2c 100644
--- a/src/mpi/romio/adio/common/ad_iwrite_coll.c
+++ b/src/mpi/romio/adio/common/ad_iwrite_coll.c
@@ -549,7 +549,6 @@ static void ADIOI_GEN_IwriteStridedColl_free(ADIOI_NBC_Request *nbc_req,
{
ADIOI_GEN_IwriteStridedColl_vars *vars = nbc_req->data.wr.wsc_vars;
ADIO_File fd = vars->fd;
- MPI_Datatype datatype = vars->datatype;
ADIOI_Access *others_req = vars->others_req;
int nprocs = vars->nprocs;
int old_error = vars->old_error;
@@ -566,8 +565,6 @@ static void ADIOI_GEN_IwriteStridedColl_free(ADIOI_NBC_Request *nbc_req,
*error_code = old_error;
- if (!vars->buftype_is_contig) ADIOI_Delete_flattened(datatype);
-
/* free all memory allocated for collective I/O */
for (i = 0; i < nprocs; i++) {
if (others_req[i].count) {
diff --git a/src/mpi/romio/adio/common/ad_read_coll.c b/src/mpi/romio/adio/common/ad_read_coll.c
index 6cd5d93..3c5c946 100644
--- a/src/mpi/romio/adio/common/ad_read_coll.c
+++ b/src/mpi/romio/adio/common/ad_read_coll.c
@@ -242,7 +242,6 @@ void ADIOI_GEN_ReadStridedColl(ADIO_File fd, void *buf, int count,
len_list, contig_access_count, min_st_offset,
fd_size, fd_start, fd_end, buf_idx, error_code);
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
/* free all memory allocated for collective I/O */
for (i=0; i<nprocs; i++) {
diff --git a/src/mpi/romio/adio/common/ad_read_str.c b/src/mpi/romio/adio/common/ad_read_str.c
index 8cd6f53..c4712ca 100644
--- a/src/mpi/romio/adio/common/ad_read_str.c
+++ b/src/mpi/romio/adio/common/ad_read_str.c
@@ -399,5 +399,4 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count,
by ADIOI_BUFFERED_READ. */
#endif
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
}
diff --git a/src/mpi/romio/adio/common/ad_read_str_naive.c b/src/mpi/romio/adio/common/ad_read_str_naive.c
index b875804..366f35a 100644
--- a/src/mpi/romio/adio/common/ad_read_str_naive.c
+++ b/src/mpi/romio/adio/common/ad_read_str_naive.c
@@ -376,5 +376,4 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count,
*/
#endif
- if (!buftype_is_contig) ADIOI_Delete_flattened(buftype);
}
diff --git a/src/mpi/romio/adio/common/ad_set_view.c b/src/mpi/romio/adio/common/ad_set_view.c
index 31aa6c6..0befbb9 100644
--- a/src/mpi/romio/adio/common/ad_set_view.c
+++ b/src/mpi/romio/adio/common/ad_set_view.c
@@ -25,7 +25,6 @@ void ADIO_Set_view(ADIO_File fd, ADIO_Offset disp, MPI_Datatype etype,
if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->etype));
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
- if (!filetype_is_contig) ADIOI_Delete_flattened(fd->filetype);
MPI_Type_get_envelope(fd->filetype, &i, &j, &k, &combiner);
if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->filetype));
diff --git a/src/mpi/romio/adio/common/ad_write_coll.c b/src/mpi/romio/adio/common/ad_write_coll.c
index b294efe..18f70b9 100644
--- a/src/mpi/romio/adio/common/ad_write_coll.c
+++ b/src/mpi/romio/adio/common/ad_write_coll.c
@@ -248,8 +248,6 @@ void ADIOI_GEN_WriteStridedColl(ADIO_File fd, const void *buf, int count,
*error_code = old_error;
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
-
/* free all memory allocated for collective I/O */
for (i=0; i<nprocs; i++) {
diff --git a/src/mpi/romio/adio/common/ad_write_nolock.c b/src/mpi/romio/adio/common/ad_write_nolock.c
index 2e77a1f..535e4a8 100644
--- a/src/mpi/romio/adio/common/ad_write_nolock.c
+++ b/src/mpi/romio/adio/common/ad_write_nolock.c
@@ -402,5 +402,4 @@ void ADIOI_NOLOCK_WriteStrided(ADIO_File fd, const void *buf, int count,
keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */
#endif
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
}
diff --git a/src/mpi/romio/adio/common/ad_write_str.c b/src/mpi/romio/adio/common/ad_write_str.c
index 21ca8e8..df213ca 100644
--- a/src/mpi/romio/adio/common/ad_write_str.c
+++ b/src/mpi/romio/adio/common/ad_write_str.c
@@ -479,7 +479,6 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */
#endif
- if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
fn_exit:
if (writebuf != NULL) ADIOI_Free(writebuf);
}
diff --git a/src/mpi/romio/adio/common/ad_write_str_naive.c b/src/mpi/romio/adio/common/ad_write_str_naive.c
index 06e96bd..b236d35 100644
--- a/src/mpi/romio/adio/common/ad_write_str_naive.c
+++ b/src/mpi/romio/adio/common/ad_write_str_naive.c
@@ -375,5 +375,4 @@ void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, const void *buf, int count,
*/
#endif
- if (!buftype_is_contig) ADIOI_Delete_flattened(buftype);
}
diff --git a/src/mpi/romio/adio/common/flatten.c b/src/mpi/romio/adio/common/flatten.c
index c948f95..af8beae 100644
--- a/src/mpi/romio/adio/common/flatten.c
+++ b/src/mpi/romio/adio/common/flatten.c
@@ -13,14 +13,21 @@
void ADIOI_Optimize_flattened(ADIOI_Flatlist_node *flat_type);
/* flatten datatype and add it to Flatlist */
-void ADIOI_Flatten_datatype(MPI_Datatype datatype)
+ADIOI_Flatlist_node *ADIOI_Flatten_datatype(MPI_Datatype datatype)
{
#ifdef HAVE_MPIR_TYPE_FLATTEN
MPI_Aint flatten_idx;
#endif
MPI_Count curr_index=0;
- int is_contig;
- ADIOI_Flatlist_node *flat, *prev=0;
+ int is_contig, flag;
+ ADIOI_Flatlist_node *flat;
+
+ if (ADIOI_Flattened_type_keyval == MPI_KEYVAL_INVALID) {
+ /* ADIOI_End_call will take care of cleanup */
+ MPI_Type_create_keyval(ADIOI_Flattened_type_copy,
+ ADIOI_Flattened_type_delete,
+ &ADIOI_Flattened_type_keyval, NULL);
+ }
/* check if necessary to flatten. */
@@ -29,33 +36,25 @@ void ADIOI_Flatten_datatype(MPI_Datatype datatype)
#ifdef FLATTEN_DEBUG
DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: is_contig %#X\n",is_contig);
#endif
- if (is_contig) return;
+ if (is_contig) return NULL;
/* has it already been flattened? */
- flat = ADIOI_Flatlist;
- while (flat) {
- if (flat->type == datatype) {
+ MPI_Type_get_attr(datatype, ADIOI_Flattened_type_keyval, &flat, &flag);
+ if (flag) {
#ifdef FLATTEN_DEBUG
DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: found datatype %#X\n", datatype);
#endif
- return;
- }
- else {
- prev = flat;
- flat = flat->next;
- }
+ return flat;
}
/* flatten and add to the list */
- flat = prev;
- flat->next = (ADIOI_Flatlist_node *)ADIOI_Malloc(sizeof(ADIOI_Flatlist_node));
- flat = flat->next;
+ flat = ADIOI_Malloc(sizeof(ADIOI_Flatlist_node));
flat->type = datatype;
- flat->next = NULL;
flat->blocklens = NULL;
flat->indices = NULL;
flat->lb_idx = flat->ub_idx = -1;
+ flat->refct = 1;
flat->count = ADIOI_Count_contiguous_blocks(datatype, &curr_index);
#ifdef FLATTEN_DEBUG
@@ -95,6 +94,9 @@ void ADIOI_Flatten_datatype(MPI_Datatype datatype)
);
}
#endif
+ MPI_Type_set_attr(datatype, ADIOI_Flattened_type_keyval, flat);
+ return flat;
+
}
/* ADIOI_Flatten()
@@ -1167,28 +1169,49 @@ void ADIOI_Optimize_flattened(ADIOI_Flatlist_node *flat_type)
return;
}
-void ADIOI_Delete_flattened(MPI_Datatype datatype)
-{
- ADIOI_Flatlist_node *flat, *prev;
+int ADIOI_Flattened_type_keyval=MPI_KEYVAL_INVALID;
- prev = flat = ADIOI_Flatlist;
- while (flat && (flat->type != datatype)) {
- prev = flat;
- flat = flat->next;
- }
- if (flat) {
- prev->next = flat->next;
- if (flat->blocklens) ADIOI_Free(flat->blocklens);
- if (flat->indices) ADIOI_Free(flat->indices);
- ADIOI_Free(flat);
- }
+int ADIOI_Flattened_type_copy(MPI_Datatype oldtype,
+ int type_keyval, void *extra_state, void *attribute_val_in,
+ void *attribute_val_out, int *flag)
+{
+ ADIOI_Flatlist_node *node = (ADIOI_Flatlist_node *)attribute_val_in;
+ if (node != NULL) node->refct++;
+ *(ADIOI_Flatlist_node **)attribute_val_out= node;
+ *flag = 1; /* attribute copied to new communicator */
+ return MPI_SUCCESS;
}
+int ADIOI_Flattened_type_delete(MPI_Datatype datatype,
+ int type_keyval, void *attribute_val, void *extra_state)
+{
+ ADIOI_Flatlist_node *node = (ADIOI_Flatlist_node *)attribute_val;
+ ADIOI_Assert(node != NULL);
+ node->refct--;
+
+ if (node->refct <= 0) {
+ ADIOI_Free(node->blocklens);
+ ADIOI_Free(node->indices);
+ ADIOI_Free(node);
+ }
+ return MPI_SUCCESS;
+}
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;
+ int flag=0;
+
+ if (ADIOI_Flattened_type_keyval == MPI_KEYVAL_INVALID) {
+ /* ADIOI_End_call will take care of cleanup */
+ MPI_Type_create_keyval(ADIOI_Flattened_type_copy,
+ ADIOI_Flattened_type_delete,
+ &ADIOI_Flattened_type_keyval, NULL);
+ }
+
+ MPI_Type_get_attr(datatype, ADIOI_Flattened_type_keyval, &node, &flag);
+ if (flag == 0) {
+ node = ADIOI_Flatten_datatype(datatype);
+ }
+
return node;
}
diff --git a/src/mpi/romio/adio/common/onesided_aggregation.c b/src/mpi/romio/adio/common/onesided_aggregation.c
index 35e0a82..c627570 100644
--- a/src/mpi/romio/adio/common/onesided_aggregation.c
+++ b/src/mpi/romio/adio/common/onesided_aggregation.c
@@ -1212,8 +1212,6 @@ printf("freeing datastructures\n");
ADIOI_Free(currentFDSourceBufferState);
- if (!bufTypeIsContig)
- ADIOI_Delete_flattened(datatype);
return;
}
@@ -2168,7 +2166,5 @@ printf("iAmUsedAgg - currentRoundFDStart initialized "
ADIOI_Free(currentFDSourceBufferState);
- if (!bufTypeIsContig)
- ADIOI_Delete_flattened(datatype);
return;
}
diff --git a/src/mpi/romio/adio/include/adio_extern.h b/src/mpi/romio/adio/include/adio_extern.h
index 9a7f2e5..e315f41 100644
--- a/src/mpi/romio/adio/include/adio_extern.h
+++ b/src/mpi/romio/adio/include/adio_extern.h
@@ -5,8 +5,6 @@
* See COPYRIGHT notice in top-level directory.
*/
-extern ADIOI_Flatlist_node *ADIOI_Flatlist;
-
extern ADIOI_Datarep *ADIOI_Datarep_head;
/* for f2c and c2f conversion */
@@ -29,3 +27,4 @@ extern MPI_Info ADIOI_syshints;
extern MPI_Op ADIO_same_amode;
extern int ADIOI_cb_config_list_keyval;
+extern int ADIOI_Flattened_type_keyval;
diff --git a/src/mpi/romio/adio/include/adioi.h b/src/mpi/romio/adio/include/adioi.h
index bc00a87..91fb770 100644
--- a/src/mpi/romio/adio/include/adioi.h
+++ b/src/mpi/romio/adio/include/adioi.h
@@ -124,7 +124,9 @@ typedef struct ADIOI_Fl_node {
* (-1 indicates "not explicitly set") */
ADIO_Offset lb_idx;
ADIO_Offset ub_idx;
- struct ADIOI_Fl_node *next; /* pointer to next node */
+ int refct; /* when storing flattened representation on a
+ type, attribute copy and delete routines
+ will manage refct */
} ADIOI_Flatlist_node;
#ifdef ROMIO_PVFS2
@@ -345,10 +347,15 @@ typedef struct {
/* prototypes for ADIO internal functions */
void ADIOI_SetFunctions(ADIO_File fd);
-void ADIOI_Flatten_datatype(MPI_Datatype type);
+ADIOI_Flatlist_node * 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);
+/* callbakcs for attribute-style flattened tracking */
+int ADIOI_Flattened_type_copy(MPI_Datatype oldtype,
+ int type_keyval, void *extra_state, void *attribute_val_in,
+ void *attribute_val_out, int *flag);
+int ADIOI_Flattened_type_delete(MPI_Datatype datatype,
+ int type_keyval, void *attribute_val, void *extra_state);
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);
-----------------------------------------------------------------------
Summary of changes:
src/mpi/romio/adio/ad_gpfs/ad_gpfs_rdcoll.c | 1 -
src/mpi/romio/adio/ad_gpfs/ad_gpfs_wrcoll.c | 1 -
src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c | 2 +-
src/mpi/romio/adio/ad_lustre/ad_lustre_wrcoll.c | 3 -
src/mpi/romio/adio/ad_lustre/ad_lustre_wrstr.c | 7 +-
src/mpi/romio/adio/ad_nfs/ad_nfs_read.c | 5 +-
src/mpi/romio/adio/ad_nfs/ad_nfs_write.c | 5 +-
src/mpi/romio/adio/ad_piofs/ad_piofs_write.c | 5 +-
src/mpi/romio/adio/ad_pvfs/ad_pvfs_read.c | 5 +-
src/mpi/romio/adio/ad_pvfs/ad_pvfs_write.c | 9 +-
src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_io_dtype.c | 8 +-
src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_io_list.c | 8 +-
.../adio/ad_pvfs2/ad_pvfs2_read_list_classic.c | 9 +-
.../adio/ad_pvfs2/ad_pvfs2_write_list_classic.c | 9 +-
src/mpi/romio/adio/ad_testfs/ad_testfs_seek.c | 3 +-
src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c | 9 +-
.../romio/adio/ad_zoidfs/ad_zoidfs_write_list.c | 9 +-
src/mpi/romio/adio/common/ad_aggregate_new.c | 2 +-
src/mpi/romio/adio/common/ad_close.c | 9 +-
src/mpi/romio/adio/common/ad_coll_build_req_new.c | 5 +-
src/mpi/romio/adio/common/ad_coll_exch_new.c | 57 +-------
src/mpi/romio/adio/common/ad_end.c | 16 +--
src/mpi/romio/adio/common/ad_init.c | 8 -
src/mpi/romio/adio/common/ad_io_coll.c | 14 +--
src/mpi/romio/adio/common/ad_iread_coll.c | 2 -
src/mpi/romio/adio/common/ad_iwrite_coll.c | 3 -
src/mpi/romio/adio/common/ad_read_coll.c | 5 +-
src/mpi/romio/adio/common/ad_read_str.c | 5 +-
src/mpi/romio/adio/common/ad_read_str_naive.c | 5 +-
src/mpi/romio/adio/common/ad_seek.c | 3 +-
src/mpi/romio/adio/common/ad_set_view.c | 9 +-
src/mpi/romio/adio/common/ad_write_coll.c | 2 -
src/mpi/romio/adio/common/ad_write_nolock.c | 7 +-
src/mpi/romio/adio/common/ad_write_str.c | 5 +-
src/mpi/romio/adio/common/ad_write_str_naive.c | 5 +-
src/mpi/romio/adio/common/byte_offset.c | 4 +-
src/mpi/romio/adio/common/eof_offset.c | 5 +-
src/mpi/romio/adio/common/flatten.c | 157 ++++++++++++--------
src/mpi/romio/adio/common/get_fp_posn.c | 4 +-
src/mpi/romio/adio/common/onesided_aggregation.c | 4 -
src/mpi/romio/adio/include/adio_extern.h | 3 +-
src/mpi/romio/adio/include/adioi.h | 13 ++-
42 files changed, 156 insertions(+), 294 deletions(-)
hooks/post-receive
--
MPICH primary repository
More information about the commits
mailing list