- mpi_coll_reduce_fun(sendbuf, recvbuf, count, datatype, op, root, comm);
+
+ char* sendtmpbuf = (char*) sendbuf;
+ if( sendbuf == MPI_IN_PLACE ) {
+ sendtmpbuf = (char *)xbt_malloc(count*smpi_datatype_get_extent(datatype));
+ smpi_datatype_copy(recvbuf, count, datatype,sendtmpbuf, count, datatype);
+ }
+
+ mpi_coll_reduce_fun(sendtmpbuf, recvbuf, count, datatype, op, root, comm);
+
+ if( sendbuf == MPI_IN_PLACE ) {
+ xbt_free(sendtmpbuf);
+ }
+