|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* (C) 2017 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* This implementation of MPI_Reduce_scatter_block was obtained by taking
|
|
Packit Service |
c5cf8c |
the implementation of MPI_Reduce_scatter from reduce_scatter.c and replacing
|
|
Packit Service |
c5cf8c |
recvcnts[i] with recvcount everywhere. */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#include "mpiimpl.h"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#undef FUNCNAME
|
|
Packit Service |
c5cf8c |
#define FUNCNAME MPIR_Reduce_scatter_block_intra_recursive_doubling
|
|
Packit Service |
c5cf8c |
#undef FCNAME
|
|
Packit Service |
c5cf8c |
#define FCNAME MPL_QUOTE(FUNCNAME)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Algorithm: Recursive Doubling
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* This is a recursive doubling algorithm, which takes lgp steps. At step 1,
|
|
Packit Service |
c5cf8c |
* processes exchange (n-n/p) amount of data; at step 2, (n-2n/p) amount of
|
|
Packit Service |
c5cf8c |
* data; at step 3, (n-4n/p) amount of data, and so forth.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* Cost = lgp.alpha + n.(lgp-(p-1)/p).beta + n.(lgp-(p-1)/p).gamma
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
int MPIR_Reduce_scatter_block_intra_recursive_doubling(const void *sendbuf,
|
|
Packit Service |
c5cf8c |
void *recvbuf,
|
|
Packit Service |
c5cf8c |
int recvcount,
|
|
Packit Service |
c5cf8c |
MPI_Datatype datatype,
|
|
Packit Service |
c5cf8c |
MPI_Op op,
|
|
Packit Service |
c5cf8c |
MPIR_Comm * comm_ptr,
|
|
Packit Service |
c5cf8c |
MPIR_Errflag_t * errflag)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int rank, comm_size, i;
|
|
Packit Service |
c5cf8c |
MPI_Aint extent, true_extent, true_lb;
|
|
Packit Service |
c5cf8c |
int *disps;
|
|
Packit Service |
c5cf8c |
void *tmp_recvbuf, *tmp_results;
|
|
Packit Service |
c5cf8c |
int mpi_errno = MPI_SUCCESS;
|
|
Packit Service |
c5cf8c |
int mpi_errno_ret = MPI_SUCCESS;
|
|
Packit Service |
c5cf8c |
int dis[2], blklens[2], total_count, dst;
|
|
Packit Service |
c5cf8c |
int mask, dst_tree_root, my_tree_root, j, k;
|
|
Packit Service |
c5cf8c |
int received;
|
|
Packit Service |
c5cf8c |
MPI_Datatype sendtype, recvtype;
|
|
Packit Service |
c5cf8c |
int nprocs_completed, tmp_mask, tree_root, is_commutative;
|
|
Packit Service |
c5cf8c |
MPIR_CHKLMEM_DECL(5);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
comm_size = comm_ptr->local_size;
|
|
Packit Service |
c5cf8c |
rank = comm_ptr->rank;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* set op_errno to 0. stored in perthread structure */
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
MPIR_Per_thread_t *per_thread = NULL;
|
|
Packit Service |
c5cf8c |
int err = 0;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPID_THREADPRIV_KEY_GET_ADDR(MPIR_ThreadInfo.isThreaded, MPIR_Per_thread_key,
|
|
Packit Service |
c5cf8c |
MPIR_Per_thread, per_thread, &err;;
|
|
Packit Service |
c5cf8c |
MPIR_Assert(err == 0);
|
|
Packit Service |
c5cf8c |
per_thread->op_errno = 0;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (recvcount == 0) {
|
|
Packit Service |
c5cf8c |
goto fn_exit;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPIR_Datatype_get_extent_macro(datatype, extent);
|
|
Packit Service |
c5cf8c |
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
is_commutative = MPIR_Op_is_commutative(op);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPIR_CHKLMEM_MALLOC(disps, int *, comm_size * sizeof(int), mpi_errno, "disps", MPL_MEM_BUFFER);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
total_count = comm_size * recvcount;
|
|
Packit Service |
c5cf8c |
for (i = 0; i < comm_size; i++) {
|
|
Packit Service |
c5cf8c |
disps[i] = i * recvcount;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* total_count*extent eventually gets malloced. it isn't added to
|
|
Packit Service |
c5cf8c |
* a user-passed in buffer */
|
|
Packit Service |
c5cf8c |
MPIR_Ensure_Aint_fits_in_pointer(total_count * MPL_MAX(true_extent, extent));
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* need to allocate temporary buffer to receive incoming data */
|
|
Packit Service |
c5cf8c |
MPIR_CHKLMEM_MALLOC(tmp_recvbuf, void *, total_count * (MPL_MAX(true_extent, extent)),
|
|
Packit Service |
c5cf8c |
mpi_errno, "tmp_recvbuf", MPL_MEM_BUFFER);
|
|
Packit Service |
c5cf8c |
/* adjust for potential negative lower bound in datatype */
|
|
Packit Service |
c5cf8c |
tmp_recvbuf = (void *) ((char *) tmp_recvbuf - true_lb);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* need to allocate another temporary buffer to accumulate
|
|
Packit Service |
c5cf8c |
* results */
|
|
Packit Service |
c5cf8c |
MPIR_CHKLMEM_MALLOC(tmp_results, void *, total_count * (MPL_MAX(true_extent, extent)),
|
|
Packit Service |
c5cf8c |
mpi_errno, "tmp_results", MPL_MEM_BUFFER);
|
|
Packit Service |
c5cf8c |
/* adjust for potential negative lower bound in datatype */
|
|
Packit Service |
c5cf8c |
tmp_results = (void *) ((char *) tmp_results - true_lb);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* copy sendbuf into tmp_results */
|
|
Packit Service |
c5cf8c |
if (sendbuf != MPI_IN_PLACE)
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Localcopy(sendbuf, total_count, datatype,
|
|
Packit Service |
c5cf8c |
tmp_results, total_count, datatype);
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Localcopy(recvbuf, total_count, datatype,
|
|
Packit Service |
c5cf8c |
tmp_results, total_count, datatype);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
mask = 0x1;
|
|
Packit Service |
c5cf8c |
i = 0;
|
|
Packit Service |
c5cf8c |
while (mask < comm_size) {
|
|
Packit Service |
c5cf8c |
dst = rank ^ mask;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
dst_tree_root = dst >> i;
|
|
Packit Service |
c5cf8c |
dst_tree_root <<= i;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
my_tree_root = rank >> i;
|
|
Packit Service |
c5cf8c |
my_tree_root <<= i;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* At step 1, processes exchange (n-n/p) amount of
|
|
Packit Service |
c5cf8c |
* data; at step 2, (n-2n/p) amount of data; at step 3, (n-4n/p)
|
|
Packit Service |
c5cf8c |
* amount of data, and so forth. We use derived datatypes for this.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* At each step, a process does not need to send data
|
|
Packit Service |
c5cf8c |
* indexed from my_tree_root to
|
|
Packit Service |
c5cf8c |
* my_tree_root+mask-1. Similarly, a process won't receive
|
|
Packit Service |
c5cf8c |
* data indexed from dst_tree_root to dst_tree_root+mask-1. */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* calculate sendtype */
|
|
Packit Service |
c5cf8c |
blklens[0] = blklens[1] = 0;
|
|
Packit Service |
c5cf8c |
for (j = 0; j < my_tree_root; j++)
|
|
Packit Service |
c5cf8c |
blklens[0] += recvcount;
|
|
Packit Service |
c5cf8c |
for (j = my_tree_root + mask; j < comm_size; j++)
|
|
Packit Service |
c5cf8c |
blklens[1] += recvcount;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
dis[0] = 0;
|
|
Packit Service |
c5cf8c |
dis[1] = blklens[0];
|
|
Packit Service |
c5cf8c |
for (j = my_tree_root; (j < my_tree_root + mask) && (j < comm_size); j++)
|
|
Packit Service |
c5cf8c |
dis[1] += recvcount;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Type_indexed_impl(2, blklens, dis, datatype, &sendtype);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Type_commit_impl(&sendtype);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* calculate recvtype */
|
|
Packit Service |
c5cf8c |
blklens[0] = blklens[1] = 0;
|
|
Packit Service |
c5cf8c |
for (j = 0; j < dst_tree_root && j < comm_size; j++)
|
|
Packit Service |
c5cf8c |
blklens[0] += recvcount;
|
|
Packit Service |
c5cf8c |
for (j = dst_tree_root + mask; j < comm_size; j++)
|
|
Packit Service |
c5cf8c |
blklens[1] += recvcount;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
dis[0] = 0;
|
|
Packit Service |
c5cf8c |
dis[1] = blklens[0];
|
|
Packit Service |
c5cf8c |
for (j = dst_tree_root; (j < dst_tree_root + mask) && (j < comm_size); j++)
|
|
Packit Service |
c5cf8c |
dis[1] += recvcount;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Type_indexed_impl(2, blklens, dis, datatype, &recvtype);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Type_commit_impl(&recvtype);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
received = 0;
|
|
Packit Service |
c5cf8c |
if (dst < comm_size) {
|
|
Packit Service |
c5cf8c |
/* tmp_results contains data to be sent in each step. Data is
|
|
Packit Service |
c5cf8c |
* received in tmp_recvbuf and then accumulated into
|
|
Packit Service |
c5cf8c |
* tmp_results. accumulation is done later below. */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIC_Sendrecv(tmp_results, 1, sendtype, dst,
|
|
Packit Service |
c5cf8c |
MPIR_REDUCE_SCATTER_BLOCK_TAG,
|
|
Packit Service |
c5cf8c |
tmp_recvbuf, 1, recvtype, dst,
|
|
Packit Service |
c5cf8c |
MPIR_REDUCE_SCATTER_BLOCK_TAG, comm_ptr,
|
|
Packit Service |
c5cf8c |
MPI_STATUS_IGNORE, errflag);
|
|
Packit Service |
c5cf8c |
received = 1;
|
|
Packit Service |
c5cf8c |
if (mpi_errno) {
|
|
Packit Service |
c5cf8c |
/* for communication errors, just record the error but continue */
|
|
Packit Service |
c5cf8c |
*errflag =
|
|
Packit Service |
c5cf8c |
MPIX_ERR_PROC_FAILED ==
|
|
Packit Service |
c5cf8c |
MPIR_ERR_GET_CLASS(mpi_errno) ? MPIR_ERR_PROC_FAILED : MPIR_ERR_OTHER;
|
|
Packit Service |
c5cf8c |
MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
|
|
Packit Service |
c5cf8c |
MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* if some processes in this process's subtree in this step
|
|
Packit Service |
c5cf8c |
* did not have any destination process to communicate with
|
|
Packit Service |
c5cf8c |
* because of non-power-of-two, we need to send them the
|
|
Packit Service |
c5cf8c |
* result. We use a logarithmic recursive-halfing algorithm
|
|
Packit Service |
c5cf8c |
* for this. */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (dst_tree_root + mask > comm_size) {
|
|
Packit Service |
c5cf8c |
nprocs_completed = comm_size - my_tree_root - mask;
|
|
Packit Service |
c5cf8c |
/* nprocs_completed is the number of processes in this
|
|
Packit Service |
c5cf8c |
* subtree that have all the data. Send data to others
|
|
Packit Service |
c5cf8c |
* in a tree fashion. First find root of current tree
|
|
Packit Service |
c5cf8c |
* that is being divided into two. k is the number of
|
|
Packit Service |
c5cf8c |
* least-significant bits in this process's rank that
|
|
Packit Service |
c5cf8c |
* must be zeroed out to find the rank of the root */
|
|
Packit Service |
c5cf8c |
j = mask;
|
|
Packit Service |
c5cf8c |
k = 0;
|
|
Packit Service |
c5cf8c |
while (j) {
|
|
Packit Service |
c5cf8c |
j >>= 1;
|
|
Packit Service |
c5cf8c |
k++;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
k--;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
tmp_mask = mask >> 1;
|
|
Packit Service |
c5cf8c |
while (tmp_mask) {
|
|
Packit Service |
c5cf8c |
dst = rank ^ tmp_mask;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
tree_root = rank >> k;
|
|
Packit Service |
c5cf8c |
tree_root <<= k;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* send only if this proc has data and destination
|
|
Packit Service |
c5cf8c |
* doesn't have data. at any step, multiple processes
|
|
Packit Service |
c5cf8c |
* can send if they have the data */
|
|
Packit Service |
c5cf8c |
if ((dst > rank) && (rank < tree_root + nprocs_completed)
|
|
Packit Service |
c5cf8c |
&& (dst >= tree_root + nprocs_completed)) {
|
|
Packit Service |
c5cf8c |
/* send the current result */
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIC_Send(tmp_recvbuf, 1, recvtype,
|
|
Packit Service |
c5cf8c |
dst, MPIR_REDUCE_SCATTER_BLOCK_TAG, comm_ptr, errflag);
|
|
Packit Service |
c5cf8c |
if (mpi_errno) {
|
|
Packit Service |
c5cf8c |
/* for communication errors, just record the error but continue */
|
|
Packit Service |
c5cf8c |
*errflag =
|
|
Packit Service |
c5cf8c |
MPIX_ERR_PROC_FAILED ==
|
|
Packit Service |
c5cf8c |
MPIR_ERR_GET_CLASS(mpi_errno) ? MPIR_ERR_PROC_FAILED : MPIR_ERR_OTHER;
|
|
Packit Service |
c5cf8c |
MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
|
|
Packit Service |
c5cf8c |
MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
/* recv only if this proc. doesn't have data and sender
|
|
Packit Service |
c5cf8c |
* has data */
|
|
Packit Service |
c5cf8c |
else if ((dst < rank) &&
|
|
Packit Service |
c5cf8c |
(dst < tree_root + nprocs_completed) &&
|
|
Packit Service |
c5cf8c |
(rank >= tree_root + nprocs_completed)) {
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIC_Recv(tmp_recvbuf, 1, recvtype, dst,
|
|
Packit Service |
c5cf8c |
MPIR_REDUCE_SCATTER_BLOCK_TAG,
|
|
Packit Service |
c5cf8c |
comm_ptr, MPI_STATUS_IGNORE, errflag);
|
|
Packit Service |
c5cf8c |
received = 1;
|
|
Packit Service |
c5cf8c |
if (mpi_errno) {
|
|
Packit Service |
c5cf8c |
/* for communication errors, just record the error but continue */
|
|
Packit Service |
c5cf8c |
*errflag =
|
|
Packit Service |
c5cf8c |
MPIX_ERR_PROC_FAILED ==
|
|
Packit Service |
c5cf8c |
MPIR_ERR_GET_CLASS(mpi_errno) ? MPIR_ERR_PROC_FAILED : MPIR_ERR_OTHER;
|
|
Packit Service |
c5cf8c |
MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
|
|
Packit Service |
c5cf8c |
MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
tmp_mask >>= 1;
|
|
Packit Service |
c5cf8c |
k--;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* The following reduction is done here instead of after
|
|
Packit Service |
c5cf8c |
* the MPIC_Sendrecv or MPIC_Recv above. This is
|
|
Packit Service |
c5cf8c |
* because to do it above, in the noncommutative
|
|
Packit Service |
c5cf8c |
* case, we would need an extra temp buffer so as not to
|
|
Packit Service |
c5cf8c |
* overwrite temp_recvbuf, because temp_recvbuf may have
|
|
Packit Service |
c5cf8c |
* to be communicated to other processes in the
|
|
Packit Service |
c5cf8c |
* non-power-of-two case. To avoid that extra allocation,
|
|
Packit Service |
c5cf8c |
* we do the reduce here. */
|
|
Packit Service |
c5cf8c |
if (received) {
|
|
Packit Service |
c5cf8c |
if (is_commutative || (dst_tree_root < my_tree_root)) {
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Reduce_local(tmp_recvbuf, tmp_results, blklens[0], datatype, op);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Reduce_local(((char *) tmp_recvbuf + dis[1] * extent),
|
|
Packit Service |
c5cf8c |
((char *) tmp_results + dis[1] * extent),
|
|
Packit Service |
c5cf8c |
blklens[1], datatype, op);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Reduce_local(tmp_results, tmp_recvbuf, blklens[0], datatype, op);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Reduce_local(((char *) tmp_results + dis[1] * extent),
|
|
Packit Service |
c5cf8c |
((char *) tmp_recvbuf + dis[1] * extent),
|
|
Packit Service |
c5cf8c |
blklens[1], datatype, op);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* copy result back into tmp_results */
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Localcopy(tmp_recvbuf, 1, recvtype, tmp_results, 1, recvtype);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPIR_Type_free_impl(&sendtype);
|
|
Packit Service |
c5cf8c |
MPIR_Type_free_impl(&recvtype);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
mask <<= 1;
|
|
Packit Service |
c5cf8c |
i++;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* now copy final results from tmp_results to recvbuf */
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Localcopy(((char *) tmp_results + disps[rank] * extent),
|
|
Packit Service |
c5cf8c |
recvcount, datatype, recvbuf, recvcount, datatype);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
fn_exit:
|
|
Packit Service |
c5cf8c |
MPIR_CHKLMEM_FREEALL();
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
MPIR_Per_thread_t *per_thread = NULL;
|
|
Packit Service |
c5cf8c |
int err = 0;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPID_THREADPRIV_KEY_GET_ADDR(MPIR_ThreadInfo.isThreaded, MPIR_Per_thread_key,
|
|
Packit Service |
c5cf8c |
MPIR_Per_thread, per_thread, &err;;
|
|
Packit Service |
c5cf8c |
MPIR_Assert(err == 0);
|
|
Packit Service |
c5cf8c |
if (per_thread->op_errno)
|
|
Packit Service |
c5cf8c |
mpi_errno = per_thread->op_errno;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* --BEGIN ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
if (mpi_errno_ret)
|
|
Packit Service |
c5cf8c |
mpi_errno = mpi_errno_ret;
|
|
Packit Service |
c5cf8c |
else if (*errflag != MPIR_ERR_NONE)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
|
|
Packit Service |
c5cf8c |
/* --END ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
return mpi_errno;
|
|
Packit Service |
c5cf8c |
fn_fail:
|
|
Packit Service |
c5cf8c |
goto fn_exit;
|
|
Packit Service |
c5cf8c |
}
|