coll/base: fix memory allocation in mca_coll_base_alltoall_intra_basic_inplace
Этот коммит содержится в:
родитель
7dac5d36e5
Коммит
0f23037775
@ -46,7 +46,7 @@ mca_coll_base_alltoall_intra_basic_inplace(const void *rbuf, int rcount,
|
|||||||
MPI_Request *preq;
|
MPI_Request *preq;
|
||||||
char *tmp_buffer;
|
char *tmp_buffer;
|
||||||
size_t max_size;
|
size_t max_size;
|
||||||
ptrdiff_t ext;
|
ptrdiff_t ext, true_lb, true_ext;
|
||||||
|
|
||||||
/* Initialize. */
|
/* Initialize. */
|
||||||
|
|
||||||
@ -60,13 +60,15 @@ mca_coll_base_alltoall_intra_basic_inplace(const void *rbuf, int rcount,
|
|||||||
|
|
||||||
/* Find the largest receive amount */
|
/* Find the largest receive amount */
|
||||||
ompi_datatype_type_extent (rdtype, &ext);
|
ompi_datatype_type_extent (rdtype, &ext);
|
||||||
max_size = ext * rcount;
|
ompi_datatype_get_true_extent ( rdtype, &true_lb, &true_ext);
|
||||||
|
max_size = true_ext + ext * (rcount-1);
|
||||||
|
|
||||||
/* Allocate a temporary buffer */
|
/* Allocate a temporary buffer */
|
||||||
tmp_buffer = calloc (max_size, 1);
|
tmp_buffer = calloc (max_size, 1);
|
||||||
if (NULL == tmp_buffer) {
|
if (NULL == tmp_buffer) {
|
||||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||||
}
|
}
|
||||||
|
max_size = ext * rcount;
|
||||||
|
|
||||||
/* in-place alltoall slow algorithm (but works) */
|
/* in-place alltoall slow algorithm (but works) */
|
||||||
for (i = 0 ; i < size ; ++i) {
|
for (i = 0 ; i < size ; ++i) {
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user