1
1

- match fragments when a receive is posted

This commit was SVN r648.
Этот коммит содержится в:
Tim Woodall 2004-02-04 17:11:57 +00:00
родитель e195983847
Коммит b8d6c49fac
13 изменённых файлов: 153 добавлений и 55 удалений

Просмотреть файл

@ -4,16 +4,15 @@
int mca_pml_teg_recv_request_start(mca_ptl_base_recv_request_t* req)
{
int rc;
THREAD_SCOPED_LOCK(&mca_pml_teg.teg_lock,
(req->req_sequence = mca_pml_teg.teg_recv_sequence++));
req->super.req_status = MCA_PML_STATUS_INCOMPLETE;
if(req->super.req_peer == LAM_ANY_TAG) {
rc = mca_ptl_base_recv_request_match_wild(req);
mca_ptl_base_recv_request_match_wild(req);
} else {
rc = mca_ptl_base_recv_request_match_specific(req);
mca_ptl_base_recv_request_match_specific(req);
}
return rc;
return LAM_SUCCESS;
}

Просмотреть файл

@ -1,6 +1,10 @@
#include "ptl_base_comm.h"
static void mca_pml_ptl_comm_init(mca_pml_comm_t* comm);
static void mca_pml_ptl_comm_destroy(mca_pml_comm_t* comm);
lam_class_info_t mca_pml_ptl_comm_cls = {
"mca_pml_comm_t",
&lam_object_cls,
@ -8,14 +12,14 @@ lam_class_info_t mca_pml_ptl_comm_cls = {
(class_destroy_t)mca_pml_ptl_comm_destroy
};
void mca_pml_ptl_comm_init(mca_pml_comm_t* comm)
static void mca_pml_ptl_comm_init(mca_pml_comm_t* comm)
{
SUPER_INIT(comm, &lam_object_cls);
STATIC_INIT(comm->c_wild_receives, &lam_list_cls);
lam_mutex_init(&comm->c_wild_lock);
}
void mca_pml_ptl_comm_destroy(mca_pml_comm_t* comm)
static void mca_pml_ptl_comm_destroy(mca_pml_comm_t* comm)
{
LAM_FREE(comm->c_msg_seq);
LAM_FREE(comm->c_next_msg_seq);

Просмотреть файл

@ -47,9 +47,7 @@ struct mca_pml_comm_t {
typedef struct mca_pml_comm_t mca_pml_comm_t;
extern void mca_pml_ptl_comm_init(struct mca_pml_comm_t*);
extern int mca_pml_ptl_comm_init_size(struct mca_pml_comm_t*, size_t);
extern void mca_pml_ptl_comm_destroy(struct mca_pml_comm_t*);
#endif

Просмотреть файл

@ -6,6 +6,10 @@
#include "lam/lfc/list.h"
#include "mca/mpi/ptl/base/ptl_base_fragment.h"
static void mca_ptl_base_frag_init(mca_ptl_base_frag_t* frag);
static void mca_ptl_base_frag_destroy(mca_ptl_base_frag_t* frag);
lam_class_info_t mca_ptl_base_frag_cls = {
"mca_ptl_base_frag_t",
&lam_list_item_cls,
@ -13,12 +17,12 @@ lam_class_info_t mca_ptl_base_frag_cls = {
(class_destroy_t) mca_ptl_base_frag_destroy
};
void mca_ptl_base_frag_init(mca_ptl_base_frag_t* frag)
static void mca_ptl_base_frag_init(mca_ptl_base_frag_t* frag)
{
SUPER_INIT(frag, &lam_list_item_cls);
}
void mca_ptl_base_frag_destroy(mca_ptl_base_frag_t* frag)
static void mca_ptl_base_frag_destroy(mca_ptl_base_frag_t* frag)
{
SUPER_DESTROY(frag, &lam_list_item_cls);
}

Просмотреть файл

@ -24,8 +24,5 @@ struct mca_ptl_base_frag_t {
typedef struct mca_ptl_base_frag_t mca_ptl_base_frag_t;
void mca_ptl_base_frag_init(mca_ptl_base_frag_t*);
void mca_ptl_base_frag_destroy(mca_ptl_base_frag_t*);
#endif

Просмотреть файл

@ -7,6 +7,9 @@
#include "mca/mpi/ptl/base/ptl_base_recvfrag.h"
#include "mca/mpi/ptl/base/ptl_base_match.h"
static void mca_ptl_base_recv_frag_init(mca_ptl_base_recv_frag_t* frag);
static void mca_ptl_base_recv_frag_destroy(mca_ptl_base_recv_frag_t* frag);
lam_class_info_t mca_ptl_base_recv_frag_cls = {
"mca_ptl_base_recv_frag_t",

Просмотреть файл

@ -21,9 +21,7 @@ struct mca_ptl_base_recv_frag_t {
typedef struct mca_ptl_base_recv_frag_t mca_ptl_base_recv_frag_t;
void mca_ptl_base_recv_frag_init(mca_ptl_base_recv_frag_t*);
void mca_ptl_base_recv_frag_destroy(mca_ptl_base_recv_frag_t*);
int mca_ptl_base_recv_frag_match(mca_ptl_base_recv_frag_t*, mca_ptl_base_header_t*);
int mca_ptl_base_recv_frag_match(mca_ptl_base_recv_frag_t*, mca_ptl_base_header_t*);
#endif

Просмотреть файл

@ -3,11 +3,17 @@
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "lam/types.h"
#include "mca/mpi/ptl/base/ptl_base_comm.h"
#include "mca/mpi/ptl/base/ptl_base_recvreq.h"
#include "mca/mpi/ptl/base/ptl_base_recvfrag.h"
static void mca_ptl_base_recv_request_init(mca_ptl_base_recv_request_t*);
static void mca_ptl_base_recv_request_destroy(mca_ptl_base_recv_request_t*);
static bool mca_ptl_base_recv_request_match_specific_proc(mca_ptl_base_recv_request_t*, int);
lam_class_info_t mca_ptl_base_recv_request_cls = {
"mca_ptl_base_recv_request_t",
&mca_pml_base_request_cls,
@ -16,40 +22,131 @@ lam_class_info_t mca_ptl_base_recv_request_cls = {
};
void mca_ptl_base_recv_request_init(mca_ptl_base_recv_request_t* req)
static void mca_ptl_base_recv_request_init(mca_ptl_base_recv_request_t* request)
{
SUPER_INIT(req, &mca_pml_base_request_cls);
}
void mca_ptl_base_recv_request_destroy(mca_ptl_base_recv_request_t* req)
{
SUPER_DESTROY(req, &mca_pml_base_request_cls);
SUPER_INIT(request, &mca_pml_base_request_cls);
}
int mca_ptl_base_recv_request_match_specific(mca_ptl_base_recv_request_t* req)
static void mca_ptl_base_recv_request_destroy(mca_ptl_base_recv_request_t* request)
{
mca_pml_comm_t* comm = req->super.req_communicator->c_pml_comm;
int req_peer = req->super.req_peer;
/* FIX - need to check for matching fragments */
THREAD_LOCK(comm->c_matching_lock+req_peer);
lam_list_append(comm->c_specific_receives+req_peer, (lam_list_item_t*)req);
THREAD_UNLOCK(comm->c_matching_lock+req->super.req_peer);
return LAM_SUCCESS;
SUPER_DESTROY(request, &mca_pml_base_request_cls);
}
/*
* This routine is used to match a posted receive when the source process
* is specified.
*/
void mca_ptl_base_recv_request_match_specific(mca_ptl_base_recv_request_t* request)
{
lam_communicator_t *comm = request->super.req_communicator;
mca_pml_comm_t* pml_comm = comm->c_pml_comm;
int req_peer = request->super.req_peer;
/* check for a specific match */
if (lam_list_get_size(&pml_comm->c_unexpected_frags[req_peer]) > 0 &&
mca_ptl_base_recv_request_match_specific_proc(request, req_peer)) {
return; /* match found */
}
/* We didn't find any matches. Record this irecv so we can match
* it when the message comes in.
*/
THREAD_LOCK(pml_comm->c_matching_lock+req_peer);
lam_list_append(pml_comm->c_specific_receives+req_peer, (lam_list_item_t*)request);
THREAD_UNLOCK(pml_comm->c_matching_lock+req_peer);
}
int mca_ptl_base_recv_request_match_wild(mca_ptl_base_recv_request_t* req)
/*
* this routine is used to try and match a wild posted receive - where
* wild is determined by the value assigned to the source process
*/
void mca_ptl_base_recv_request_match_wild(mca_ptl_base_recv_request_t* request)
{
mca_pml_comm_t* comm = req->super.req_communicator->c_pml_comm;
/* FIX - need to check for matching fragments */
THREAD_LOCK(&comm->c_wild_lock);
lam_list_append(&comm->c_wild_receives, (lam_list_item_t*)req);
THREAD_UNLOCK(&comm->c_wild_lock);
return LAM_SUCCESS;
lam_communicator_t *comm = request->super.req_communicator;
mca_pml_comm_t* pml_comm = comm->c_pml_comm;
int proc_count = comm->c_remote_group->g_proc_count;
int proc;
/*
* Loop over all the outstanding messages to find one that matches.
* There is an outer loop over lists of messages from each
* process, then an inner loop over the messages from the
* process.
*/
for (proc = 0; proc < proc_count; proc++) {
/* continue if no frags to match */
if (lam_list_get_size(&pml_comm->c_unexpected_frags[proc]) == 0)
continue;
/* loop over messages from the current proc */
if (mca_ptl_base_recv_request_match_specific_proc(request, proc)) {
return; /* match found */
}
}
/* We didn't find any matches. Record this irecv so we can match to
* it when the message comes in.
*/
THREAD_LOCK(&pml_comm->c_wild_lock);
lam_list_append(&pml_comm->c_wild_receives, (lam_list_item_t*)request);
THREAD_UNLOCK(&pml_comm->c_wild_lock);
}
void mca_ptl_base_recv_request_progress(mca_ptl_base_recv_request_t* req, mca_ptl_base_recv_frag_t* frag)
/*
* this routine tries to match a posted receive. If a match is found,
* it places the request in the appropriate matched receive list.
*/
static bool mca_ptl_base_recv_request_match_specific_proc(mca_ptl_base_recv_request_t* request, int proc)
{
mca_pml_comm_t *pml_comm = request->super.req_communicator->c_pml_comm;
lam_list_t* unexpected_frags = pml_comm->c_unexpected_frags+proc;
mca_ptl_base_recv_frag_t* frag;
int tag = request->super.req_tag;
/* lock for thread safety */
THREAD_LOCK(pml_comm->c_matching_lock+proc);
for (frag = (mca_ptl_base_recv_frag_t*)lam_list_get_first(unexpected_frags);
frag != (mca_ptl_base_recv_frag_t*)lam_list_get_end(unexpected_frags);
frag = (mca_ptl_base_recv_frag_t*)lam_list_get_next(frag)) {
/* check first frag - we assume that process matching has been done already */
if (((tag == LAM_ANY_TAG) || (tag == frag->super.frag_header.hdr_user_tag))) {
mca_ptl_t* ptl = frag->super.frag_owner;
if (tag == LAM_ANY_TAG && frag->super.frag_header.hdr_user_tag < 0) {
continue;
}
frag->frag_request = request;
request->req_sequence = frag->super.frag_header.hdr_msg_seq;
request->super.req_tag = tag = frag->super.frag_header.hdr_user_tag;
request->super.req_peer = frag->super.frag_header.hdr_src_rank;
/* notify ptl fragment has been matched - send cts to peer */
THREAD_UNLOCK(pml_comm->c_matching_lock+proc);
ptl->ptl_cts(ptl, frag);
return true;
}
}
THREAD_UNLOCK(pml_comm->c_matching_lock+proc);
return false;
}
void mca_ptl_base_recv_request_progress(
mca_ptl_base_recv_request_t* request,
mca_ptl_base_recv_frag_t* frag)
{
}

Просмотреть файл

@ -18,10 +18,8 @@ typedef struct {
} mca_ptl_base_recv_request_t;
void mca_ptl_base_recv_request_init(mca_ptl_base_recv_request_t*);
void mca_ptl_base_recv_request_destroy(mca_ptl_base_recv_request_t*);
int mca_ptl_base_recv_request_match_wild(mca_ptl_base_recv_request_t*);
int mca_ptl_base_recv_request_match_specific(mca_ptl_base_recv_request_t*);
void mca_ptl_base_recv_request_match_wild(mca_ptl_base_recv_request_t*);
void mca_ptl_base_recv_request_match_specific(mca_ptl_base_recv_request_t*);
void mca_ptl_base_recv_request_progress(mca_ptl_base_recv_request_t*, struct mca_ptl_base_recv_frag_t*);

Просмотреть файл

@ -4,6 +4,10 @@
#include "mca/mpi/ptl/base/ptl_base_sendfrag.h"
static void mca_ptl_base_send_frag_init(mca_ptl_base_send_frag_t* frag);
static void mca_ptl_base_send_frag_destroy(mca_ptl_base_send_frag_t* frag);
lam_class_info_t mca_ptl_base_send_frag_cls = {
"mca_ptl_base_send_frag_t",
&mca_ptl_base_frag_cls,
@ -12,12 +16,12 @@ lam_class_info_t mca_ptl_base_send_frag_cls = {
};
void mca_ptl_base_send_frag_init(mca_ptl_base_send_frag_t* frag)
static void mca_ptl_base_send_frag_init(mca_ptl_base_send_frag_t* frag)
{
SUPER_INIT(frag, &mca_ptl_base_frag_cls);
}
void mca_ptl_base_send_frag_destroy(mca_ptl_base_send_frag_t* frag)
static void mca_ptl_base_send_frag_destroy(mca_ptl_base_send_frag_t* frag)
{
SUPER_DESTROY(frag, &mca_ptl_base_frag_cls);
}

Просмотреть файл

@ -17,8 +17,5 @@ struct mca_ptl_base_send_frag_t {
typedef struct mca_ptl_base_send_frag_t mca_ptl_base_send_frag_t;
void mca_ptl_base_send_frag_init(mca_ptl_base_send_frag_t*);
void mca_ptl_base_send_frag_destroy(mca_ptl_base_send_frag_t*);
#endif

Просмотреть файл

@ -3,6 +3,9 @@
*/
#include "mca/mpi/ptl/base/ptl_base_sendreq.h"
static void mca_ptl_base_send_request_init(mca_ptl_base_send_request_t* req);
static void mca_ptl_base_send_request_destroy(mca_ptl_base_send_request_t* req);
lam_class_info_t mca_ptl_base_send_request_cls = {
"mca_ptl_base_send_request_t",
@ -12,15 +15,15 @@ lam_class_info_t mca_ptl_base_send_request_cls = {
};
void mca_ptl_base_send_request_init(mca_ptl_base_send_request_t* req)
static void mca_ptl_base_send_request_init(mca_ptl_base_send_request_t* req)
{
SUPER_INIT(req, &mca_pml_base_request_cls);
STATIC_INIT(req->req_unacked_frags, &lam_list_cls);
}
void mca_ptl_base_send_request_destroy(mca_ptl_base_send_request_t* req)
static void mca_ptl_base_send_request_destroy(mca_ptl_base_send_request_t* req)
{
lam_list_destroy(&req->req_unacked_frags);
STATIC_DESTROY(req->req_unacked_frags);
SUPER_DESTROY(&req->req_unacked_frags, &mca_pml_base_request_cls);
}

Просмотреть файл

@ -45,10 +45,6 @@ struct mca_ptl_base_send_request_t {
typedef struct mca_ptl_base_send_request_t mca_ptl_base_send_request_t;
void mca_ptl_base_send_request_init(mca_ptl_base_send_request_t*);
void mca_ptl_base_send_request_destroy(mca_ptl_base_send_request_t*);
static inline void mca_ptl_base_send_request_reinit(
mca_ptl_base_send_request_t *request,
void *addr,