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
/
alltoall
/
alltoall-2dmesh.cpp
diff --git
a/src/smpi/colls/alltoall/alltoall-2dmesh.cpp
b/src/smpi/colls/alltoall/alltoall-2dmesh.cpp
index
6b6c841
..
41c2cef
100644
(file)
--- a/
src/smpi/colls/alltoall/alltoall-2dmesh.cpp
+++ b/
src/smpi/colls/alltoall/alltoall-2dmesh.cpp
@@
-1,11
+1,11
@@
-/* 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 <
math.
h>
+#include "../colls_private.h
pp
"
+#include <
cmat
h>
/*****************************************************************************
/*****************************************************************************
@@
-26,7
+26,7
@@
algorithm. It actually performs allgather operation in x dimension
then in the y dimension. Each node then extracts the needed data.
The communication in each dimension follows "simple."
algorithm. It actually performs allgather operation in x dimension
then in the y dimension. Each node then extracts the needed data.
The communication in each dimension follows "simple."
-
+
* Auther: Ahmad Faraj
****************************************************************************/
* Auther: Ahmad Faraj
****************************************************************************/
@@
-55,13
+55,12
@@
static int alltoall_check_is_2dmesh(int num, int *i, int *j)
namespace simgrid{
namespace smpi{
namespace simgrid{
namespace smpi{
-int Coll_alltoall_2dmesh::alltoall(void *send_buff, int send_count,
+int Coll_alltoall_2dmesh::alltoall(
const
void *send_buff, int send_count,
MPI_Datatype send_type,
void *recv_buff, int recv_count,
MPI_Datatype recv_type, MPI_Comm comm)
{
MPI_Datatype send_type,
void *recv_buff, int recv_count,
MPI_Datatype recv_type, MPI_Comm comm)
{
- MPI_Status *statuses, s;
- MPI_Request *reqs, *req_ptr;;
+ MPI_Status s;
MPI_Aint extent;
char *tmp_buff1, *tmp_buff2;
MPI_Aint extent;
char *tmp_buff1, *tmp_buff2;
@@
-74,7
+73,7
@@
int Coll_alltoall_2dmesh::alltoall(void *send_buff, int send_count,
num_procs = comm->size();
extent = send_type->get_extent();
num_procs = comm->size();
extent = send_type->get_extent();
- if (
!
alltoall_check_is_2dmesh(num_procs, &X, &Y))
+ if (
not
alltoall_check_is_2dmesh(num_procs, &X, &Y))
return MPI_ERR_OTHER;
my_row_base = (rank / Y) * Y;
return MPI_ERR_OTHER;
my_row_base = (rank / Y) * Y;
@@
-89,10
+88,9
@@
int Coll_alltoall_2dmesh::alltoall(void *send_buff, int send_count,
if (Y > X)
num_reqs = Y;
if (Y > X)
num_reqs = Y;
- statuses = (MPI_Status *) xbt_malloc(num_reqs * sizeof(MPI_Status));
- reqs = (MPI_Request *) xbt_malloc(num_reqs * sizeof(MPI_Request));
-
- req_ptr = reqs;
+ MPI_Status* statuses = new MPI_Status[num_reqs];
+ MPI_Request* reqs = new MPI_Request[num_reqs];
+ MPI_Request* req_ptr = reqs;
count = send_count * num_procs;
count = send_count * num_procs;
@@
-168,8
+166,8
@@
int Coll_alltoall_2dmesh::alltoall(void *send_buff, int send_count,
Request::send(tmp_buff2, send_count * Y, send_type, dst, tag, comm);
}
Request::waitall(X - 1, reqs, statuses);
Request::send(tmp_buff2, send_count * Y, send_type, dst, tag, comm);
}
Request::waitall(X - 1, reqs, statuses);
-
free(reqs)
;
-
free(statuses)
;
+
delete[] reqs
;
+
delete[] statuses
;
smpi_free_tmp_buffer(tmp_buff1);
smpi_free_tmp_buffer(tmp_buff2);
return MPI_SUCCESS;
smpi_free_tmp_buffer(tmp_buff1);
smpi_free_tmp_buffer(tmp_buff2);
return MPI_SUCCESS;