1
1

Use the new datatype engine and the convertor attached to the requests (send and receive).

This commit was SVN r5988.
Этот коммит содержится в:
George Bosilca 2005-06-08 19:11:32 +00:00
родитель a9f342ac7e
Коммит 8cc028fee9
2 изменённых файлов: 19 добавлений и 43 удалений

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

@ -94,19 +94,10 @@ static inline void mca_ptl_tcp_recv_frag_matched(
/* if there is data associated with the fragment -- setup to receive */ /* if there is data associated with the fragment -- setup to receive */
if(frag_length > 0) { if(frag_length > 0) {
/* initialize receive convertor */ /* initialize receive convertor */
ompi_proc_t *proc = ompi_convertor_clone( &(request->req_recv.req_convertor),
ompi_comm_peer_lookup(request->req_recv.req_base.req_comm, &(frag->frag_recv.frag_base.frag_convertor), 1 );
request->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); ompi_convertor_personalize( &frag->frag_recv.frag_base.frag_convertor, 0,
ompi_convertor_copy(proc->proc_convertor, &frag->frag_recv.frag_base.frag_convertor); &frag_offset, mca_ptl_tcp_memalloc );
ompi_convertor_init_for_recv(
&frag->frag_recv.frag_base.frag_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 */
mca_ptl_tcp_memalloc ); /* not allocating memory */
/* non-contiguous - allocate buffer for receive */ /* non-contiguous - allocate buffer for receive */
if( 1 == ompi_convertor_need_buffers( &frag->frag_recv.frag_base.frag_convertor ) ) { if( 1 == ompi_convertor_need_buffers( &frag->frag_recv.frag_base.frag_convertor ) ) {
frag->frag_recv.frag_base.frag_addr = malloc(frag_length); frag->frag_recv.frag_base.frag_addr = malloc(frag_length);
@ -137,8 +128,9 @@ static inline void mca_ptl_tcp_recv_frag_matched(
static inline void mca_ptl_tcp_recv_frag_progress(mca_ptl_tcp_recv_frag_t* frag) static inline void mca_ptl_tcp_recv_frag_progress(mca_ptl_tcp_recv_frag_t* frag)
{ {
unsigned int iov_count, max_data; uint32_t iov_count;
int freeAfter; size_t max_data;
int32_t freeAfter;
int32_t frag_progressed = ompi_atomic_add_32(&frag->frag_progressed,1); int32_t frag_progressed = ompi_atomic_add_32(&frag->frag_progressed,1);
/* For a match/rendezvous packet - we need to progress the fragment after /* For a match/rendezvous packet - we need to progress the fragment after
@ -161,18 +153,11 @@ static inline void mca_ptl_tcp_recv_frag_progress(mca_ptl_tcp_recv_frag_t* frag)
* Initialize convertor and use it to unpack data * Initialize convertor and use it to unpack data
*/ */
struct iovec iov; struct iovec iov;
ompi_proc_t *proc =
ompi_comm_peer_lookup(request->req_recv.req_base.req_comm, ompi_convertor_clone( &(request->req_recv.req_convertor),
request->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); &(frag->frag_recv.frag_base.frag_convertor), 1 );
ompi_convertor_copy(proc->proc_convertor, &frag->frag_recv.frag_base.frag_convertor); ompi_convertor_personalize( &(frag->frag_recv.frag_base.frag_convertor),
ompi_convertor_init_for_recv( 0, &offset, mca_ptl_tcp_memalloc );
&frag->frag_recv.frag_base.frag_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 */
offset, /* offset in bytes into packed buffer */
NULL ); /* dont allocate memory */
iov.iov_base = (ompi_iov_base_ptr_t)frag->frag_recv.frag_base.frag_addr; iov.iov_base = (ompi_iov_base_ptr_t)frag->frag_recv.frag_base.frag_addr;
iov.iov_len = frag->frag_recv.frag_base.frag_size; iov.iov_len = frag->frag_recv.frag_base.frag_size;

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

@ -84,11 +84,10 @@ int mca_ptl_tcp_send_frag_init(
int flags) int flags)
{ {
/* message header */ /* message header */
size_t size_in = *size; size_t size_in = *size, size_out, max_data;
size_t size_out; uint32_t iov_count;
unsigned int iov_count, max_data;
mca_ptl_base_header_t* hdr = &sendfrag->frag_header; mca_ptl_base_header_t* hdr = &sendfrag->frag_header;
sendfrag->free_after = 0; sendfrag->free_after = 0;
/* initialize convertor */ /* initialize convertor */
if(size_in > 0) { if(size_in > 0) {
@ -96,16 +95,8 @@ int mca_ptl_tcp_send_frag_init(
int rc; int rc;
convertor = &sendfrag->frag_convertor; convertor = &sendfrag->frag_convertor;
ompi_convertor_copy(&sendreq->req_send.req_convertor, convertor); ompi_convertor_clone( &sendreq->req_send.req_convertor, convertor, 1 );
ompi_convertor_init_for_send( ompi_convertor_personalize( convertor, 0, &offset, mca_ptl_tcp_memalloc );
convertor,
0,
sendreq->req_send.req_datatype,
sendreq->req_send.req_count,
sendreq->req_send.req_addr,
offset,
mca_ptl_tcp_memalloc );
/* if data is contigous convertor will return an offset /* if data is contigous convertor will return an offset
* into users buffer - otherwise will return an allocated buffer * into users buffer - otherwise will return an allocated buffer
* that holds the packed data * that holds the packed data