1
1
This commit was SVN r2755.
Этот коммит содержится в:
George Bosilca 2004-09-19 07:12:29 +00:00
родитель 33aa1c1e87
Коммит 57b1659943
2 изменённых файлов: 64 добавлений и 56 удалений

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

@ -178,13 +178,15 @@ int mca_pml_base_bsend_detach(void* addr, int* size)
/*
* Initialize a request for use w/ buffered send
*/
*/
int mca_pml_base_bsend_request_init(ompi_request_t* request, bool persistent)
{
mca_pml_base_send_request_t* sendreq = (mca_pml_base_send_request_t*)request;
struct iovec iov;
void* buf;
int rc;
int rc, freeAfter;
unsigned int max_data, iov_count;
OMPI_THREAD_LOCK(&mca_pml_bsend_mutex);
if(NULL == mca_pml_bsend_addr) {
@ -202,14 +204,19 @@ int mca_pml_base_bsend_request_init(ompi_request_t* request, bool persistent)
/* pack users message into buffer */
iov.iov_base = buf;
iov.iov_len = sendreq->req_bytes_packed;
if((rc = ompi_convertor_pack(&sendreq->req_convertor, &iov, 1)) < 0) {
iov_count = 1;
max_data = iov.iov_len;
if((rc = ompi_convertor_pack(&sendreq->req_convertor, &iov, &iov_count,
&max_data, &freeAfter)) <= 0) {
mca_pml_bsend_allocator->alc_free(mca_pml_bsend_allocator, buf);
OMPI_THREAD_UNLOCK(&mca_pml_bsend_mutex);
return OMPI_ERROR;
}
/* setup convertor to reflect contiguous buffer */
if((rc = ompi_convertor_init_for_send(&sendreq->req_convertor, 0, MPI_BYTE, iov.iov_len, iov.iov_base, 0)) != OMPI_SUCCESS) {
if((rc = ompi_convertor_init_for_send(&sendreq->req_convertor, 0, MPI_BYTE,
iov.iov_len, iov.iov_base,
0, NULL /*never allocate*/)) != OMPI_SUCCESS) {
mca_pml_bsend_allocator->alc_free(mca_pml_bsend_allocator, buf);
OMPI_THREAD_UNLOCK(&mca_pml_bsend_mutex);
return rc;

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

@ -48,58 +48,59 @@ typedef struct mca_pml_base_send_request_t mca_pml_base_send_request_t;
* @param mode (IN) Send mode (STANDARD,BUFFERED,SYNCHRONOUS,READY)
* @param persistent (IN) Is request persistent.
*/
#define MCA_PML_BASE_SEND_REQUEST_INIT( \
request, \
addr, \
count, \
datatype, \
peer, \
tag, \
comm, \
mode, \
persistent) \
{ \
/* increment reference count on communicator */ \
OBJ_RETAIN(comm); \
\
OMPI_REQUEST_INIT(&(request)->req_base.req_ompi); \
request->req_offset = 0; \
request->req_bytes_sent = 0; \
request->req_send_mode = mode; \
request->req_peer_match.lval = 0; \
request->req_peer_addr.lval = 0; \
request->req_peer_size = 0; \
request->req_base.req_addr = addr; \
request->req_base.req_count = count; \
request->req_base.req_datatype = datatype; \
request->req_base.req_peer = peer; \
request->req_base.req_tag = tag; \
request->req_base.req_comm = comm; \
request->req_base.req_proc = ompi_comm_peer_lookup(comm,peer); \
request->req_base.req_persistent = persistent; \
request->req_base.req_mpi_done = false; \
request->req_base.req_pml_done = false; \
request->req_base.req_free_called = false; \
\
/* initialize datatype convertor for this request */ \
if(count > 0) { \
int packed_size; \
ompi_convertor_copy( \
request->req_base.req_proc->proc_convertor, \
&request->req_convertor); \
ompi_convertor_init_for_send( \
&request->req_convertor, \
0, \
request->req_base.req_datatype, \
request->req_base.req_count, \
request->req_base.req_addr, \
0); \
ompi_convertor_get_packed_size(&request->req_convertor, &packed_size); \
request->req_bytes_packed = packed_size; \
} else { \
request->req_bytes_packed = 0; \
} \
}
#define MCA_PML_BASE_SEND_REQUEST_INIT( request, \
addr, \
count, \
datatype, \
peer, \
tag, \
comm, \
mode, \
persistent) \
{ \
/* increment reference count on communicator */ \
OBJ_RETAIN(comm); \
\
OMPI_REQUEST_INIT(&(request)->req_base.req_ompi); \
request->req_offset = 0; \
request->req_bytes_sent = 0; \
request->req_send_mode = mode; \
request->req_peer_match.lval = 0; \
request->req_peer_addr.lval = 0; \
request->req_peer_size = 0; \
request->req_base.req_addr = addr; \
request->req_base.req_count = count; \
request->req_base.req_datatype = datatype; \
request->req_base.req_peer = peer; \
request->req_base.req_tag = tag; \
request->req_base.req_comm = comm; \
request->req_base.req_proc = ompi_comm_peer_lookup(comm,peer); \
request->req_base.req_persistent = persistent; \
request->req_base.req_mpi_done = false; \
request->req_base.req_pml_done = false; \
request->req_base.req_free_called = false; \
\
/* 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, \
0, NULL ); \
ompi_convertor_get_packed_size( &request->req_convertor, \
&(request->req_bytes_packed) ); \
} else { \
request->req_bytes_packed = 0; \
} \
}
/**