+/* 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"
int i, src, dst, rank, num_procs, block_size, my_z_base;
int my_z, X, Y, Z, send_offset, recv_offset;
int two_dsize, my_row_base, my_col_base, src_row_base, src_z_base, num_reqs;
int i, src, dst, rank, num_procs, block_size, my_z_base;
int my_z, X, Y, Z, send_offset, recv_offset;
int two_dsize, my_row_base, my_col_base, src_row_base, src_z_base, num_reqs;
- MPI_Comm_rank(comm, &rank);
- MPI_Comm_size(comm, &num_procs);
- MPI_Type_extent(send_type, &extent);
+ rank = smpi_comm_rank(comm);
+ num_procs = smpi_comm_size(comm);
+ extent = smpi_datatype_get_extent(send_type);
+
+ if (!is_3dmesh(num_procs, &X, &Y, &Z))
+ THROWF(arg_error,0, "allgather_3dmesh algorithm can't be used with this number of processes! ");
- MPIR_Localcopy(send_buff, send_count, send_type, (char *)recv_buff + recv_offset,
+ smpi_datatype_copy(send_buff, send_count, send_type, (char *)recv_buff + recv_offset,
- MPIC_Irecv((char *)recv_buff + recv_offset, send_count, recv_type, src, tag,
- comm, req_ptr++);
+ *(req_ptr++) = smpi_mpi_irecv((char *)recv_buff + recv_offset, send_count, recv_type, src, tag,
+ comm);
- MPIC_Send(send_buff, send_count, send_type, dst, tag, comm);
+ smpi_mpi_send(send_buff, send_count, send_type, dst, tag, comm);
- MPIC_Irecv((char *)recv_buff + recv_offset, recv_count * Y, recv_type, src, tag,
- comm, req_ptr++);
+ *(req_ptr++) = smpi_mpi_irecv((char *)recv_buff + recv_offset, recv_count * Y, recv_type, src, tag,
+ comm);
- MPIC_Send((char *)recv_buff + send_offset, send_count * Y, send_type, dst, tag,
+ smpi_mpi_send((char *)recv_buff + send_offset, send_count * Y, send_type, dst, tag,
- MPIC_Irecv((char *)recv_buff + recv_offset, recv_count * two_dsize, recv_type,
- src, tag, comm, req_ptr++);
+ *(req_ptr++) = smpi_mpi_irecv((char *)recv_buff + recv_offset, recv_count * two_dsize, recv_type,
+ src, tag, comm);
}
for (i = 1; i < Z; i++) {
dst = (rank + i * two_dsize) % num_procs;
send_offset = my_z_base * block_size;
}
for (i = 1; i < Z; i++) {
dst = (rank + i * two_dsize) % num_procs;
send_offset = my_z_base * block_size;
- MPIC_Send((char *)recv_buff + send_offset, send_count * two_dsize, send_type,
+ smpi_mpi_send((char *)recv_buff + send_offset, send_count * two_dsize, send_type,