displs[i] = count;
count += recvcounts[i];
}
- tmpbuf=(void*)xbt_malloc(count*smpi_datatype_get_extent(datatype));
+ tmpbuf=(void*)smpi_get_tmp_sendbuffer(count*smpi_datatype_get_extent(datatype));
+
mpi_coll_reduce_fun(sendbuf, tmpbuf, count, datatype, op, 0, comm);
smpi_mpi_scatterv(tmpbuf, recvcounts, displs, datatype, recvbuf,
recvcounts[rank], datatype, 0, comm);
xbt_free(displs);
- xbt_free(tmpbuf);
+ smpi_free_tmp_buffer(tmpbuf);
}
void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
if(src != root) {
// FIXME: possibly overkill we we have contiguous/noncontiguous data
// mapping...
- tmpbufs[index] = xbt_malloc(count * dataext);
+ if (!_xbt_replay_is_active())
+ tmpbufs[index] = xbt_malloc(count * dataext);
+ else
+ tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
requests[index] =
smpi_irecv_init(tmpbufs[index], count, datatype, src,
system_tag, comm);
if(op) /* op can be MPI_OP_NULL that does nothing */
smpi_op_apply(op, tmpbufs[index], recvbuf, &count, &datatype);
}
- for(index = 0; index < size - 1; index++) {
- xbt_free(tmpbufs[index]);
- }
+ for(index = 0; index < size - 1; index++) {
+ smpi_free_tmp_buffer(tmpbufs[index]);
+ }
xbt_free(tmpbufs);
xbt_free(requests);