* 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. */
* comm: communication
* Descrp: Function realizes the allgather operation using the 2dmesh
* algorithm. Allgather ommunication occurs first in the x dimension then in
* comm: communication
* Descrp: Function realizes the allgather operation using the 2dmesh
* algorithm. Allgather ommunication occurs first in the x dimension then in
send_type, void *recv_buff, int recv_count,
MPI_Datatype recv_type, MPI_Comm comm)
{
send_type, void *recv_buff, int recv_count,
MPI_Datatype recv_type, MPI_Comm comm)
{
MPI_Aint extent;
int i, src, dst, rank, num_procs;
MPI_Aint extent;
int i, src, dst, rank, num_procs;
block_size = extent * send_count;
if (not is_2dmesh(num_procs, &X, &Y))
block_size = extent * send_count;
if (not is_2dmesh(num_procs, &X, &Y))
recv_offset = rank * block_size;
Datatype::copy(send_buff, send_count, send_type, (char *)recv_buff + recv_offset,
recv_count, recv_type);
recv_offset = rank * block_size;
Datatype::copy(send_buff, send_count, send_type, (char *)recv_buff + recv_offset,
recv_count, recv_type);