Esempio n. 1
0
/**
 * vsg_packed_msg_bcast:
 * @pm: a #VsgPackedMsg.
 * @src: the source task id. Can be %MPI_ANY_SOURCE.
 *
 * Performs a MPI_Bcast on @pm. @pm must be of the same size across
 * all processes (ie. similar calls to vsg_packed_msg_send_append()
 * must have been previously issued on every processor).
 */
void vsg_packed_msg_bcast (VsgPackedMsg *pm, gint src)
{
  gint ierr;
  gint rk;

  g_assert (pm->own_buffer == TRUE);

  MPI_Comm_rank (pm->communicator, &rk);

  if (rk == src)
    _trace_write_msg_send (pm, "bcast-send", src, -1);

  ierr = MPI_Bcast (pm->buffer, pm->position, MPI_PACKED, src,
                    pm->communicator);

  _bcast_count ++;
  _bcast_size += pm->position;

  if (rk != src)
    _trace_write_msg_recv (pm, "bcast-recv", src, -1);

  pm->position = _PM_BEGIN_POS;

  if (ierr != MPI_SUCCESS) vsg_mpi_error_output (ierr);
}
Esempio n. 2
0
/**
 * vsg_packed_msg_ssend:
 * @pm: a #VsgPackedMsg.
 * @dst: the destination task id.
 * @tag: an integer message tag.
 *
 * Sends stored message to the specified destination with the specified tag.
 */
void vsg_packed_msg_ssend (VsgPackedMsg *pm, gint dst, gint tag)
{
  gint ierr;

  _trace_write_msg_send (pm, "ssend", dst, tag);

  ierr = MPI_Ssend (pm->buffer, pm->position, MPI_PACKED, dst, tag,
                    pm->communicator);

  if (ierr != MPI_SUCCESS) vsg_mpi_error_output (ierr);
}
Esempio n. 3
0
/**
 * vsg_packed_msg_issend:
 * @pm: a #VsgPackedMsg.
 * @dst: the destination task id.
 * @tag: an integer message tag.
 * @request: the corresponding request object
 *
 * Sends stored message to the specified destination with the specified tag in
 * a non blocking mode. @request is provided for output.
 */
void vsg_packed_msg_issend (VsgPackedMsg *pm, gint dst, gint tag,
                            MPI_Request *request)
{
  gint ierr;

  _trace_write_msg_send (pm, "issend", dst, tag);

  _send_count ++;
  _send_size += pm->position;

  ierr = MPI_Issend (pm->buffer, pm->position, MPI_PACKED, dst, tag,
                     pm->communicator, request);

  if (ierr != MPI_SUCCESS) vsg_mpi_error_output (ierr);
}