1515 * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
1616 * Copyright (c) 2016 Los Alamos National Security, LLC. All rights
1717 * reserved.
18+ * Copyright (c) 2017 IBM Corporation. All rights reserved.
1819 * $COPYRIGHT$
1920 *
2021 * Additional copyrights may follow
@@ -35,7 +36,7 @@ block(const int *gsize_array, int dim, int ndims, int nprocs,
3536 ptrdiff_t * st_offset )
3637{
3738 int blksize , global_size , mysize , i , j , rc , start_loop , step ;
38- ptrdiff_t stride ;
39+ ptrdiff_t stride , disps [ 2 ] ;
3940
4041 global_size = gsize_array [dim ];
4142
@@ -71,6 +72,20 @@ block(const int *gsize_array, int dim, int ndims, int nprocs,
7172 /* in terms of no. of elements of type oldtype in this dimension */
7273 if (mysize == 0 ) * st_offset = 0 ;
7374
75+ /* need to set the UB for block-cyclic to work */
76+ disps [0 ] = 0 ; disps [1 ] = orig_extent ;
77+ if (order == MPI_ORDER_FORTRAN ) {
78+ for (i = 0 ; i <=dim ; i ++ ) {
79+ disps [1 ] *= gsize_array [i ];
80+ }
81+ } else {
82+ for (i = ndims - 1 ; i >=dim ; i -- ) {
83+ disps [1 ] *= gsize_array [i ];
84+ }
85+ }
86+ rc = opal_datatype_resize ( & (* type_new )-> super , disps [0 ], disps [1 ] );
87+ if (OMPI_SUCCESS != rc ) return rc ;
88+
7489 return OMPI_SUCCESS ;
7590}
7691
0 commit comments