A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change malloc/free to new/delete.
[simgrid.git]
/
src
/
smpi
/
colls
/
reduce
/
reduce-scatter-gather.cpp
diff --git
a/src/smpi/colls/reduce/reduce-scatter-gather.cpp
b/src/smpi/colls/reduce/reduce-scatter-gather.cpp
index
4b987aa
..
07eb4bd
100644
(file)
--- a/
src/smpi/colls/reduce/reduce-scatter-gather.cpp
+++ b/
src/smpi/colls/reduce/reduce-scatter-gather.cpp
@@
-1,10
+1,10
@@
-/* Copyright (c) 2013-201
7
. The SimGrid Team.
+/* Copyright (c) 2013-201
9
. 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. */
* 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.h
pp
"
/*
reduce
/*
reduce
@@
-12,7
+12,7
@@
*/
namespace simgrid{
namespace smpi{
*/
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)
{
int count, MPI_Datatype datatype,
MPI_Op op, int root, MPI_Comm comm)
{
@@
-75,8
+75,8
@@
int Coll_reduce_scatter_gather::reduce(void *sendbuf, void *recvbuf,
} else /* rank >= 2*rem */
newrank = rank - rem;
} 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 (newrank != -1) {
for (i = 0; i < (pof2 - 1); i++)
@@
-252,8
+252,8
@@
int Coll_reduce_scatter_gather::reduce(void *sendbuf, void *recvbuf,
} else /* rank >= 2*rem */
newrank = rank - rem;
} 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 (newrank != -1) {
for (i = 0; i < (pof2 - 1); i++)
@@
-404,10
+404,8
@@
int Coll_reduce_scatter_gather::reduce(void *sendbuf, void *recvbuf,
if (tmp_buf)
smpi_free_tmp_buffer(tmp_buf);
if(temporary_buffer==1) smpi_free_tmp_buffer(recvbuf);
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;
}
return 0;
}