size = comm->size();
rextent = rtype->get_extent();
sextent = stype->get_extent();
- auto* rrequest_array = new MPI_Request[size];
- auto* srequest_array = new MPI_Request[size];
// irregular case use default MPI functions
if (scount * sextent != rcount * rextent) {
//start sending logical ring message
int increment = scount * sextent;
+ auto* rrequest_array = new MPI_Request[size];
+ auto* srequest_array = new MPI_Request[size];
+
//post all irecv first
for (i = 0; i < size - 1; i++) {
recv_offset = ((rank - i - 1 + size) % size) * increment;
/* copy result back into recvbuf */
mpi_errno =
Datatype::copy(tmp_recvbuf, recvcounts[rank], datatype, recvbuf, recvcounts[rank], datatype);
- if (mpi_errno)
+ if (mpi_errno) {
+ delete[] disps;
+ smpi_free_tmp_buffer(tmp_recvbuf);
return (mpi_errno);
+ }
}
else {
if (op != MPI_OP_NULL)
/* copy result back into recvbuf */
mpi_errno = Datatype::copy(tmp_recvbuf, recvcounts[rank], datatype,
((char*)recvbuf + disps[rank] * extent), recvcounts[rank], datatype);
- if (mpi_errno)
+ if (mpi_errno) {
+ delete[] disps;
+ smpi_free_tmp_buffer(tmp_recvbuf);
return (mpi_errno);
+ }
}
}
}
recvcounts[rank], datatype,
recvbuf,
recvcounts[rank], datatype );
- if (mpi_errno) return(mpi_errno);
+ if (mpi_errno) {
+ delete[] disps;
+ smpi_free_tmp_buffer(tmp_recvbuf);
+ return (mpi_errno);
+ }
}
delete[] disps;
else
mpi_errno = Datatype::copy(recvbuf, total_count, datatype, tmp_results, total_count, datatype);
- if (mpi_errno)
+ if (mpi_errno) {
+ delete[] disps;
return (mpi_errno);
+ }
mask = 0x1;
i = 0;