Fix the darray issue where the UB was not computed correctly. The
old version of the code tried to use the MPI_UB marker, but this failed if the old marker (the one set in the cyclic function) had a larger value. Replace the hardcore markers MPI_LB and MPI_UB by their softer counterparts (using the _resize function). This commit was SVN r26862.
Этот коммит содержится в:
родитель
d26a9faba5
Коммит
b0e2dc7ae3
@ -122,12 +122,9 @@ cyclic(const int *gsize_array, int dim, int ndims, int nprocs,
|
|||||||
/* if the last block is of size less than blksize, include
|
/* if the last block is of size less than blksize, include
|
||||||
it separately using MPI_Type_struct */
|
it separately using MPI_Type_struct */
|
||||||
|
|
||||||
types[0] = *type_new;
|
types [0] = *type_new; types [1] = type_old;
|
||||||
types[1] = type_old;
|
disps [0] = 0; disps [1] = count*stride;
|
||||||
disps[0] = 0;
|
blklens[0] = 1; blklens[1] = rem;
|
||||||
disps[1] = count*stride;
|
|
||||||
blklens[0] = 1;
|
|
||||||
blklens[1] = rem;
|
|
||||||
|
|
||||||
rc = ompi_datatype_create_struct(2, blklens, disps, types, &type_tmp);
|
rc = ompi_datatype_create_struct(2, blklens, disps, types, &type_tmp);
|
||||||
ompi_datatype_destroy(type_new);
|
ompi_datatype_destroy(type_new);
|
||||||
@ -138,26 +135,18 @@ cyclic(const int *gsize_array, int dim, int ndims, int nprocs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* need to set the UB for block-cyclic to work */
|
/* need to set the UB for block-cyclic to work */
|
||||||
types[0] = *type_new;
|
disps[0] = 0; disps[1] = orig_extent;
|
||||||
types[1] = MPI_UB;
|
|
||||||
disps[0] = 0;
|
|
||||||
disps[1] = orig_extent;
|
|
||||||
if (order == MPI_ORDER_FORTRAN) {
|
if (order == MPI_ORDER_FORTRAN) {
|
||||||
for (i=0; i<=dim; i++) {
|
for(i=0; i<=dim; i++) {
|
||||||
disps[1] *= gsize_array[i];
|
disps[1] *= gsize_array[i];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i=ndims-1; i>=dim; i--) {
|
for(i=ndims-1; i>=dim; i--) {
|
||||||
disps[1] *= gsize_array[i];
|
disps[1] *= gsize_array[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
blklens[0] = blklens[1] = 1;
|
rc = opal_datatype_resize( &(*type_new)->super, disps[0], disps[1] );
|
||||||
rc = ompi_datatype_create_struct(2, blklens, disps, types, &type_tmp);
|
|
||||||
ompi_datatype_destroy(type_new);
|
|
||||||
/* even in error condition, need to destroy type_new, so check
|
|
||||||
for error after destroy. */
|
|
||||||
if (OMPI_SUCCESS != rc) return rc;
|
if (OMPI_SUCCESS != rc) return rc;
|
||||||
*type_new = type_tmp;
|
|
||||||
|
|
||||||
*st_offset = rank * blksize;
|
*st_offset = rank * blksize;
|
||||||
/* in terms of no. of elements of type oldtype in this dimension */
|
/* in terms of no. of elements of type oldtype in this dimension */
|
||||||
@ -222,7 +211,7 @@ int32_t ompi_datatype_create_darray(int size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Build up array */
|
/* Build up array */
|
||||||
for (i = start_loop ; i != end_loop; i += step) {
|
for (i = start_loop; i != end_loop; i += step) {
|
||||||
int nprocs, tmp_rank;
|
int nprocs, tmp_rank;
|
||||||
|
|
||||||
switch(distrib_array[i]) {
|
switch(distrib_array[i]) {
|
||||||
@ -259,7 +248,7 @@ int32_t ompi_datatype_create_darray(int size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* set displacement and UB correctly. Use struct instead of
|
/* set displacement and UB correctly. Use struct instead of
|
||||||
resized for same reason as subarray */
|
resized for same reason as subarray */
|
||||||
{
|
{
|
||||||
ptrdiff_t displs[3];
|
ptrdiff_t displs[3];
|
||||||
|
@ -86,7 +86,7 @@ int32_t ompi_datatype_create_subarray(int ndims,
|
|||||||
/**
|
/**
|
||||||
* We cannot use resized here. Resized will only set the soft lb and ub markers
|
* We cannot use resized here. Resized will only set the soft lb and ub markers
|
||||||
* without moving the real data inside. What we need is to force the displacement
|
* without moving the real data inside. What we need is to force the displacement
|
||||||
* of the data create upward to the right position AND set the LB and UB. A type
|
* of the data upward to the right position AND set the LB and UB. A type
|
||||||
* struct is the function we need.
|
* struct is the function we need.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user