-/* Copyright (c) 2013-2017. 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
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include "../colls_private.h"
+#include "../colls_private.hpp"
/*
reduce
*/
namespace simgrid{
namespace smpi{
-int Coll_reduce_scatter_gather::reduce(void *sendbuf, void *recvbuf,
+int Coll_reduce_scatter_gather::reduce(const void *sendbuf, void *recvbuf,
int count, MPI_Datatype datatype,
MPI_Op op, int root, MPI_Comm comm)
{
return 0;
rank = comm->rank();
comm_size = comm->size();
-
+
extent = datatype->get_extent();
} else /* rank >= 2*rem */
newrank = rank - rem;
- cnts = (int *) xbt_malloc(pof2 * sizeof(int));
- disps = (int *) xbt_malloc(pof2 * sizeof(int));
+ cnts = new int[pof2];
+ disps = new int[pof2];
if (newrank != -1) {
for (i = 0; i < (pof2 - 1); i++)
} else /* rank >= 2*rem */
newrank = rank - rem;
- cnts = (int *) xbt_malloc(pof2 * sizeof(int));
- disps = (int *) xbt_malloc(pof2 * sizeof(int));
+ cnts = new int[pof2];
+ disps = new int[pof2];
if (newrank != -1) {
for (i = 0; i < (pof2 - 1); i++)
if (tmp_buf)
smpi_free_tmp_buffer(tmp_buf);
if(temporary_buffer==1) smpi_free_tmp_buffer(recvbuf);
- if (cnts)
- free(cnts);
- if (disps)
- free(disps);
+ delete[] cnts;
+ delete[] disps;
return 0;
}