Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Spell check.
[simgrid.git] / src / smpi / colls / alltoall / alltoall-bruck.cpp
index 0d971d8..568ee25 100644 (file)
@@ -21,7 +21,7 @@
 
  * Descrp: Function realizes the alltoall operation using the bruck algorithm.
 
- * Auther: MPICH / modified by Ahmad Faraj
+ * Author: MPICH / modified by Ahmad Faraj
 
  ****************************************************************************/
 
@@ -32,7 +32,7 @@ namespace smpi{
 
 
 int
-Coll_alltoall_bruck::alltoall(void *send_buff, int send_count,
+Coll_alltoall_bruck::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)
@@ -41,12 +41,9 @@ Coll_alltoall_bruck::alltoall(void *send_buff, int send_count,
   MPI_Aint extent;
   MPI_Datatype new_type;
 
-  int *blocks_length, *disps;
   int i, src, dst, rank, num_procs, count, block, position;
   int pack_size, tag = COLL_TAG_ALLTOALL, pof2 = 1;
 
-
-  char *tmp_buff;
   char *send_ptr = (char *) send_buff;
   char *recv_ptr = (char *) recv_buff;
 
@@ -55,9 +52,9 @@ Coll_alltoall_bruck::alltoall(void *send_buff, int send_count,
 
   extent = recv_type->get_extent();
 
-  tmp_buff = (char *) smpi_get_tmp_sendbuffer(num_procs * recv_count * extent);
-  disps = (int *) xbt_malloc(sizeof(int) * num_procs);
-  blocks_length = (int *) xbt_malloc(sizeof(int) * num_procs);
+  unsigned char* tmp_buff = smpi_get_tmp_sendbuffer(num_procs * recv_count * extent);
+  int* disps         = new int[num_procs];
+  int* blocks_length = new int[num_procs];
 
   Request::sendrecv(send_ptr + rank * send_count * extent,
                (num_procs - rank) * send_count, send_type, rank, tag,
@@ -98,8 +95,8 @@ Coll_alltoall_bruck::alltoall(void *send_buff, int send_count,
     pof2 *= 2;
   }
 
-  free(disps);
-  free(blocks_length);
+  delete[] disps;
+  delete[] blocks_length;
 
   Request::sendrecv(recv_ptr + (rank + 1) * recv_count * extent,
                (num_procs - rank - 1) * recv_count, send_type,