1
1

Adapt to the new PML interface.

This commit was SVN r5681.
Этот коммит содержится в:
George Bosilca 2005-05-11 03:59:57 +00:00
родитель 2dbcf1a1e5
Коммит f0adb8b4fd
12 изменённых файлов: 222 добавлений и 176 удалений

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

@ -17,8 +17,8 @@
* @file * @file
*/ */
#ifndef MCA_PML_TEG_H #ifndef MCA_PML_UNIQ_H
#define MCA_PML_TEG_H #define MCA_PML_UNIQ_H
#include "threads/thread.h" #include "threads/thread.h"
#include "threads/condition.h" #include "threads/condition.h"
@ -36,7 +36,7 @@
extern "C" { extern "C" {
#endif #endif
/** /**
* TEG PML module * UNIQ PML module
*/ */
struct mca_pml_uniq_t { struct mca_pml_uniq_t {
@ -217,7 +217,7 @@ extern int mca_pml_uniq_start(
} }
#endif #endif
#define MCA_PML_TEG_FREE(request) \ #define MCA_PML_UNIQ_FREE(request) \
{ \ { \
mca_pml_base_request_t* pml_request = *(mca_pml_base_request_t**)(request); \ mca_pml_base_request_t* pml_request = *(mca_pml_base_request_t**)(request); \
pml_request->req_free_called = true; \ pml_request->req_free_called = true; \
@ -227,18 +227,18 @@ extern int mca_pml_uniq_start(
switch(pml_request->req_type) { \ switch(pml_request->req_type) { \
case MCA_PML_REQUEST_SEND: \ case MCA_PML_REQUEST_SEND: \
{ \ { \
mca_pml_base_send_request_t* sendreq = (mca_pml_base_send_request_t*)pml_request; \ mca_ptl_base_send_request_t* sendreq = (mca_ptl_base_send_request_t*)pml_request; \
while(sendreq->req_lock > 0); \ while(sendreq->req_lock > 0); \
if(sendreq->req_send_mode == MCA_PML_BASE_SEND_BUFFERED) { \ if(sendreq->req_send.req_send_mode == MCA_PML_BASE_SEND_BUFFERED) { \
mca_pml_base_bsend_request_fini((ompi_request_t*)sendreq); \ mca_pml_base_bsend_request_fini((ompi_request_t*)sendreq); \
} \ } \
MCA_PML_TEG_SEND_REQUEST_RETURN(sendreq); \ MCA_PML_UNIQ_SEND_REQUEST_RETURN(sendreq); \
break; \ break; \
} \ } \
case MCA_PML_REQUEST_RECV: \ case MCA_PML_REQUEST_RECV: \
{ \ { \
mca_pml_base_recv_request_t* recvreq = (mca_pml_base_recv_request_t*)pml_request; \ mca_ptl_base_recv_request_t* recvreq = (mca_ptl_base_recv_request_t*)pml_request; \
MCA_PML_TEG_RECV_REQUEST_RETURN(recvreq); \ MCA_PML_UNIQ_RECV_REQUEST_RETURN(recvreq); \
break; \ break; \
} \ } \
default: \ default: \
@ -248,13 +248,13 @@ extern int mca_pml_uniq_start(
*(request) = MPI_REQUEST_NULL; \ *(request) = MPI_REQUEST_NULL; \
} }
#define MCA_PML_TEG_FINI(request) \ #define MCA_PML_UNIQ_FINI(request) \
{ \ { \
mca_pml_base_request_t* pml_request = *(mca_pml_base_request_t**)(request); \ mca_pml_base_request_t* pml_request = *(mca_pml_base_request_t**)(request); \
if( (pml_request->req_persistent) && !(pml_request->req_free_called) ) { \ if( (pml_request->req_persistent) && !(pml_request->req_free_called) ) { \
pml_request->req_ompi.req_state = OMPI_REQUEST_INACTIVE; \ pml_request->req_ompi.req_state = OMPI_REQUEST_INACTIVE; \
} else { \ } else { \
MCA_PML_TEG_FREE(request); \ MCA_PML_UNIQ_FREE(request); \
} \ } \
} }

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

@ -15,8 +15,8 @@
* @file * @file
*/ */
#ifndef MCA_PML_TEG_COMPONENT_H #ifndef MCA_PML_UNIQ_COMPONENT_H
#define MCA_PML_TEG_COMPONENT_H #define MCA_PML_UNIQ_COMPONENT_H
/* /*
* PML module functions. * PML module functions.

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

@ -25,18 +25,18 @@ int mca_pml_uniq_iprobe(int src,
int *matched, ompi_status_public_t * status) int *matched, ompi_status_public_t * status)
{ {
int rc; int rc;
mca_pml_base_recv_request_t recvreq; mca_ptl_base_recv_request_t recvreq;
OBJ_CONSTRUCT( &(recvreq), mca_pml_base_recv_request_t ); OBJ_CONSTRUCT( &(recvreq), mca_ptl_base_recv_request_t );
recvreq.req_base.req_ompi.req_type = OMPI_REQUEST_PML; recvreq.req_recv.req_base.req_ompi.req_type = OMPI_REQUEST_PML;
recvreq.req_base.req_type = MCA_PML_REQUEST_IPROBE; recvreq.req_recv.req_base.req_type = MCA_PML_REQUEST_IPROBE;
MCA_PML_BASE_RECV_REQUEST_INIT(&recvreq, NULL, 0, &ompi_mpi_char, src, tag, comm, true); MCA_PML_UNIQ_RECV_REQUEST_INIT(&recvreq, NULL, 0, &ompi_mpi_char, src, tag, comm, true);
*matched = 0; *matched = 0;
if ((rc = mca_pml_uniq_recv_request_start(&recvreq)) == OMPI_SUCCESS) { if ((rc = mca_pml_uniq_recv_request_start(&recvreq)) == OMPI_SUCCESS) {
if( recvreq.req_base.req_ompi.req_complete == true ) { if( recvreq.req_recv.req_base.req_ompi.req_complete == true ) {
if( NULL != status ) { if( NULL != status ) {
*status = recvreq.req_base.req_ompi.req_status; *status = recvreq.req_recv.req_base.req_ompi.req_status;
} }
*matched = 1; *matched = 1;
} else { } else {
@ -44,7 +44,7 @@ int mca_pml_uniq_iprobe(int src,
ompi_progress(); ompi_progress();
} }
} }
MCA_PML_BASE_RECV_REQUEST_RETURN( &recvreq ); MCA_PML_UNIQ_RECV_REQUEST_RETURN( &recvreq );
return rc; return rc;
} }
@ -55,39 +55,39 @@ int mca_pml_uniq_probe(int src,
ompi_status_public_t * status) ompi_status_public_t * status)
{ {
int rc; int rc;
mca_pml_base_recv_request_t recvreq; mca_ptl_base_recv_request_t recvreq;
OBJ_CONSTRUCT( &(recvreq), mca_pml_base_recv_request_t ); OBJ_CONSTRUCT( &(recvreq), mca_ptl_base_recv_request_t );
recvreq.req_base.req_ompi.req_type = OMPI_REQUEST_PML; recvreq.req_recv.req_base.req_ompi.req_type = OMPI_REQUEST_PML;
recvreq.req_base.req_type = MCA_PML_REQUEST_PROBE; recvreq.req_recv.req_base.req_type = MCA_PML_REQUEST_PROBE;
MCA_PML_BASE_RECV_REQUEST_INIT(&recvreq, NULL, 0, &ompi_mpi_char, src, tag, comm, true); MCA_PML_UNIQ_RECV_REQUEST_INIT(&recvreq, NULL, 0, &ompi_mpi_char, src, tag, comm, true);
if ((rc = mca_pml_uniq_recv_request_start(&recvreq)) != OMPI_SUCCESS) { if ((rc = mca_pml_uniq_recv_request_start(&recvreq)) != OMPI_SUCCESS) {
MCA_PML_BASE_RECV_REQUEST_RETURN( &recvreq ); MCA_PML_UNIQ_RECV_REQUEST_RETURN( &recvreq );
return rc; return rc;
} }
if (recvreq.req_base.req_ompi.req_complete == false) { if (recvreq.req_recv.req_base.req_ompi.req_complete == false) {
/* give up and sleep until completion */ /* give up and sleep until completion */
if (ompi_using_threads()) { if (ompi_using_threads()) {
ompi_mutex_lock(&ompi_request_lock); ompi_mutex_lock(&ompi_request_lock);
ompi_request_waiting++; ompi_request_waiting++;
while (recvreq.req_base.req_ompi.req_complete == false) while (recvreq.req_recv.req_base.req_ompi.req_complete == false)
ompi_condition_wait(&ompi_request_cond, &ompi_request_lock); ompi_condition_wait(&ompi_request_cond, &ompi_request_lock);
ompi_request_waiting--; ompi_request_waiting--;
ompi_mutex_unlock(&ompi_request_lock); ompi_mutex_unlock(&ompi_request_lock);
} else { } else {
ompi_request_waiting++; ompi_request_waiting++;
while (recvreq.req_base.req_ompi.req_complete == false) while (recvreq.req_recv.req_base.req_ompi.req_complete == false)
ompi_condition_wait(&ompi_request_cond, &ompi_request_lock); ompi_condition_wait(&ompi_request_cond, &ompi_request_lock);
ompi_request_waiting--; ompi_request_waiting--;
} }
} }
if (NULL != status) { if (NULL != status) {
*status = recvreq.req_base.req_ompi.req_status; *status = recvreq.req_recv.req_base.req_ompi.req_status;
} }
MCA_PML_BASE_RECV_REQUEST_RETURN( &recvreq ); MCA_PML_UNIQ_RECV_REQUEST_RETURN( &recvreq );
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }

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

@ -28,12 +28,12 @@ int mca_pml_uniq_irecv_init(void *addr,
struct ompi_request_t **request) struct ompi_request_t **request)
{ {
int rc; int rc;
mca_pml_base_recv_request_t *recvreq; mca_ptl_base_recv_request_t *recvreq;
MCA_PML_TEG_RECV_REQUEST_ALLOC(recvreq, rc); MCA_PML_UNIQ_RECV_REQUEST_ALLOC(recvreq, rc);
if (NULL == recvreq) if (NULL == recvreq)
return rc; return rc;
MCA_PML_BASE_RECV_REQUEST_INIT(recvreq, MCA_PML_UNIQ_RECV_REQUEST_INIT(recvreq,
addr, addr,
count, datatype, src, tag, comm, true); count, datatype, src, tag, comm, true);
@ -51,17 +51,17 @@ int mca_pml_uniq_irecv(void *addr,
{ {
int rc; int rc;
mca_pml_base_recv_request_t *recvreq; mca_ptl_base_recv_request_t *recvreq;
MCA_PML_TEG_RECV_REQUEST_ALLOC(recvreq, rc); MCA_PML_UNIQ_RECV_REQUEST_ALLOC(recvreq, rc);
if (NULL == recvreq) if (NULL == recvreq)
return rc; return rc;
MCA_PML_BASE_RECV_REQUEST_INIT(recvreq, MCA_PML_UNIQ_RECV_REQUEST_INIT(recvreq,
addr, addr,
count, datatype, src, tag, comm, false); count, datatype, src, tag, comm, false);
if ((rc = mca_pml_uniq_recv_request_start(recvreq)) != OMPI_SUCCESS) { if ((rc = mca_pml_uniq_recv_request_start(recvreq)) != OMPI_SUCCESS) {
MCA_PML_TEG_RECV_REQUEST_RETURN(recvreq); MCA_PML_UNIQ_RECV_REQUEST_RETURN(recvreq);
return rc; return rc;
} }
*request = (ompi_request_t *) recvreq; *request = (ompi_request_t *) recvreq;
@ -78,12 +78,12 @@ int mca_pml_uniq_recv(void *addr,
ompi_status_public_t * status) ompi_status_public_t * status)
{ {
int rc; int rc;
mca_pml_base_recv_request_t *recvreq; mca_ptl_base_recv_request_t *recvreq;
MCA_PML_TEG_RECV_REQUEST_ALLOC(recvreq, rc); MCA_PML_UNIQ_RECV_REQUEST_ALLOC(recvreq, rc);
if (NULL == recvreq) if (NULL == recvreq)
return rc; return rc;
MCA_PML_BASE_RECV_REQUEST_INIT(recvreq, MCA_PML_UNIQ_RECV_REQUEST_INIT(recvreq,
addr, addr,
count, datatype, src, tag, comm, false); count, datatype, src, tag, comm, false);
@ -91,27 +91,27 @@ int mca_pml_uniq_recv(void *addr,
goto recv_finish; goto recv_finish;
} }
if (recvreq->req_base.req_ompi.req_complete == false) { if (recvreq->req_recv.req_base.req_ompi.req_complete == false) {
/* give up and sleep until completion */ /* give up and sleep until completion */
if (ompi_using_threads()) { if (ompi_using_threads()) {
ompi_mutex_lock(&ompi_request_lock); ompi_mutex_lock(&ompi_request_lock);
ompi_request_waiting++; ompi_request_waiting++;
while (recvreq->req_base.req_ompi.req_complete == false) while (recvreq->req_recv.req_base.req_ompi.req_complete == false)
ompi_condition_wait(&ompi_request_cond, &ompi_request_lock); ompi_condition_wait(&ompi_request_cond, &ompi_request_lock);
ompi_request_waiting--; ompi_request_waiting--;
ompi_mutex_unlock(&ompi_request_lock); ompi_mutex_unlock(&ompi_request_lock);
} else { } else {
ompi_request_waiting++; ompi_request_waiting++;
while (recvreq->req_base.req_ompi.req_complete == false) while (recvreq->req_recv.req_base.req_ompi.req_complete == false)
ompi_condition_wait(&ompi_request_cond, &ompi_request_lock); ompi_condition_wait(&ompi_request_cond, &ompi_request_lock);
ompi_request_waiting--; ompi_request_waiting--;
} }
} }
recv_finish: recv_finish:
if (NULL != status) { /* return status */ if (NULL != status) { /* return status */
*status = recvreq->req_base.req_ompi.req_status; *status = recvreq->req_recv.req_base.req_ompi.req_status;
} }
MCA_PML_TEG_RECV_REQUEST_RETURN(recvreq); MCA_PML_UNIQ_RECV_REQUEST_RETURN(recvreq);
return recvreq->req_base.req_ompi.req_status.MPI_ERROR; return recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR;
} }

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

@ -33,12 +33,12 @@ int mca_pml_uniq_isend_init(void *buf,
{ {
int rc; int rc;
mca_pml_base_send_request_t *sendreq; mca_ptl_base_send_request_t *sendreq;
MCA_PML_TEG_SEND_REQUEST_ALLOC(comm, dst, sendreq, rc); MCA_PML_UNIQ_SEND_REQUEST_ALLOC(comm, dst, sendreq, rc);
if (rc != OMPI_SUCCESS) if (rc != OMPI_SUCCESS)
return rc; return rc;
MCA_PML_BASE_SEND_REQUEST_INIT(sendreq, MCA_PML_UNIQ_SEND_REQUEST_INIT(sendreq,
buf, buf,
count, count,
datatype, datatype,
@ -60,18 +60,18 @@ int mca_pml_uniq_isend(void *buf,
ompi_request_t ** request) ompi_request_t ** request)
{ {
int rc; int rc;
mca_pml_base_send_request_t *sendreq; mca_ptl_base_send_request_t *sendreq;
MCA_PML_TEG_SEND_REQUEST_ALLOC(comm, dst, sendreq, rc); MCA_PML_UNIQ_SEND_REQUEST_ALLOC(comm, dst, sendreq, rc);
if (rc != OMPI_SUCCESS) if (rc != OMPI_SUCCESS)
return rc; return rc;
MCA_PML_BASE_SEND_REQUEST_INIT(sendreq, MCA_PML_UNIQ_SEND_REQUEST_INIT(sendreq,
buf, buf,
count, count,
datatype, datatype,
dst, tag, dst, tag,
comm, sendmode, false); comm, sendmode, false);
MCA_PML_TEG_SEND_REQUEST_START(sendreq, rc); MCA_PML_UNIQ_SEND_REQUEST_START(sendreq, rc);
*request = (ompi_request_t *) sendreq; *request = (ompi_request_t *) sendreq;
return rc; return rc;
} }
@ -86,43 +86,43 @@ int mca_pml_uniq_send(void *buf,
ompi_communicator_t * comm) ompi_communicator_t * comm)
{ {
int rc; int rc;
mca_pml_base_send_request_t *sendreq; mca_ptl_base_send_request_t *sendreq;
MCA_PML_TEG_SEND_REQUEST_ALLOC(comm, dst, sendreq, rc); MCA_PML_UNIQ_SEND_REQUEST_ALLOC(comm, dst, sendreq, rc);
if (rc != OMPI_SUCCESS) if (rc != OMPI_SUCCESS)
return rc; return rc;
MCA_PML_BASE_SEND_REQUEST_INIT(sendreq, MCA_PML_UNIQ_SEND_REQUEST_INIT(sendreq,
buf, buf,
count, count,
datatype, datatype,
dst, tag, dst, tag,
comm, sendmode, false); comm, sendmode, false);
MCA_PML_TEG_SEND_REQUEST_START(sendreq, rc); MCA_PML_UNIQ_SEND_REQUEST_START(sendreq, rc);
if (rc != OMPI_SUCCESS) { if (rc != OMPI_SUCCESS) {
MCA_PML_TEG_FREE((ompi_request_t **) & sendreq); MCA_PML_UNIQ_FREE((ompi_request_t **) & sendreq);
return rc; return rc;
} }
if (sendreq->req_base.req_ompi.req_complete == false) { if (sendreq->req_send.req_base.req_ompi.req_complete == false) {
/* give up and sleep until completion */ /* give up and sleep until completion */
if (ompi_using_threads()) { if (ompi_using_threads()) {
ompi_mutex_lock(&ompi_request_lock); ompi_mutex_lock(&ompi_request_lock);
ompi_request_waiting++; ompi_request_waiting++;
while (sendreq->req_base.req_ompi.req_complete == false) while (sendreq->req_send.req_base.req_ompi.req_complete == false)
ompi_condition_wait(&ompi_request_cond, &ompi_request_lock); ompi_condition_wait(&ompi_request_cond, &ompi_request_lock);
ompi_request_waiting--; ompi_request_waiting--;
ompi_mutex_unlock(&ompi_request_lock); ompi_mutex_unlock(&ompi_request_lock);
} else { } else {
ompi_request_waiting++; ompi_request_waiting++;
while (sendreq->req_base.req_ompi.req_complete == false) while (sendreq->req_send.req_base.req_ompi.req_complete == false)
ompi_condition_wait(&ompi_request_cond, &ompi_request_lock); ompi_condition_wait(&ompi_request_cond, &ompi_request_lock);
ompi_request_waiting--; ompi_request_waiting--;
} }
} }
/* return request to pool */ /* return request to pool */
MCA_PML_TEG_FREE((ompi_request_t **) & sendreq); MCA_PML_UNIQ_FREE((ompi_request_t **) & sendreq);
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }

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

@ -50,20 +50,20 @@ bool mca_pml_uniq_recv_frag_match(
while(NULL != frag) { while(NULL != frag) {
mca_ptl_base_module_t* ptl = frag->frag_base.frag_owner; mca_ptl_base_module_t* ptl = frag->frag_base.frag_owner;
mca_pml_base_recv_request_t *request = frag->frag_request; mca_ptl_base_recv_request_t *request = frag->frag_request;
mca_ptl_base_match_header_t *header = &frag->frag_base.frag_header.hdr_match; mca_ptl_base_match_header_t *header = &frag->frag_base.frag_header.hdr_match;
/* /*
* Initialize request status. * Initialize request status.
*/ */
request->req_bytes_packed = header->hdr_msg_length; request->req_recv.req_bytes_packed = header->hdr_msg_length;
request->req_base.req_ompi.req_status.MPI_SOURCE = header->hdr_src; request->req_recv.req_base.req_ompi.req_status.MPI_SOURCE = header->hdr_src;
request->req_base.req_ompi.req_status.MPI_TAG = header->hdr_tag; request->req_recv.req_base.req_ompi.req_status.MPI_TAG = header->hdr_tag;
/* /*
* If probe - signal request is complete - but don't notify PTL * If probe - signal request is complete - but don't notify PTL
*/ */
if(request->req_base.req_type == MCA_PML_REQUEST_PROBE) { if(request->req_recv.req_base.req_type == MCA_PML_REQUEST_PROBE) {
ptl->ptl_recv_progress( ptl, ptl->ptl_recv_progress( ptl,
request, request,
@ -75,7 +75,7 @@ bool mca_pml_uniq_recv_frag_match(
/* if required - setup pointer to ptls peer */ /* if required - setup pointer to ptls peer */
if (NULL == frag->frag_base.frag_peer) { if (NULL == frag->frag_base.frag_peer) {
frag->frag_base.frag_peer = mca_pml_uniq_proc_lookup_remote_peer(request->req_base.req_comm,header->hdr_src,ptl); frag->frag_base.frag_peer = mca_pml_uniq_proc_lookup_remote_peer(request->req_recv.req_base.req_comm,header->hdr_src,ptl);
} }
/* notify ptl of match */ /* notify ptl of match */

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

@ -17,8 +17,8 @@
* @file * @file
*/ */
#ifndef MCA_PML_TEG_RECVFRAG_H #ifndef MCA_PML_UNIQ_RECVFRAG_H
#define MCA_PML_TEG_RECVFRAG_H #define MCA_PML_UNIQ_RECVFRAG_H
#include "mca/ptl/ptl.h" #include "mca/ptl/ptl.h"
#include "mca/pml/base/pml_base_recvreq.h" #include "mca/pml/base/pml_base_recvreq.h"

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

@ -24,18 +24,18 @@
static mca_ptl_base_recv_frag_t* mca_pml_uniq_recv_request_match_specific_proc( static mca_ptl_base_recv_frag_t* mca_pml_uniq_recv_request_match_specific_proc(
mca_pml_base_recv_request_t* request, int proc); mca_ptl_base_recv_request_t* request, int proc);
static int mca_pml_uniq_recv_request_fini(struct ompi_request_t** request) static int mca_pml_uniq_recv_request_fini(struct ompi_request_t** request)
{ {
MCA_PML_TEG_FINI(request); MCA_PML_UNIQ_FINI(request);
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
static int mca_pml_uniq_recv_request_free(struct ompi_request_t** request) static int mca_pml_uniq_recv_request_free(struct ompi_request_t** request)
{ {
MCA_PML_TEG_FREE(request); MCA_PML_UNIQ_FREE(request);
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
@ -105,18 +105,18 @@ OBJ_CLASS_INSTANCE(
void mca_pml_uniq_recv_request_progress( void mca_pml_uniq_recv_request_progress(
struct mca_ptl_base_module_t* ptl, struct mca_ptl_base_module_t* ptl,
mca_pml_base_recv_request_t* req, mca_ptl_base_recv_request_t* req,
size_t bytes_received, size_t bytes_received,
size_t bytes_delivered) size_t bytes_delivered)
{ {
OMPI_THREAD_LOCK(&ompi_request_lock); OMPI_THREAD_LOCK(&ompi_request_lock);
req->req_bytes_received += bytes_received; req->req_bytes_received += bytes_received;
req->req_bytes_delivered += bytes_delivered; req->req_bytes_delivered += bytes_delivered;
if (req->req_bytes_received >= req->req_bytes_packed) { if (req->req_bytes_received >= req->req_recv.req_bytes_packed) {
/* initialize request status */ /* initialize request status */
req->req_base.req_ompi.req_status._count = req->req_bytes_delivered; req->req_recv.req_base.req_ompi.req_status._count = req->req_bytes_delivered;
req->req_base.req_pml_complete = true; req->req_recv.req_base.req_pml_complete = true;
req->req_base.req_ompi.req_complete = true; req->req_recv.req_base.req_ompi.req_complete = true;
if(ompi_request_waiting) { if(ompi_request_waiting) {
ompi_condition_broadcast(&ompi_request_cond); ompi_condition_broadcast(&ompi_request_cond);
} }
@ -131,18 +131,18 @@ void mca_pml_uniq_recv_request_progress(
* is specified. * is specified.
*/ */
void mca_pml_uniq_recv_request_match_specific(mca_pml_base_recv_request_t* request) void mca_pml_uniq_recv_request_match_specific(mca_ptl_base_recv_request_t* request)
{ {
ompi_communicator_t *comm = request->req_base.req_comm; ompi_communicator_t *comm = request->req_recv.req_base.req_comm;
mca_pml_ptl_comm_t* pml_comm = comm->c_pml_comm; mca_pml_ptl_comm_t* pml_comm = comm->c_pml_comm;
int req_peer = request->req_base.req_peer; int req_peer = request->req_recv.req_base.req_peer;
mca_ptl_base_recv_frag_t* frag; mca_ptl_base_recv_frag_t* frag;
/* check for a specific match */ /* check for a specific match */
OMPI_THREAD_LOCK(&pml_comm->c_matching_lock); OMPI_THREAD_LOCK(&pml_comm->c_matching_lock);
/* assign sequence number */ /* assign sequence number */
request->req_base.req_sequence = pml_comm->c_recv_seq++; request->req_recv.req_base.req_sequence = pml_comm->c_recv_seq++;
if (ompi_list_get_size(&pml_comm->c_unexpected_frags[req_peer]) > 0 && if (ompi_list_get_size(&pml_comm->c_unexpected_frags[req_peer]) > 0 &&
(frag = mca_pml_uniq_recv_request_match_specific_proc(request, req_peer)) != NULL) { (frag = mca_pml_uniq_recv_request_match_specific_proc(request, req_peer)) != NULL) {
@ -151,8 +151,8 @@ void mca_pml_uniq_recv_request_match_specific(mca_pml_base_recv_request_t* reque
if(NULL == frag->frag_base.frag_peer) if(NULL == frag->frag_base.frag_peer)
frag->frag_base.frag_peer = mca_pml_uniq_proc_lookup_remote_peer(comm,req_peer,ptl); frag->frag_base.frag_peer = mca_pml_uniq_proc_lookup_remote_peer(comm,req_peer,ptl);
OMPI_THREAD_UNLOCK(&pml_comm->c_matching_lock); OMPI_THREAD_UNLOCK(&pml_comm->c_matching_lock);
if( !((MCA_PML_REQUEST_IPROBE == request->req_base.req_type) || if( !((MCA_PML_REQUEST_IPROBE == request->req_recv.req_base.req_type) ||
(MCA_PML_REQUEST_PROBE == request->req_base.req_type)) ) { (MCA_PML_REQUEST_PROBE == request->req_recv.req_base.req_type)) ) {
ptl->ptl_matched(ptl, frag); ptl->ptl_matched(ptl, frag);
} }
return; /* match found */ return; /* match found */
@ -161,7 +161,7 @@ void mca_pml_uniq_recv_request_match_specific(mca_pml_base_recv_request_t* reque
/* We didn't find any matches. Record this irecv so we can match /* We didn't find any matches. Record this irecv so we can match
* it when the message comes in. * it when the message comes in.
*/ */
if(request->req_base.req_type != MCA_PML_REQUEST_IPROBE) { if(request->req_recv.req_base.req_type != MCA_PML_REQUEST_IPROBE) {
ompi_list_append(pml_comm->c_specific_receives+req_peer, (ompi_list_item_t*)request); ompi_list_append(pml_comm->c_specific_receives+req_peer, (ompi_list_item_t*)request);
} }
OMPI_THREAD_UNLOCK(&pml_comm->c_matching_lock); OMPI_THREAD_UNLOCK(&pml_comm->c_matching_lock);
@ -173,9 +173,9 @@ void mca_pml_uniq_recv_request_match_specific(mca_pml_base_recv_request_t* reque
* wild is determined by the value assigned to the source process * wild is determined by the value assigned to the source process
*/ */
void mca_pml_uniq_recv_request_match_wild(mca_pml_base_recv_request_t* request) void mca_pml_uniq_recv_request_match_wild(mca_ptl_base_recv_request_t* request)
{ {
ompi_communicator_t *comm = request->req_base.req_comm; ompi_communicator_t *comm = request->req_recv.req_base.req_comm;
mca_pml_ptl_comm_t* pml_comm = comm->c_pml_comm; mca_pml_ptl_comm_t* pml_comm = comm->c_pml_comm;
int proc_count = comm->c_remote_group->grp_proc_count; int proc_count = comm->c_remote_group->grp_proc_count;
int proc; int proc;
@ -189,7 +189,7 @@ void mca_pml_uniq_recv_request_match_wild(mca_pml_base_recv_request_t* request)
OMPI_THREAD_LOCK(&pml_comm->c_matching_lock); OMPI_THREAD_LOCK(&pml_comm->c_matching_lock);
/* assign sequence number */ /* assign sequence number */
request->req_base.req_sequence = pml_comm->c_recv_seq++; request->req_recv.req_base.req_sequence = pml_comm->c_recv_seq++;
for (proc = 0; proc < proc_count; proc++) { for (proc = 0; proc < proc_count; proc++) {
mca_ptl_base_recv_frag_t* frag; mca_ptl_base_recv_frag_t* frag;
@ -205,8 +205,8 @@ void mca_pml_uniq_recv_request_match_wild(mca_pml_base_recv_request_t* request)
if(NULL == frag->frag_base.frag_peer) if(NULL == frag->frag_base.frag_peer)
frag->frag_base.frag_peer = mca_pml_uniq_proc_lookup_remote_peer(comm,proc,ptl); frag->frag_base.frag_peer = mca_pml_uniq_proc_lookup_remote_peer(comm,proc,ptl);
OMPI_THREAD_UNLOCK(&pml_comm->c_matching_lock); OMPI_THREAD_UNLOCK(&pml_comm->c_matching_lock);
if( !((MCA_PML_REQUEST_IPROBE == request->req_base.req_type) || if( !((MCA_PML_REQUEST_IPROBE == request->req_recv.req_base.req_type) ||
(MCA_PML_REQUEST_PROBE == request->req_base.req_type)) ) { (MCA_PML_REQUEST_PROBE == request->req_recv.req_base.req_type)) ) {
ptl->ptl_matched(ptl, frag); ptl->ptl_matched(ptl, frag);
} }
return; /* match found */ return; /* match found */
@ -217,7 +217,7 @@ void mca_pml_uniq_recv_request_match_wild(mca_pml_base_recv_request_t* request)
* it when the message comes in. * it when the message comes in.
*/ */
if(request->req_base.req_type != MCA_PML_REQUEST_IPROBE) if(request->req_recv.req_base.req_type != MCA_PML_REQUEST_IPROBE)
ompi_list_append(&pml_comm->c_wild_receives, (ompi_list_item_t*)request); ompi_list_append(&pml_comm->c_wild_receives, (ompi_list_item_t*)request);
OMPI_THREAD_UNLOCK(&pml_comm->c_matching_lock); OMPI_THREAD_UNLOCK(&pml_comm->c_matching_lock);
} }
@ -229,13 +229,13 @@ void mca_pml_uniq_recv_request_match_wild(mca_pml_base_recv_request_t* request)
*/ */
static mca_ptl_base_recv_frag_t* mca_pml_uniq_recv_request_match_specific_proc( static mca_ptl_base_recv_frag_t* mca_pml_uniq_recv_request_match_specific_proc(
mca_pml_base_recv_request_t* request, int proc) mca_ptl_base_recv_request_t* request, int proc)
{ {
mca_pml_ptl_comm_t *pml_comm = request->req_base.req_comm->c_pml_comm; mca_pml_ptl_comm_t *pml_comm = request->req_recv.req_base.req_comm->c_pml_comm;
ompi_list_t* unexpected_frags = pml_comm->c_unexpected_frags+proc; ompi_list_t* unexpected_frags = pml_comm->c_unexpected_frags+proc;
mca_ptl_base_recv_frag_t* frag; mca_ptl_base_recv_frag_t* frag;
mca_ptl_base_match_header_t* header; mca_ptl_base_match_header_t* header;
int tag = request->req_base.req_tag; int tag = request->req_recv.req_base.req_tag;
if( OMPI_ANY_TAG == tag ) { if( OMPI_ANY_TAG == tag ) {
for (frag = (mca_ptl_base_recv_frag_t*)ompi_list_get_first(unexpected_frags); for (frag = (mca_ptl_base_recv_frag_t*)ompi_list_get_first(unexpected_frags);
@ -263,12 +263,12 @@ static mca_ptl_base_recv_frag_t* mca_pml_uniq_recv_request_match_specific_proc(
} }
return NULL; return NULL;
find_fragment: find_fragment:
request->req_bytes_packed = header->hdr_msg_length; request->req_recv.req_bytes_packed = header->hdr_msg_length;
request->req_base.req_ompi.req_status.MPI_TAG = header->hdr_tag; request->req_recv.req_base.req_ompi.req_status.MPI_TAG = header->hdr_tag;
request->req_base.req_ompi.req_status.MPI_SOURCE = header->hdr_src; request->req_recv.req_base.req_ompi.req_status.MPI_SOURCE = header->hdr_src;
if( !((MCA_PML_REQUEST_IPROBE == request->req_base.req_type) || if( !((MCA_PML_REQUEST_IPROBE == request->req_recv.req_base.req_type) ||
(MCA_PML_REQUEST_PROBE == request->req_base.req_type)) ) { (MCA_PML_REQUEST_PROBE == request->req_recv.req_base.req_type)) ) {
ompi_list_remove_item(unexpected_frags, (ompi_list_item_t*)frag); ompi_list_remove_item(unexpected_frags, (ompi_list_item_t*)frag);
frag->frag_request = request; frag->frag_request = request;
} else { } else {

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

@ -16,12 +16,12 @@
/** /**
* @file * @file
*/ */
#ifndef OMPI_PML_TEG_RECV_REQUEST_H #ifndef OMPI_PML_UNIQ_RECV_REQUEST_H
#define OMPI_PML_TEG_RECV_REQUEST_H #define OMPI_PML_UNIQ_RECV_REQUEST_H
#include "pml_uniq.h" #include "pml_uniq.h"
#include "pml_uniq_proc.h" #include "pml_uniq_proc.h"
#include "mca/pml/base/pml_base_recvreq.h" #include "mca/ptl/base/ptl_base_recvreq.h"
#include "mca/ptl/base/ptl_base_recvfrag.h" #include "mca/ptl/base/ptl_base_recvfrag.h"
#if defined(c_plusplus) || defined(__cplusplus) #if defined(c_plusplus) || defined(__cplusplus)
@ -38,22 +38,47 @@ OBJ_CLASS_DECLARATION(mca_pml_uniq_recv_request_t);
* @param rc (OUT) OMPI_SUCCESS or error status on failure. * @param rc (OUT) OMPI_SUCCESS or error status on failure.
* @return Receive request. * @return Receive request.
*/ */
#define MCA_PML_TEG_RECV_REQUEST_ALLOC(recvreq, rc) \ #define MCA_PML_UNIQ_RECV_REQUEST_ALLOC(recvreq, rc) \
do { \ do { \
ompi_list_item_t* item; \ ompi_list_item_t* item; \
OMPI_FREE_LIST_GET(&mca_pml_uniq.uniq_recv_requests, item, rc); \ OMPI_FREE_LIST_GET(&mca_pml_uniq.uniq_recv_requests, item, rc); \
recvreq = (mca_pml_base_recv_request_t*)item; \ recvreq = (mca_ptl_base_recv_request_t*)item; \
} while(0) } while(0)
/**
* Initialize a recv request.
*/
#define MCA_PML_UNIQ_RECV_REQUEST_INIT( \
request, \
addr, \
count, \
datatype, \
src, \
tag, \
comm, \
persistent) \
{ \
MCA_PML_BASE_RECV_REQUEST_INIT( \
(&(request)->req_recv), \
addr, \
count, \
datatype, \
src, \
tag, \
comm, \
persistent \
); \
}
/** /**
* Return a recv request to the modules free list. * Return a recv request to the modules free list.
* *
* @param request (IN) Receive request. * @param request (IN) Receive request.
*/ */
#define MCA_PML_TEG_RECV_REQUEST_RETURN(request) \ #define MCA_PML_UNIQ_RECV_REQUEST_RETURN(request) \
do { \ do { \
MCA_PML_BASE_RECV_REQUEST_RETURN( request ); \ MCA_PML_BASE_RECV_REQUEST_RETURN( &((request)->req_recv) ); \
OMPI_FREE_LIST_RETURN(&mca_pml_uniq.uniq_recv_requests, (ompi_list_item_t*)request); \ OMPI_FREE_LIST_RETURN(&mca_pml_uniq.uniq_recv_requests, (ompi_list_item_t*)(request)); \
} while(0) } while(0)
/** /**
@ -62,7 +87,7 @@ OBJ_CLASS_DECLARATION(mca_pml_uniq_recv_request_t);
* *
* @param request (IN) Request to match. * @param request (IN) Request to match.
*/ */
void mca_pml_uniq_recv_request_match_wild(mca_pml_base_recv_request_t* request); void mca_pml_uniq_recv_request_match_wild(mca_ptl_base_recv_request_t* request);
/** /**
* Attempt to match the request against the unexpected fragment list * Attempt to match the request against the unexpected fragment list
@ -70,7 +95,7 @@ void mca_pml_uniq_recv_request_match_wild(mca_pml_base_recv_request_t* request);
* *
* @param request (IN) Request to match. * @param request (IN) Request to match.
*/ */
void mca_pml_uniq_recv_request_match_specific(mca_pml_base_recv_request_t* request); void mca_pml_uniq_recv_request_match_specific(mca_ptl_base_recv_request_t* request);
/** /**
* Start an initialized request. * Start an initialized request.
@ -78,23 +103,23 @@ void mca_pml_uniq_recv_request_match_specific(mca_pml_base_recv_request_t* reque
* @param request Receive request. * @param request Receive request.
* @return OMPI_SUCESS or error status on failure. * @return OMPI_SUCESS or error status on failure.
*/ */
static inline int mca_pml_uniq_recv_request_start(mca_pml_base_recv_request_t* request) static inline int mca_pml_uniq_recv_request_start(mca_ptl_base_recv_request_t* request)
{ {
/* init/re-init the request */ /* init/re-init the request */
request->req_bytes_received = 0; request->req_bytes_received = 0;
request->req_bytes_delivered = 0; request->req_bytes_delivered = 0;
request->req_base.req_pml_complete = false; request->req_recv.req_base.req_pml_complete = false;
request->req_base.req_ompi.req_complete = false; request->req_recv.req_base.req_ompi.req_complete = false;
request->req_base.req_ompi.req_state = OMPI_REQUEST_ACTIVE; request->req_recv.req_base.req_ompi.req_state = OMPI_REQUEST_ACTIVE;
/* always set the req_status.MPI_TAG to ANY_TAG before starting the request. This field /* always set the req_status.MPI_TAG to ANY_TAG before starting the request. This field
* is used on the cancel part in order to find out if the request has been matched or not. * is used on the cancel part in order to find out if the request has been matched or not.
*/ */
request->req_base.req_ompi.req_status.MPI_TAG = OMPI_ANY_TAG; request->req_recv.req_base.req_ompi.req_status.MPI_TAG = OMPI_ANY_TAG;
request->req_base.req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS; request->req_recv.req_base.req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS;
request->req_base.req_ompi.req_status._cancelled = 0; request->req_recv.req_base.req_ompi.req_status._cancelled = 0;
/* attempt to match posted recv */ /* attempt to match posted recv */
if(request->req_base.req_peer == OMPI_ANY_SOURCE) { if(request->req_recv.req_base.req_peer == OMPI_ANY_SOURCE) {
mca_pml_uniq_recv_request_match_wild(request); mca_pml_uniq_recv_request_match_wild(request);
} else { } else {
mca_pml_uniq_recv_request_match_specific(request); mca_pml_uniq_recv_request_match_specific(request);
@ -113,7 +138,7 @@ static inline int mca_pml_uniq_recv_request_start(mca_pml_base_recv_request_t* r
*/ */
void mca_pml_uniq_recv_request_progress( void mca_pml_uniq_recv_request_progress(
struct mca_ptl_base_module_t* ptl, struct mca_ptl_base_module_t* ptl,
mca_pml_base_recv_request_t* request, mca_ptl_base_recv_request_t* request,
size_t bytes_received, size_t bytes_received,
size_t bytes_delivered size_t bytes_delivered
); );
@ -121,5 +146,5 @@ void mca_pml_uniq_recv_request_progress(
#if defined(c_plusplus) || defined(__cplusplus) #if defined(c_plusplus) || defined(__cplusplus)
} }
#endif #endif
#endif #endif /* OMPI_PML_UNIQ_RECV_REQUEST_H */

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

@ -30,13 +30,13 @@
static int mca_pml_uniq_send_request_fini(struct ompi_request_t** request) static int mca_pml_uniq_send_request_fini(struct ompi_request_t** request)
{ {
MCA_PML_TEG_FINI(request); MCA_PML_UNIQ_FINI(request);
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
static int mca_pml_uniq_send_request_free(struct ompi_request_t** request) static int mca_pml_uniq_send_request_free(struct ompi_request_t** request)
{ {
MCA_PML_TEG_FREE(request); MCA_PML_UNIQ_FREE(request);
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
@ -78,9 +78,9 @@ OBJ_CLASS_INSTANCE(
*/ */
int mca_pml_uniq_send_request_schedule(mca_pml_base_send_request_t* req) int mca_pml_uniq_send_request_schedule(mca_ptl_base_send_request_t* req)
{ {
ompi_proc_t *proc = ompi_comm_peer_lookup(req->req_base.req_comm, req->req_base.req_peer); ompi_proc_t *proc = ompi_comm_peer_lookup(req->req_send.req_base.req_comm, req->req_send.req_base.req_peer);
mca_pml_proc_t* proc_pml = proc->proc_pml; mca_pml_proc_t* proc_pml = proc->proc_pml;
int send_count = 0, rc; int send_count = 0, rc;
size_t bytes_remaining; size_t bytes_remaining;
@ -99,7 +99,7 @@ int mca_pml_uniq_send_request_schedule(mca_pml_base_send_request_t* req)
#endif /* PML_UNIQ_ACCEPT_NEXT_PTL */ #endif /* PML_UNIQ_ACCEPT_NEXT_PTL */
mca_ptl_base_module_t* ptl = ptl_proc->ptl; mca_ptl_base_module_t* ptl = ptl_proc->ptl;
/* allocate remaining bytes to PTLs */ /* allocate remaining bytes to PTLs */
bytes_remaining = req->req_bytes_packed - req->req_offset; bytes_remaining = req->req_send.req_bytes_packed - req->req_offset;
/* The rest of the message will be scheduled over the same PTL (the one in the next field). We try /* The rest of the message will be scheduled over the same PTL (the one in the next field). We try
* to be PTL friendly here so we will respect the maximum size accepted by the PTL. * to be PTL friendly here so we will respect the maximum size accepted by the PTL.
*/ */
@ -110,7 +110,7 @@ int mca_pml_uniq_send_request_schedule(mca_pml_base_send_request_t* req)
rc = ptl->ptl_put(ptl, ptl_proc->ptl_peer, req, req->req_offset, bytes_remaining, 0); rc = ptl->ptl_put(ptl, ptl_proc->ptl_peer, req, req->req_offset, bytes_remaining, 0);
if(rc == OMPI_SUCCESS) { if(rc == OMPI_SUCCESS) {
send_count++; send_count++;
bytes_remaining = req->req_bytes_packed - req->req_offset; bytes_remaining = req->req_send.req_bytes_packed - req->req_offset;
} }
/* unable to complete send - queue for later */ /* unable to complete send - queue for later */
@ -123,8 +123,8 @@ int mca_pml_uniq_send_request_schedule(mca_pml_base_send_request_t* req)
} }
/* free the request if completed while in the scheduler */ /* free the request if completed while in the scheduler */
if (req->req_base.req_free_called && req->req_base.req_pml_complete) { if (req->req_send.req_base.req_free_called && req->req_send.req_base.req_pml_complete) {
MCA_PML_TEG_FREE((ompi_request_t**)&req); MCA_PML_UNIQ_FREE((ompi_request_t**)&req);
} }
} }
return OMPI_SUCCESS; return OMPI_SUCCESS;
@ -143,34 +143,34 @@ int mca_pml_uniq_send_request_schedule(mca_pml_base_send_request_t* req)
void mca_pml_uniq_send_request_progress( void mca_pml_uniq_send_request_progress(
struct mca_ptl_base_module_t* ptl, struct mca_ptl_base_module_t* ptl,
mca_pml_base_send_request_t* req, mca_ptl_base_send_request_t* req,
size_t bytes_sent) size_t bytes_sent)
{ {
bool schedule = false; bool schedule = false;
OMPI_THREAD_LOCK(&ompi_request_lock); OMPI_THREAD_LOCK(&ompi_request_lock);
req->req_bytes_sent += bytes_sent; req->req_bytes_sent += bytes_sent;
if (req->req_bytes_sent >= req->req_bytes_packed) { if (req->req_bytes_sent >= req->req_send.req_bytes_packed) {
req->req_base.req_pml_complete = true; req->req_send.req_base.req_pml_complete = true;
if (req->req_base.req_ompi.req_complete == false) { if (req->req_send.req_base.req_ompi.req_complete == false) {
req->req_base.req_ompi.req_status.MPI_SOURCE = req->req_base.req_comm->c_my_rank; req->req_send.req_base.req_ompi.req_status.MPI_SOURCE = req->req_send.req_base.req_comm->c_my_rank;
req->req_base.req_ompi.req_status.MPI_TAG = req->req_base.req_tag; req->req_send.req_base.req_ompi.req_status.MPI_TAG = req->req_send.req_base.req_tag;
req->req_base.req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS; req->req_send.req_base.req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS;
req->req_base.req_ompi.req_status._count = req->req_bytes_sent; req->req_send.req_base.req_ompi.req_status._count = req->req_bytes_sent;
req->req_base.req_ompi.req_complete = true; req->req_send.req_base.req_ompi.req_complete = true;
if(ompi_request_waiting) { if(ompi_request_waiting) {
ompi_condition_broadcast(&ompi_request_cond); ompi_condition_broadcast(&ompi_request_cond);
} }
} else if(req->req_base.req_free_called) { } else if(req->req_send.req_base.req_free_called) {
/* don't free the request if in the scheduler */ /* don't free the request if in the scheduler */
if(req->req_lock == 0) { if(req->req_lock == 0) {
MCA_PML_TEG_FREE((ompi_request_t**)&req); MCA_PML_UNIQ_FREE((ompi_request_t**)&req);
} }
} else if (req->req_send_mode == MCA_PML_BASE_SEND_BUFFERED) { } else if (req->req_send.req_send_mode == MCA_PML_BASE_SEND_BUFFERED) {
mca_pml_base_bsend_request_fini((ompi_request_t*)req); mca_pml_base_bsend_request_fini((ompi_request_t*)req);
} }
/* test to see if we have scheduled the entire request */ /* test to see if we have scheduled the entire request */
} else if (req->req_offset < req->req_bytes_packed) { } else if (req->req_offset < req->req_send.req_bytes_packed) {
schedule = true; schedule = true;
} }
OMPI_THREAD_UNLOCK(&ompi_request_lock); OMPI_THREAD_UNLOCK(&ompi_request_lock);
@ -183,7 +183,7 @@ void mca_pml_uniq_send_request_progress(
/* check for pending requests that need to be progressed */ /* check for pending requests that need to be progressed */
while(ompi_list_get_size(&mca_pml_uniq.uniq_send_pending) != 0) { while(ompi_list_get_size(&mca_pml_uniq.uniq_send_pending) != 0) {
OMPI_THREAD_LOCK(&mca_pml_uniq.uniq_lock); OMPI_THREAD_LOCK(&mca_pml_uniq.uniq_lock);
req = (mca_pml_base_send_request_t*)ompi_list_remove_first(&mca_pml_uniq.uniq_send_pending); req = (mca_ptl_base_send_request_t*)ompi_list_remove_first(&mca_pml_uniq.uniq_send_pending);
OMPI_THREAD_UNLOCK(&mca_pml_uniq.uniq_lock); OMPI_THREAD_UNLOCK(&mca_pml_uniq.uniq_lock);
if(req == NULL) if(req == NULL)
break; break;

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

@ -16,11 +16,11 @@
/** /**
* @file * @file
*/ */
#ifndef OMPI_PML_TEG_SEND_REQUEST_H #ifndef OMPI_PML_UNIQ_SEND_REQUEST_H
#define OMPI_PML_TEG_SEND_REQUEST_H #define OMPI_PML_UNIQ_SEND_REQUEST_H
#include "mca/ptl/ptl.h" #include "mca/ptl/ptl.h"
#include "mca/pml/base/pml_base_sendreq.h" #include "mca/ptl/base/ptl_base_sendreq.h"
#include "mca/ptl/base/ptl_base_sendfrag.h" #include "mca/ptl/base/ptl_base_sendfrag.h"
#include "mca/ptl/base/ptl_base_comm.h" #include "mca/ptl/base/ptl_base_comm.h"
#include "pml_uniq_proc.h" #include "pml_uniq_proc.h"
@ -34,7 +34,7 @@ typedef mca_pml_base_send_request_t mca_pml_uniq_send_request_t;
OBJ_CLASS_DECLARATION(mca_pml_uniq_send_request_t); OBJ_CLASS_DECLARATION(mca_pml_uniq_send_request_t);
#define MCA_PML_TEG_SEND_REQUEST_ALLOC( \ #define MCA_PML_UNIQ_SEND_REQUEST_ALLOC( \
comm, \ comm, \
dst, \ dst, \
sendreq, \ sendreq, \
@ -53,7 +53,7 @@ OBJ_CLASS_DECLARATION(mca_pml_uniq_send_request_t);
*/ \ */ \
if(NULL != ptl_base) { \ if(NULL != ptl_base) { \
OMPI_THREAD_LOCK(&ptl_base->ptl_cache_lock); \ OMPI_THREAD_LOCK(&ptl_base->ptl_cache_lock); \
sendreq = (mca_pml_base_send_request_t*) \ sendreq = (mca_ptl_base_send_request_t*) \
ompi_list_remove_first(&ptl_base->ptl_cache); \ ompi_list_remove_first(&ptl_base->ptl_cache); \
if(NULL != sendreq) { \ if(NULL != sendreq) { \
OMPI_THREAD_UNLOCK(&ptl_base->ptl_cache_lock); \ OMPI_THREAD_UNLOCK(&ptl_base->ptl_cache_lock); \
@ -65,7 +65,7 @@ OBJ_CLASS_DECLARATION(mca_pml_uniq_send_request_t);
mca_ptl_base_module_t* ptl = ptl_base->ptl; \ mca_ptl_base_module_t* ptl = ptl_base->ptl; \
ompi_list_item_t* item; \ ompi_list_item_t* item; \
OMPI_FREE_LIST_WAIT(&mca_pml_uniq.uniq_send_requests, item, rc); \ OMPI_FREE_LIST_WAIT(&mca_pml_uniq.uniq_send_requests, item, rc); \
sendreq = (mca_pml_base_send_request_t*)item; \ sendreq = (mca_ptl_base_send_request_t*)item; \
sendreq->req_ptl = ptl; \ sendreq->req_ptl = ptl; \
if(ptl->ptl_request_init(ptl, sendreq) == OMPI_SUCCESS) { \ if(ptl->ptl_request_init(ptl, sendreq) == OMPI_SUCCESS) { \
sendreq->req_cached = true; \ sendreq->req_cached = true; \
@ -79,7 +79,7 @@ OBJ_CLASS_DECLARATION(mca_pml_uniq_send_request_t);
ompi_list_item_t* item; \ ompi_list_item_t* item; \
OMPI_THREAD_UNLOCK(&ptl_base->ptl_cache_lock); \ OMPI_THREAD_UNLOCK(&ptl_base->ptl_cache_lock); \
OMPI_FREE_LIST_WAIT(&mca_pml_uniq.uniq_send_requests, item, rc); \ OMPI_FREE_LIST_WAIT(&mca_pml_uniq.uniq_send_requests, item, rc); \
sendreq = (mca_pml_base_send_request_t*)item; \ sendreq = (mca_ptl_base_send_request_t*)item; \
sendreq->req_ptl = proc->proc_ptl_first.ptl; \ sendreq->req_ptl = proc->proc_ptl_first.ptl; \
} \ } \
\ \
@ -87,21 +87,42 @@ OBJ_CLASS_DECLARATION(mca_pml_uniq_send_request_t);
} else { \ } else { \
ompi_list_item_t* item; \ ompi_list_item_t* item; \
OMPI_FREE_LIST_WAIT(&mca_pml_uniq.uniq_send_requests, item, rc); \ OMPI_FREE_LIST_WAIT(&mca_pml_uniq.uniq_send_requests, item, rc); \
sendreq = (mca_pml_base_send_request_t*)item; \ sendreq = (mca_ptl_base_send_request_t*)item; \
sendreq->req_ptl = proc->proc_ptl_first.ptl; \ sendreq->req_ptl = proc->proc_ptl_first.ptl; \
} \ } \
/* update request to point to current peer */ \ /* update request to point to current peer */ \
sendreq->req_peer = proc->proc_ptl_first.ptl_peer; \ sendreq->req_peer = proc->proc_ptl_first.ptl_peer; \
} }
#define MCA_PML_UNIQ_SEND_REQUEST_INIT( request, \
addr, \
count, \
datatype, \
peer, \
tag, \
comm, \
mode, \
persistent) \
{ \
MCA_PML_BASE_SEND_REQUEST_INIT((&request->req_send), \
addr, \
count, \
datatype, \
peer, \
tag, \
comm, \
mode, \
persistent \
); \
}
#define MCA_PML_TEG_SEND_REQUEST_RETURN(sendreq) \ #define MCA_PML_UNIQ_SEND_REQUEST_RETURN(sendreq) \
{ \ { \
mca_ptl_base_module_t* ptl = (sendreq)->req_ptl; \ mca_ptl_base_module_t* ptl = (sendreq)->req_ptl; \
mca_pml_base_ptl_t* ptl_base = ptl->ptl_base; \ mca_pml_base_ptl_t* ptl_base = ptl->ptl_base; \
\ \
/* Let the base handle the reference counts */ \ /* Let the base handle the reference counts */ \
MCA_PML_BASE_SEND_REQUEST_RETURN(sendreq); \ MCA_PML_BASE_SEND_REQUEST_RETURN( &((sendreq)->req_send) ); \
\ \
/* \ /* \
* If there is a cache associated with the ptl - first attempt \ * If there is a cache associated with the ptl - first attempt \
@ -114,7 +135,7 @@ OBJ_CLASS_DECLARATION(mca_pml_uniq_send_request_t);
OMPI_THREAD_UNLOCK(&ptl_base->ptl_cache_lock); \ OMPI_THREAD_UNLOCK(&ptl_base->ptl_cache_lock); \
} else { \ } else { \
OMPI_FREE_LIST_RETURN( \ OMPI_FREE_LIST_RETURN( \
&mca_pml_uniq.uniq_send_requests, (ompi_list_item_t*)sendreq); \ &mca_pml_uniq.uniq_send_requests, (ompi_list_item_t*)(sendreq)); \
} \ } \
} }
@ -122,7 +143,7 @@ OBJ_CLASS_DECLARATION(mca_pml_uniq_send_request_t);
/** /**
* Start a send request. * Start a send request.
*/ */
#define MCA_PML_TEG_SEND_REQUEST_START(req, rc) \ #define MCA_PML_UNIQ_SEND_REQUEST_START(req, rc) \
{ \ { \
mca_ptl_base_module_t* ptl = req->req_ptl; \ mca_ptl_base_module_t* ptl = req->req_ptl; \
size_t first_fragment_size = ptl->ptl_first_frag_size; \ size_t first_fragment_size = ptl->ptl_first_frag_size; \
@ -134,22 +155,22 @@ OBJ_CLASS_DECLARATION(mca_pml_uniq_send_request_t);
req->req_peer_match.lval = 0; \ req->req_peer_match.lval = 0; \
req->req_peer_addr.lval = 0; \ req->req_peer_addr.lval = 0; \
req->req_peer_size = 0; \ req->req_peer_size = 0; \
req->req_base.req_pml_complete = false; \ req->req_send.req_base.req_pml_complete = false; \
req->req_base.req_ompi.req_complete = false; \ req->req_send.req_base.req_ompi.req_complete = false; \
req->req_base.req_ompi.req_state = OMPI_REQUEST_ACTIVE; \ req->req_send.req_base.req_ompi.req_state = OMPI_REQUEST_ACTIVE; \
req->req_base.req_sequence = mca_pml_ptl_comm_send_sequence( \ req->req_send.req_base.req_sequence = mca_pml_ptl_comm_send_sequence( \
req->req_base.req_comm->c_pml_comm, req->req_base.req_peer); \ req->req_send.req_base.req_comm->c_pml_comm, req->req_send.req_base.req_peer); \
\ \
/* handle buffered send */ \ /* handle buffered send */ \
if(req->req_send_mode == MCA_PML_BASE_SEND_BUFFERED) { \ if(req->req_send.req_send_mode == MCA_PML_BASE_SEND_BUFFERED) { \
mca_pml_base_bsend_request_start(&req->req_base.req_ompi); \ mca_pml_base_bsend_request_start(&req->req_send.req_base.req_ompi); \
} \ } \
\ \
/* start the first fragment */ \ /* start the first fragment */ \
if (first_fragment_size == 0 || \ if (first_fragment_size == 0 || \
req->req_bytes_packed <= first_fragment_size) { \ req->req_send.req_bytes_packed <= first_fragment_size) { \
first_fragment_size = req->req_bytes_packed; \ first_fragment_size = req->req_send.req_bytes_packed; \
flags = (req->req_send_mode == MCA_PML_BASE_SEND_SYNCHRONOUS) ? \ flags = (req->req_send.req_send_mode == MCA_PML_BASE_SEND_SYNCHRONOUS) ? \
MCA_PTL_FLAGS_ACK : 0; \ MCA_PTL_FLAGS_ACK : 0; \
} else { \ } else { \
/* require match for first fragment of a multi-fragment */ \ /* require match for first fragment of a multi-fragment */ \
@ -164,7 +185,7 @@ OBJ_CLASS_DECLARATION(mca_pml_uniq_send_request_t);
* Schedule any data that was not delivered in the first fragment * Schedule any data that was not delivered in the first fragment
* across the available PTLs. * across the available PTLs.
*/ */
int mca_pml_uniq_send_request_schedule(mca_pml_base_send_request_t* req); int mca_pml_uniq_send_request_schedule(mca_ptl_base_send_request_t* req);
/** /**
@ -173,7 +194,7 @@ int mca_pml_uniq_send_request_schedule(mca_pml_base_send_request_t* req);
*/ */
void mca_pml_uniq_send_request_progress( void mca_pml_uniq_send_request_progress(
struct mca_ptl_base_module_t* ptl, struct mca_ptl_base_module_t* ptl,
mca_pml_base_send_request_t* send_request, mca_ptl_base_send_request_t* send_request,
size_t bytes_sent size_t bytes_sent
); );

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

@ -100,15 +100,15 @@ int mca_pml_uniq_start(size_t count, ompi_request_t** requests)
switch(pml_request->req_type) { switch(pml_request->req_type) {
case MCA_PML_REQUEST_SEND: case MCA_PML_REQUEST_SEND:
{ {
mca_pml_base_send_request_t* sendreq = (mca_pml_base_send_request_t*)pml_request; mca_ptl_base_send_request_t* sendreq = (mca_ptl_base_send_request_t*)pml_request;
MCA_PML_TEG_SEND_REQUEST_START(sendreq, rc); MCA_PML_UNIQ_SEND_REQUEST_START(sendreq, rc);
if(rc != OMPI_SUCCESS) if(rc != OMPI_SUCCESS)
return rc; return rc;
break; break;
} }
case MCA_PML_REQUEST_RECV: case MCA_PML_REQUEST_RECV:
{ {
mca_pml_base_recv_request_t* recvreq = (mca_pml_base_recv_request_t*)pml_request; mca_ptl_base_recv_request_t* recvreq = (mca_ptl_base_recv_request_t*)pml_request;
if((rc = mca_pml_uniq_recv_request_start(recvreq)) != OMPI_SUCCESS) if((rc = mca_pml_uniq_recv_request_start(recvreq)) != OMPI_SUCCESS)
return rc; return rc;
break; break;