1
1

Adapt to the new datatype engine. There are 2 big differences with the previous version:

1. for the send operation: the convertor attached to the request is initialized by the
   _INIT macro and it will be used as is by the PTLs for the first fragment. For the
   others fragments it will be cloned by the PTLs.
2. for the receive operation: I create a macro MATCHED which create a convertor (attached
   to the receive PML request). The PTLs can use this convertor for the first fragment,
   and clone it forr the others fragments.

Playing with positions ... The position argument change it's type and prototype. Now it's
a size_t to be consistent with the rest of thee PML/PTL and it's a pointer to a size_t.
I need this pointer to correct the value of the position as some of the convertors are
not allowed to stop in the middle of a basic datatype (cannnot copy 2 bytes from an int).

This commit was SVN r5987.
Этот коммит содержится в:
George Bosilca 2005-06-08 19:10:15 +00:00
родитель 3f8d210129
Коммит a9f342ac7e
12 изменённых файлов: 63 добавлений и 68 удалений

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

@ -189,7 +189,8 @@ int mca_pml_base_bsend_request_start(ompi_request_t* request)
{
mca_pml_base_send_request_t* sendreq = (mca_pml_base_send_request_t*)request;
struct iovec iov;
unsigned int max_data, iov_count;
unsigned int iov_count;
size_t max_data;
int rc, freeAfter;
if(sendreq->req_count > 0) {
@ -221,30 +222,24 @@ int mca_pml_base_bsend_request_start(ompi_request_t* request)
OMPI_THREAD_UNLOCK(&mca_pml_bsend_mutex);
/* setup convertor to point to app buffer */
ompi_convertor_init_for_send( &sendreq->req_convertor,
0,
sendreq->req_base.req_datatype,
sendreq->req_base.req_count,
sendreq->req_base.req_addr,
0, NULL );
ompi_convertor_set_position( &sendreq->req_convertor, 0 );
/* REMOVE ME ompi_convertor_init_for_send( &sendreq->req_convertor,
0, sendreq->req_base.req_datatype, sendreq->req_base.req_count,
sendreq->req_base.req_addr, 0, NULL ); */
/* pack */
iov.iov_base = sendreq->req_addr;
iov.iov_len = sendreq->req_count;
iov_count = 1;
max_data = iov.iov_len;
if((rc = ompi_convertor_pack(&sendreq->req_convertor, &iov, &iov_count,
&max_data, &freeAfter)) <= 0) {
if((rc = ompi_convertor_pack( &sendreq->req_convertor, &iov, &iov_count,
&max_data, &freeAfter )) <= 0) {
return OMPI_ERROR;
}
/* setup convertor to point to packed buffer */
ompi_convertor_init_for_send( &sendreq->req_convertor,
0,
sendreq->req_datatype,
sendreq->req_count,
sendreq->req_addr,
0, NULL );
ompi_convertor_prepare_for_send( &sendreq->req_convertor, MPI_PACKED,
max_data, sendreq->req_addr );
}
sendreq->req_base.req_ompi.req_complete = true;
return OMPI_SUCCESS;;

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

@ -20,6 +20,8 @@
#define MCA_PML_BASE_RECV_REQUEST_H
#include "mca/pml/base/pml_base_request.h"
#include "datatype/convertor.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
@ -29,6 +31,7 @@ extern "C" {
*/
struct mca_pml_base_recv_request_t {
mca_pml_base_request_t req_base; /**< base request */
ompi_convertor_t req_convertor; /**< convertor that describes this datatype */
size_t req_bytes_packed; /**< size of message being received */
};
typedef struct mca_pml_base_recv_request_t mca_pml_base_recv_request_t;

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

@ -23,6 +23,7 @@
#include "mca/pml/pml.h"
#include "mca/pml/base/pml_base_request.h"
#include "datatype/datatype.h"
#include "datatype/convertor.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
@ -96,21 +97,16 @@ typedef struct mca_pml_base_send_request_t mca_pml_base_send_request_t;
\
/* initialize datatype convertor for this request */ \
if(count > 0) { \
ompi_convertor_copy((request)->req_base.req_proc->proc_convertor,\
&(request)->req_convertor); \
/* We will create a convertor specialized for send */ \
/* just to be able to get the packed size. This size */ \
/* depend on the conversion used sender side or receiver */ \
/* size. BEWARE this convertor is not suitable for the */ \
/* sending operation !! */ \
ompi_convertor_init_for_send( &(request)->req_convertor, \
0, \
(request)->req_base.req_datatype, \
(request)->req_base.req_count, \
(request)->req_base.req_addr, \
-1, NULL ); \
/* We will create a convertor specialized for the */ \
/* remote architecture and prepared with the datatype. */ \
ompi_convertor_copy_and_prepare_for_send( \
(request)->req_base.req_proc->proc_convertor, \
(request)->req_base.req_datatype, \
(request)->req_base.req_count, \
(request)->req_base.req_addr, \
&(request)->req_convertor ); \
ompi_convertor_get_packed_size( &(request)->req_convertor, \
(uint32_t*)&((request)->req_bytes_packed) );\
&((request)->req_bytes_packed) );\
} else { \
(request)->req_bytes_packed = 0; \
} \

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

@ -1,2 +1,3 @@
twoodall
gshipman
bosilca

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

@ -173,8 +173,8 @@ void mca_pml_ob1_recv_request_progress(
mca_bmi_base_segment_t* segments,
size_t num_segments)
{
uint64_t bytes_received = 0;
uint64_t bytes_delivered = 0;
size_t bytes_received = 0;
size_t bytes_delivered = 0;
mca_pml_ob1_hdr_t* hdr = (mca_pml_ob1_hdr_t*)segments->seg_addr.pval;
switch(hdr->hdr_common.hdr_type) {

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

@ -170,16 +170,11 @@ do {
ompi_comm_peer_lookup( \
(request)->req_recv.req_base.req_comm, (hdr)->hdr_src); \
\
ompi_convertor_copy(proc->proc_convertor, \
&(request)->req_convertor); \
ompi_convertor_init_for_recv( \
&(request->req_convertor), /* convertor */ \
0, /* flags */ \
(request)->req_recv.req_base.req_datatype, /* datatype */ \
(request)->req_recv.req_base.req_count, /* count elements */ \
(request)->req_recv.req_base.req_addr, /* users buffer */ \
0, /* offset in bytes into packed buffer */ \
NULL ); /* not allocating memory */ \
ompi_convertor_copy_and_prepare_for_recv( proc->proc_convertor, \
(request)->req_recv.req_base.req_datatype, \
(request)->req_recv.req_base.req_count, \
(request)->req_recv.req_base.req_addr, \
&(request)->req_convertor ); \
} \
} while (0)
@ -200,7 +195,7 @@ do {
if(request->req_recv.req_base.req_count > 0) { \
struct iovec iov[MCA_BMI_DES_MAX_SEGMENTS]; \
uint32_t iov_count = 0; \
uint32_t max_data = bytes_received; \
size_t max_data = bytes_received; \
int32_t free_after = 0; \
size_t n, offset = seg_offset; \
\

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

@ -188,7 +188,7 @@ int mca_pml_ob1_send_request_start_copy(
struct iovec iov;
unsigned int iov_count;
unsigned int max_data;
size_t max_data;
bool ack = false;
/* determine first fragment size */

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

@ -24,6 +24,7 @@
#include "pml_ob1_proc.h"
#include "pml_ob1_comm.h"
#include "pml_ob1_hdr.h"
#include "datatype/convertor.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
@ -95,18 +96,6 @@ OBJ_CLASS_DECLARATION(mca_pml_ob1_send_request_t);
comm, \
sendmode, \
persistent); \
\
/* init convertor at offset 0 */ \
if(sendreq->req_send.req_base.req_count != 0) { \
ompi_convertor_init_for_send( \
&(sendreq)->req_send.req_convertor, \
0, \
(sendreq)->req_send.req_base.req_datatype, \
(sendreq)->req_send.req_base.req_count, \
(sendreq)->req_send.req_base.req_addr, \
0, \
NULL ); \
} \
}
/**

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

@ -56,7 +56,7 @@ bool mca_pml_teg_recv_frag_match(
/*
* Initialize request status.
*/
request->req_recv.req_bytes_packed = header->hdr_msg_length;
/* TODO request->req_recv.req_bytes_packed = header->hdr_msg_length; */
request->req_recv.req_base.req_ompi.req_status.MPI_SOURCE = header->hdr_src;
request->req_recv.req_base.req_ompi.req_status.MPI_TAG = header->hdr_tag;
@ -79,9 +79,7 @@ bool mca_pml_teg_recv_frag_match(
request->req_recv.req_base.req_comm,header->hdr_src,ptl);
}
/* notify ptl of match */
ptl->ptl_matched(ptl, frag);
MCA_PML_TEG_RECV_MATCHED( ptl, frag );
};
/* process any additional fragments that arrived out of order */

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

@ -38,5 +38,25 @@ bool mca_pml_teg_recv_frag_match(
mca_ptl_base_match_header_t* header
);
#define MCA_PML_TEG_RECV_MATCHED( ptl, frag ) \
do { \
mca_pml_base_recv_request_t* _request = (mca_pml_base_recv_request_t*)(frag)->frag_request; \
/* Now that we have the sender we can create the convertor. Additionally, we know */ \
/* that the required convertor should start at the position zero as we just match */ \
/* the first fragment. */ \
if( 0 != (_request)->req_bytes_packed ) { \
(_request)->req_base.req_proc = ompi_comm_peer_lookup( \
(_request)->req_base.req_comm, \
frag->frag_base.frag_header.hdr_match.hdr_src); \
ompi_convertor_copy_and_prepare_for_recv( \
(_request)->req_base.req_proc->proc_convertor, \
(_request)->req_base.req_datatype, \
(_request)->req_base.req_count, \
(_request)->req_base.req_addr, \
&((_request)->req_convertor) ); \
} \
ptl->ptl_matched( (ptl), (frag) ); /* notify ptl of match */ \
} while (0)
#endif

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

@ -20,13 +20,12 @@
#include "mca/ptl/ptl.h"
#include "mca/ptl/base/ptl_base_comm.h"
#include "pml_teg_recvreq.h"
#include "pml_teg_recvfrag.h"
#include "pml_teg_sendreq.h"
static mca_ptl_base_recv_frag_t* mca_pml_teg_recv_request_match_specific_proc(
mca_ptl_base_recv_request_t* request, int proc);
static int mca_pml_teg_recv_request_fini(struct ompi_request_t** request)
{
MCA_PML_TEG_FINI(request);
@ -39,7 +38,6 @@ static int mca_pml_teg_recv_request_free(struct ompi_request_t** request)
return OMPI_SUCCESS;
}
static int mca_pml_teg_recv_request_cancel(struct ompi_request_t* request, int complete)
{
mca_pml_base_request_t* teg_request = (mca_pml_base_request_t*)request;
@ -153,7 +151,7 @@ void mca_pml_teg_recv_request_match_specific(mca_ptl_base_recv_request_t* reques
OMPI_THREAD_UNLOCK(&pml_comm->c_matching_lock);
if( !((MCA_PML_REQUEST_IPROBE == request->req_recv.req_base.req_type) ||
(MCA_PML_REQUEST_PROBE == request->req_recv.req_base.req_type)) ) {
ptl->ptl_matched(ptl, frag);
MCA_PML_TEG_RECV_MATCHED( ptl, frag );
}
return; /* match found */
}
@ -207,7 +205,7 @@ void mca_pml_teg_recv_request_match_wild(mca_ptl_base_recv_request_t* request)
OMPI_THREAD_UNLOCK(&pml_comm->c_matching_lock);
if( !((MCA_PML_REQUEST_IPROBE == request->req_recv.req_base.req_type) ||
(MCA_PML_REQUEST_PROBE == request->req_recv.req_base.req_type)) ) {
ptl->ptl_matched(ptl, frag);
MCA_PML_TEG_RECV_MATCHED( ptl, frag );
}
return; /* match found */
}

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

@ -101,10 +101,10 @@ extern "C" {
* @return mca_pml_proc_t instance
*/
static inline struct mca_ptl_base_peer_t* mca_pml_uniq_proc_lookup_remote_peer(
ompi_communicator_t* comm,
int rank,
struct mca_ptl_base_module_t* ptl)
static inline struct mca_ptl_base_peer_t*
mca_pml_uniq_proc_lookup_remote_peer( ompi_communicator_t* comm,
int rank,
struct mca_ptl_base_module_t* ptl)
{
ompi_proc_t* proc = comm->c_remote_group->grp_proc_pointers[rank];
mca_pml_proc_t* proc_pml = proc->proc_pml;