OpenMPI  0.1.1
pml_bfo_recvfrag.c File Reference
#include "ompi_config.h"
#include "opal/class/opal_list.h"
#include "opal/threads/mutex.h"
#include "opal/prefetch.h"
#include "ompi/constants.h"
#include "ompi/communicator/communicator.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/peruse/peruse-internal.h"
#include "ompi/memchecker.h"
#include "pml_bfo.h"
#include "pml_bfo_comm.h"
#include "pml_bfo_recvfrag.h"
#include "pml_bfo_recvreq.h"
#include "pml_bfo_sendreq.h"
#include "pml_bfo_hdr.h"

Macros

#define PML_MAX_SEQ   ~((mca_pml_sequence_t)0);
 

Functions

 OBJ_CLASS_INSTANCE (mca_pml_bfo_buffer_t, ompi_free_list_item_t, NULL, NULL)
 
 OBJ_CLASS_INSTANCE (mca_pml_bfo_recv_frag_t, opal_list_item_t, NULL, NULL)
 
static void append_frag_to_list (opal_list_t *queue, mca_btl_base_module_t *btl, mca_pml_bfo_match_hdr_t *hdr, mca_btl_base_segment_t *segments, size_t num_segments, mca_pml_bfo_recv_frag_t *frag)
 Static functions. More...
 
static int mca_pml_bfo_recv_frag_match (mca_btl_base_module_t *btl, mca_pml_bfo_match_hdr_t *hdr, mca_btl_base_segment_t *segments, size_t num_segments, int type)
 Match incoming recv_frags against posted receives. More...
 
static mca_pml_bfo_recv_request_tmatch_one (mca_btl_base_module_t *btl, mca_pml_bfo_match_hdr_t *hdr, mca_btl_base_segment_t *segments, size_t num_segments, ompi_communicator_t *comm_ptr, mca_pml_bfo_comm_proc_t *proc, mca_pml_bfo_recv_frag_t *frag)
 
void mca_pml_bfo_recv_frag_callback_match (mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *des, void *cbdata)
 Callback from BTL on receipt of a recv_frag (match).
 
void mca_pml_bfo_recv_frag_callback_rndv (mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *des, void *cbdata)
 Callback from BTL on receipt of a recv_frag (rndv).
 
void mca_pml_bfo_recv_frag_callback_rget (mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *des, void *cbdata)
 Callback from BTL on receipt of a recv_frag (rget).
 
void mca_pml_bfo_recv_frag_callback_ack (mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *des, void *cbdata)
 Callback from BTL on receipt of a recv_frag (ack).
 
void mca_pml_bfo_recv_frag_callback_frag (mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *des, void *cbdata)
 Callback from BTL on receipt of a recv_frag (frag).
 
void mca_pml_bfo_recv_frag_callback_put (mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *des, void *cbdata)
 Callback from BTL on receipt of a recv_frag (put).
 
void mca_pml_bfo_recv_frag_callback_fin (mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *des, void *cbdata)
 Callback from BTL on receipt of a recv_frag (fin).
 
static mca_pml_bfo_recv_request_tget_posted_recv (opal_list_t *queue)
 
static mca_pml_bfo_recv_request_tget_next_posted_recv (opal_list_t *queue, mca_pml_bfo_recv_request_t *req)
 
static mca_pml_bfo_recv_request_tmatch_incomming (mca_pml_bfo_match_hdr_t *hdr, mca_pml_bfo_comm_t *comm, mca_pml_bfo_comm_proc_t *proc)
 
static mca_pml_bfo_recv_frag_tcheck_cantmatch_for_match (mca_pml_bfo_comm_proc_t *proc)
 

Function Documentation

static void append_frag_to_list ( opal_list_t queue,
mca_btl_base_module_t btl,
mca_pml_bfo_match_hdr_t hdr,
mca_btl_base_segment_t segments,
size_t  num_segments,
mca_pml_bfo_recv_frag_t frag 
)
static

Static functions.

Append a unexpected descriptor to a queue. This function will allocate and initialize the fragment (if necessary) and then will add it to the specified queue. The allocated fragment is not returned to the caller.

References opal_list_append.

Referenced by mca_pml_bfo_recv_frag_callback_match(), and mca_pml_bfo_recv_frag_match().

static int mca_pml_bfo_recv_frag_match ( mca_btl_base_module_t btl,
mca_pml_bfo_match_hdr_t hdr,
mca_btl_base_segment_t segments,
size_t  num_segments,
int  type 
)
static

Match incoming recv_frags against posted receives.

RCS/CTS receive side matching.

Supports out of order delivery.

Parameters
frag_header(IN) Header of received recv_frag.
frag_desc(IN) Received recv_frag descriptor.
match_made(OUT) Flag indicating wether a match was made.
additional_matches(OUT) List of additional matches
Returns
OMPI_SUCCESS or error status on failure.
Parameters
hdrlist of parameters needed for matching This list is also embeded in frag, but this allows to save a memory copy when a match is made in this routine. (IN)
fragpointer to receive fragment which we want to match (IN/OUT). If a match is not made, hdr is copied to frag.
match_madeparameter indicating if we matched frag/ hdr (OUT)
additional_matchesif a match is made with frag, we may be able to match fragments that previously have arrived out-of-order. If this is the case, the associated fragment descriptors are put on this list for further processing. (OUT)
Returns
OMPI error code

This routine is used to try and match a newly arrived message fragment to pre-posted receives. The following assumptions are made

  • fragments are received out of order
  • for long messages, e.g. more than one fragment, a RTS/CTS algorithm is used.
  • 2nd and greater fragments include a receive descriptor pointer
  • fragments may be dropped
  • fragments may be corrupt
  • this routine may be called simultaneously by more than one thread

We generate the MSG_ARRIVED event as soon as the PML is aware of a matching fragment arrival. Independing if it is received on the correct order or not. This will allow the tools to figure out if the messages are not received in the correct order (if multiple network interfaces).

We generate the SEARCH_POSTED_QUEUE only when the message is received in the correct sequence. Otherwise, we delay the event generation until we reach the correct sequence number.

The match is over. We generate the SEARCH_POSTED_Q_END here, before going into the mca_pml_bfo_check_cantmatch_for_match so we can make a difference for the searching time for all messages.

References append_frag_to_list(), mca_pml_bfo_comm_proc_t::expected_sequence, mca_pml_bfo_comm_proc_t::frags_cant_match, mca_pml_bfo_match_hdr_t::hdr_common, mca_pml_bfo_match_hdr_t::hdr_ctx, mca_pml_bfo_common_hdr_t::hdr_flags, mca_pml_bfo_match_hdr_t::hdr_seq, mca_pml_bfo_match_hdr_t::hdr_src, mca_pml_bfo_match_hdr_t::hdr_tag, mca_pml_bfo_common_hdr_t::hdr_type, mca_pml_comm_t::matching_lock, mca_pml_bfo_get_request(), mca_pml_bfo_is_duplicate_msg(), mca_pml_bfo_recv_request_progress_rndv(), opal_list_get_size(), OPAL_THREAD_LOCK, and OPAL_THREAD_UNLOCK.

Referenced by mca_pml_bfo_recv_frag_callback_match(), mca_pml_bfo_recv_frag_callback_rget(), and mca_pml_bfo_recv_frag_callback_rndv().