-/* Copyright (c) 2013-2018. The SimGrid Team.
+/* Copyright (c) 2013-2019. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
namespace simgrid{
namespace smpi{
-int Coll_reduce_scatter_mpich_pair::reduce_scatter(void *sendbuf, void *recvbuf, int recvcounts[],
+int Coll_reduce_scatter_mpich_pair::reduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[],
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
int rank, comm_size, i;
MPI_Aint extent, true_extent, true_lb;
- int *disps;
void *tmp_recvbuf;
int mpi_errno = MPI_SUCCESS;
int total_count, dst, src;
is_commutative = 1;
}
- disps = (int*)xbt_malloc( comm_size * sizeof(int));
+ int* disps = new int[comm_size];
total_count = 0;
for (i=0; i<comm_size; i++) {
}
if (total_count == 0) {
- xbt_free(disps);
- return MPI_ERR_COUNT;
+ delete[] disps;
+ return MPI_ERR_COUNT;
}
if (sendbuf != MPI_IN_PLACE) {
if (mpi_errno) return(mpi_errno);
}
- xbt_free(disps);
+ delete[] disps;
smpi_free_tmp_buffer(tmp_recvbuf);
return MPI_SUCCESS;
}
-int Coll_reduce_scatter_mpich_noncomm::reduce_scatter(void *sendbuf, void *recvbuf, int recvcounts[],
+int Coll_reduce_scatter_mpich_noncomm::reduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[],
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
int mpi_errno = MPI_SUCCESS;
-int Coll_reduce_scatter_mpich_rdb::reduce_scatter(void *sendbuf, void *recvbuf, int recvcounts[],
+int Coll_reduce_scatter_mpich_rdb::reduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[],
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
int rank, comm_size, i;
MPI_Aint extent, true_extent, true_lb;
- int *disps;
void *tmp_recvbuf, *tmp_results;
int mpi_errno = MPI_SUCCESS;
int dis[2], blklens[2], total_count, dst;
is_commutative = 1;
}
- disps = (int*)xbt_malloc( comm_size * sizeof(int));
+ int* disps = new int[comm_size];
total_count = 0;
for (i=0; i<comm_size; i++) {
recvcounts[rank], datatype);
if (mpi_errno) return(mpi_errno);
- xbt_free(disps);
+ delete[] disps;
smpi_free_tmp_buffer(tmp_recvbuf);
smpi_free_tmp_buffer(tmp_results);
return MPI_SUCCESS;