From ded4cbf20f1ef4d21e92cbe4cee7cb70719122b2 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Mon, 19 Jan 2015 02:26:14 -0500 Subject: [PATCH] Correctly set the upper and lower bound for the subarray and darray. --- ompi/datatype/ompi_datatype_create_darray.c | 2 +- ompi/datatype/ompi_datatype_create_subarray.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ompi/datatype/ompi_datatype_create_darray.c b/ompi/datatype/ompi_datatype_create_darray.c index 6ca81cf867..846566a8eb 100644 --- a/ompi/datatype/ompi_datatype_create_darray.c +++ b/ompi/datatype/ompi_datatype_create_darray.c @@ -271,7 +271,7 @@ int32_t ompi_datatype_create_darray(int size, rc = ompi_datatype_create_struct(3, blength, displs, types, newtype); } else { - ompi_datatype_create_resized(lastType, displs[0], displs[2], newtype); + ompi_datatype_create_resized(lastType, displs[1], displs[2], newtype); } ompi_datatype_destroy(&lastType); /* need to destroy the old type even in error condition, so diff --git a/ompi/datatype/ompi_datatype_create_subarray.c b/ompi/datatype/ompi_datatype_create_subarray.c index d9bf3ea06c..ff159676ca 100644 --- a/ompi/datatype/ompi_datatype_create_subarray.c +++ b/ompi/datatype/ompi_datatype_create_subarray.c @@ -84,6 +84,7 @@ int32_t ompi_datatype_create_subarray(int ndims, ompi_datatype_create_hvector( subsize_array[i], 1, size * extent, last_type, newtype ); ompi_datatype_destroy( &last_type ); + displ += size * start_array[i]; size *= size_array[i]; last_type = *newtype; @@ -105,7 +106,7 @@ int32_t ompi_datatype_create_subarray(int ndims, types[0] = MPI_LB; types[1] = last_type; types[2] = MPI_UB; ompi_datatype_create_struct( 3, blength, displs, types, newtype ); } else { - ompi_datatype_create_resized(last_type, 0, size * extent, newtype); + ompi_datatype_create_resized(last_type, displ * extent, size * extent, newtype); } ompi_datatype_destroy( &last_type );