+/* Copyright (c) 2013-2014. 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 <math.h>
MPI_Status status, *statuses;
int i, j, src, dst, rank, num_procs, num_reqs, X, Y, Z, block_size, count;
int my_z, two_dsize, my_row_base, my_col_base, my_z_base, src_row_base;
- int src_z_base, send_offset, recv_offset, tag = 1;
+ int src_z_base, send_offset, recv_offset, tag = COLL_TAG_ALLTOALL;
char *tmp_buff1, *tmp_buff2;
block_size = extent * send_count;
- tmp_buff1 = (char *) xbt_malloc(block_size * num_procs * two_dsize);
- tmp_buff2 = (char *) xbt_malloc(block_size * two_dsize);
+ tmp_buff1 = (char *) smpi_get_tmp_sendbuffer(block_size * num_procs * two_dsize);
+ tmp_buff2 = (char *) smpi_get_tmp_recvbuffer(block_size * two_dsize);
statuses = (MPI_Status *) xbt_malloc(num_reqs * sizeof(MPI_Status));
reqs = (MPI_Request *) xbt_malloc(num_reqs * sizeof(MPI_Request));
req_ptr = reqs;
- send_offset = recv_offset = (rank % two_dsize) * block_size * num_procs;
+ recv_offset = (rank % two_dsize) * block_size * num_procs;
smpi_mpi_sendrecv(send_buff, send_count * num_procs, send_type, rank, tag,
tmp_buff1 + recv_offset, num_procs * recv_count,
free(reqs);
free(statuses);
- free(tmp_buff1);
- free(tmp_buff2);
+ smpi_free_tmp_buffer(tmp_buff1);
+ smpi_free_tmp_buffer(tmp_buff2);
return MPI_SUCCESS;
}