[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2a2-132-gebbaad2
Service Account
noreply at mpich.org
Tue Feb 3 16:01:45 CST 2015
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 ebbaad2be4676c23586685950618aff6229b1ad2 (commit)
from 9a9ffb76c216ae3051e8f02163ba30abf55eeaf0 (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/ebbaad2be4676c23586685950618aff6229b1ad2
commit ebbaad2be4676c23586685950618aff6229b1ad2
Author: Rajeev Thakur <thakur at mcs.anl.gov>
Date: Tue Jan 27 14:51:42 2015 -0600
Changes the sticky lb/ub fields in resized types to 0, since the lb/ub
set by type_create_resized are not sticky.
Changes darray and subarray types to use type_create_resized instead
of type_struct with explicit lb/ub, because explicit MPI_LB/MPI_UB
have been removed from MPI in MPI-3 and they also cause other problems
because they were defined to be sticky in MPI-1.
Fixes type_create_struct, which was incorrectly setting lb and ub to
true_lb and true_ub in the non-sticky case.
Closes #2218
Closes #2220
Closes #2224
Signed-off-by: Rob Latham <robl at mcs.anl.gov>
diff --git a/src/mpi/datatype/type_create_darray.c b/src/mpi/datatype/type_create_darray.c
index 0047f38..5c85f47 100644
--- a/src/mpi/datatype/type_create_darray.c
+++ b/src/mpi/datatype/type_create_darray.c
@@ -197,7 +197,7 @@ PMPI_LOCAL int MPIR_Type_cyclic(const int *array_of_gsizes,
int mpi_errno,blksize, i, blklens[3], st_index, end_index,
local_size, rem, count;
MPI_Aint stride, disps[3];
- MPI_Datatype type_tmp, types[3];
+ MPI_Datatype type_tmp, type_indexed, types[3];
if (darg == MPI_DISTRIBUTE_DFLT_DARG) blksize = 1;
else blksize = darg;
@@ -281,18 +281,30 @@ PMPI_LOCAL int MPIR_Type_cyclic(const int *array_of_gsizes,
if (((order == MPI_ORDER_FORTRAN) && (dim == 0)) ||
((order == MPI_ORDER_C) && (dim == ndims-1)))
{
- types[0] = MPI_LB;
disps[0] = 0;
- types[1] = *type_new;
disps[1] = (MPI_Aint) rank * (MPI_Aint) blksize * orig_extent;
- types[2] = MPI_UB;
disps[2] = orig_extent * (MPI_Aint)(array_of_gsizes[dim]);
- blklens[0] = blklens[1] = blklens[2] = 1;
- mpi_errno = MPID_Type_struct(3,
- blklens,
- disps,
- types,
- &type_tmp);
+
+/* Instead of using MPI_LB/MPI_UB, which have been removed from MPI in MPI-3,
+ use MPI_Type_create_resized. Use hindexed_block to set the starting displacement
+ of the datatype (disps[1]) and type_create_resized to set lb to 0 (disps[0])
+ and extent to disps[2], which makes ub = disps[2].
+ */
+ mpi_errno = MPID_Type_blockindexed(1, 1, &disps[1],
+ 1, /* 1 means disp is in bytes */
+ *type_new, &type_indexed);
+
+ /* --BEGIN ERROR HANDLING-- */
+ if (mpi_errno != MPI_SUCCESS)
+ {
+ mpi_errno = MPIR_Err_create_code(mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**fail", 0);
+ return mpi_errno;
+ }
+ /* --END ERROR HANDLING-- */
+
+ mpi_errno = MPID_Type_create_resized(type_indexed, 0, disps[2], &type_tmp);
+
+ MPIR_Type_free_impl(&type_indexed);
MPIR_Type_free_impl(type_new);
*type_new = type_tmp;
@@ -364,9 +376,9 @@ int MPI_Type_create_darray(int size,
int mpi_errno = MPI_SUCCESS, i;
MPI_Datatype new_handle;
- int procs, tmp_rank, tmp_size, blklens[3], *coords;
+ int procs, tmp_rank, tmp_size, *coords;
MPI_Aint *st_offsets, orig_extent, disps[3];
- MPI_Datatype type_old, type_new = MPI_DATATYPE_NULL, types[3];
+ MPI_Datatype type_old, type_new = MPI_DATATYPE_NULL, tmp_type;
# ifdef HAVE_ERROR_CHECKING
MPI_Aint size_with_aint;
@@ -666,20 +678,27 @@ int MPI_Type_create_darray(int size,
for (i=0; i<ndims; i++) disps[2] *= (MPI_Aint)(array_of_gsizes[i]);
disps[0] = 0;
- blklens[0] = blklens[1] = blklens[2] = 1;
- types[0] = MPI_LB;
- types[1] = type_new;
- types[2] = MPI_UB;
-
- mpi_errno = MPID_Type_struct(3,
- blklens,
- disps,
- types,
- &new_handle);
+
+/* Instead of using MPI_LB/MPI_UB, which have been removed from MPI in MPI-3,
+ use MPI_Type_create_resized. Use hindexed_block to set the starting displacement
+ of the datatype (disps[1]) and type_create_resized to set lb to 0 (disps[0])
+ and extent to disps[2], which makes ub = disps[2].
+ */
+ mpi_errno = MPID_Type_blockindexed(1, 1, &disps[1],
+ 1, /* 1 means disp is in bytes */
+ type_new, &tmp_type);
+
+ /* --BEGIN ERROR HANDLING-- */
+ if (mpi_errno != MPI_SUCCESS) goto fn_fail;
+ /* --END ERROR HANDLING-- */
+
+ mpi_errno = MPID_Type_create_resized(tmp_type, 0, disps[2], &new_handle);
+
/* --BEGIN ERROR HANDLING-- */
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
/* --END ERROR HANDLING-- */
+ MPIR_Type_free_impl(&tmp_type);
MPIR_Type_free_impl(&type_new);
/* at this point we have the new type, and we've cleaned up any
diff --git a/src/mpi/datatype/type_create_subarray.c b/src/mpi/datatype/type_create_subarray.c
index 0089f37..906f865 100644
--- a/src/mpi/datatype/type_create_subarray.c
+++ b/src/mpi/datatype/type_create_subarray.c
@@ -72,8 +72,7 @@ int MPI_Type_create_subarray(int ndims,
/* these variables are from the original version in ROMIO */
MPI_Aint size, extent, disps[3];
- int blklens[3];
- MPI_Datatype tmp1, tmp2, types[3];
+ MPI_Datatype tmp1, tmp2;
# ifdef HAVE_ERROR_CHECKING
MPI_Aint size_with_aint;
@@ -278,29 +277,23 @@ int MPI_Type_create_subarray(int ndims,
for (i=0; i<ndims; i++) disps[2] *= (MPI_Aint)(array_of_sizes[i]);
disps[0] = 0;
- blklens[0] = blklens[1] = blklens[2] = 1;
- types[0] = MPI_LB;
- types[1] = tmp1;
- types[2] = MPI_UB;
-
- /* TODO:
- * if we were to do all this as an mpid function, we could just
- * directly adjust the LB and UB in the MPID_Datatype structure
- * instead of jumping through this hoop.
- *
- * i suppose we could do the same thing here...
- *
- * another alternative would be to use MPID_Type_create_resized()
- * instead of building the struct. that would also be cleaner.
- */
- mpi_errno = MPID_Type_struct(3,
- blklens,
- disps,
- types,
- &new_handle);
+
+/* Instead of using MPI_LB/MPI_UB, which have been removed from MPI in MPI-3,
+ use MPI_Type_create_resized. Use hindexed_block to set the starting displacement
+ of the datatype (disps[1]) and type_create_resized to set lb to 0 (disps[0])
+ and extent to disps[2], which makes ub = disps[2].
+ */
+
+ mpi_errno = MPID_Type_blockindexed(1, 1, &disps[1],
+ 1, /* 1 means disp is in bytes */
+ tmp1, &tmp2);
+ if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+
+ mpi_errno = MPID_Type_create_resized(tmp2, 0, disps[2], &new_handle);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIR_Type_free_impl(&tmp1);
+ MPIR_Type_free_impl(&tmp2);
/* at this point we have the new type, and we've cleaned up any
* intermediate types created in the process. we just need to save
diff --git a/src/mpid/common/datatype/mpid_type_create_resized.c b/src/mpid/common/datatype/mpid_type_create_resized.c
index 07d753d..75b535f 100644
--- a/src/mpid/common/datatype/mpid_type_create_resized.c
+++ b/src/mpid/common/datatype/mpid_type_create_resized.c
@@ -47,8 +47,8 @@ int MPID_Type_create_resized(MPI_Datatype oldtype,
int oldsize = MPID_Datatype_get_basic_size(oldtype);
new_dtp->size = oldsize;
- new_dtp->has_sticky_ub = 1;
- new_dtp->has_sticky_lb = 1;
+ new_dtp->has_sticky_ub = 0;
+ new_dtp->has_sticky_lb = 0;
new_dtp->dataloop_depth = 1;
new_dtp->true_lb = 0;
new_dtp->lb = lb;
@@ -70,8 +70,8 @@ int MPID_Type_create_resized(MPI_Datatype oldtype,
MPID_Datatype_get_ptr(oldtype, old_dtp);
new_dtp->size = old_dtp->size;
- new_dtp->has_sticky_ub = 1;
- new_dtp->has_sticky_lb = 1;
+ new_dtp->has_sticky_ub = 0;
+ new_dtp->has_sticky_lb = 0;
new_dtp->dataloop_depth = old_dtp->dataloop_depth;
new_dtp->true_lb = old_dtp->true_lb;
new_dtp->lb = lb;
diff --git a/src/mpid/common/datatype/mpid_type_struct.c b/src/mpid/common/datatype/mpid_type_struct.c
index 148958e..72e23fd 100644
--- a/src/mpid/common/datatype/mpid_type_struct.c
+++ b/src/mpid/common/datatype/mpid_type_struct.c
@@ -151,12 +151,12 @@ int MPID_Type_struct(int count,
int mpi_errno = MPI_SUCCESS;
int i, old_are_contig = 1, definitely_not_contig = 0;
int found_sticky_lb = 0, found_sticky_ub = 0, found_true_lb = 0,
- found_true_ub = 0, found_el_type = 0;
+ found_true_ub = 0, found_el_type = 0, found_lb=0, found_ub=0;
MPI_Aint el_sz = 0;
MPI_Aint size = 0;
MPI_Datatype el_type = MPI_DATATYPE_NULL;
MPI_Aint true_lb_disp = 0, true_ub_disp = 0, sticky_lb_disp = 0,
- sticky_ub_disp = 0;
+ sticky_ub_disp = 0, lb_disp = 0, ub_disp = 0;
MPID_Datatype *new_dtp;
@@ -320,7 +320,7 @@ int MPID_Type_struct(int count,
}
}
- /* keep lowest true lb and highest true ub
+ /* keep lowest lb/true_lb and highest ub/true_ub
*
* note: checking for contiguity at the same time, to avoid
* yet another pass over the arrays
@@ -339,6 +339,18 @@ int MPID_Type_struct(int count,
definitely_not_contig = 1;
}
+ if (!found_lb)
+ {
+ found_lb = 1;
+ lb_disp = tmp_lb;
+ }
+ else if (lb_disp > tmp_lb)
+ {
+ /* lb before previous */
+ lb_disp = tmp_lb;
+ definitely_not_contig = 1;
+ }
+
if (!found_true_ub)
{
found_true_ub = 1;
@@ -352,6 +364,20 @@ int MPID_Type_struct(int count,
/* element ends before previous ended */
definitely_not_contig = 1;
}
+
+ if (!found_ub)
+ {
+ found_ub = 1;
+ ub_disp = tmp_ub;
+ }
+ else if (ub_disp < tmp_ub)
+ {
+ ub_disp = tmp_ub;
+ }
+ else {
+ /* ub before previous */
+ definitely_not_contig = 1;
+ }
}
if (!is_builtin && !old_dtp->is_contig)
@@ -366,11 +392,11 @@ int MPID_Type_struct(int count,
new_dtp->has_sticky_lb = found_sticky_lb;
new_dtp->true_lb = true_lb_disp;
- new_dtp->lb = (found_sticky_lb) ? sticky_lb_disp : true_lb_disp;
+ new_dtp->lb = (found_sticky_lb) ? sticky_lb_disp : lb_disp;
new_dtp->has_sticky_ub = found_sticky_ub;
new_dtp->true_ub = true_ub_disp;
- new_dtp->ub = (found_sticky_ub) ? sticky_ub_disp : true_ub_disp;
+ new_dtp->ub = (found_sticky_ub) ? sticky_ub_disp : ub_disp;
new_dtp->alignsize = MPID_Type_struct_alignsize(count,
oldtype_array,
-----------------------------------------------------------------------
Summary of changes:
src/mpi/datatype/type_create_darray.c | 63 +++++++++++++-------
src/mpi/datatype/type_create_subarray.c | 37 +++++-------
.../common/datatype/mpid_type_create_resized.c | 8 +-
src/mpid/common/datatype/mpid_type_struct.c | 36 ++++++++++--
4 files changed, 91 insertions(+), 53 deletions(-)
hooks/post-receive
--
MPICH primary repository
More information about the commits
mailing list