2004-10-12 04:17:29 +00:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
|
|
|
|
2004-07-19 19:45:06 +00:00
|
|
|
/*
|
2004-11-22 01:38:40 +00:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004 The Ohio State University.
|
|
|
|
* All rights reserved.
|
2004-11-28 20:09:25 +00:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2004-11-22 01:38:40 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-07-19 19:45:06 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-10-20 01:03:09 +00:00
|
|
|
#include "ompi_config.h"
|
2004-07-19 19:45:06 +00:00
|
|
|
#include <string.h>
|
2004-11-05 14:53:38 +00:00
|
|
|
#include "class/ompi_bitmap.h"
|
2004-07-19 19:45:06 +00:00
|
|
|
#include "util/output.h"
|
|
|
|
#include "mca/ptl/ptl.h"
|
|
|
|
#include "mca/ptl/base/ptl_base_header.h"
|
|
|
|
#include "mca/ptl/base/ptl_base_sendfrag.h"
|
|
|
|
#include "mca/ptl/base/ptl_base_recvfrag.h"
|
|
|
|
#include "ptl_gm.h"
|
|
|
|
#include "ptl_gm_proc.h"
|
|
|
|
#include "ptl_gm_req.h"
|
|
|
|
#include "ptl_gm_peer.h"
|
2004-08-12 23:37:37 +00:00
|
|
|
#include "ptl_gm_priv.h"
|
2004-07-19 19:45:06 +00:00
|
|
|
|
2004-08-02 00:24:22 +00:00
|
|
|
mca_ptl_gm_module_t mca_ptl_gm_module = {
|
2004-07-19 19:45:06 +00:00
|
|
|
{
|
2004-08-12 23:37:37 +00:00
|
|
|
&mca_ptl_gm_component.super,
|
2004-11-05 14:53:38 +00:00
|
|
|
1, /* max size of request cache */
|
2004-08-12 23:37:37 +00:00
|
|
|
sizeof(mca_ptl_gm_send_frag_t), /* bytes required by ptl for a request */
|
2004-11-05 14:53:38 +00:00
|
|
|
0, /* max size of first fragment */
|
|
|
|
0, /* min fragment size */
|
|
|
|
0, /* max fragment size */
|
|
|
|
0, /* exclusivity */
|
|
|
|
50, /* latency */
|
|
|
|
0, /* bandwidth */
|
2004-08-12 23:37:37 +00:00
|
|
|
MCA_PTL_PUT, /* ptl flags */
|
|
|
|
/* collection of interfaces */
|
|
|
|
mca_ptl_gm_add_procs,
|
|
|
|
mca_ptl_gm_del_procs,
|
|
|
|
mca_ptl_gm_finalize,
|
2004-12-22 07:20:05 +00:00
|
|
|
mca_ptl_gm_peer_send,
|
2004-08-12 23:37:37 +00:00
|
|
|
mca_ptl_gm_put,
|
|
|
|
mca_ptl_gm_get,
|
|
|
|
mca_ptl_gm_matched,
|
2004-09-14 15:29:43 +00:00
|
|
|
mca_ptl_gm_request_init,
|
|
|
|
mca_ptl_gm_request_fini,
|
2004-11-05 14:53:38 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL
|
2004-08-02 00:24:22 +00:00
|
|
|
}
|
2004-07-19 19:45:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE (mca_ptl_gm_send_request_t,
|
|
|
|
mca_pml_base_send_request_t, NULL, NULL);
|
|
|
|
OBJ_CLASS_INSTANCE (mca_ptl_gm_peer_t, ompi_list_item_t, NULL, NULL);
|
|
|
|
|
|
|
|
int
|
2004-08-02 00:24:22 +00:00
|
|
|
mca_ptl_gm_add_procs (struct mca_ptl_base_module_t *ptl,
|
2004-07-19 19:45:06 +00:00
|
|
|
size_t nprocs,
|
|
|
|
struct ompi_proc_t **ompi_procs,
|
|
|
|
struct mca_ptl_base_peer_t **peers,
|
|
|
|
ompi_bitmap_t * reachable)
|
|
|
|
{
|
2004-10-30 06:55:18 +00:00
|
|
|
uint32_t i, j, num_peer_ptls = 1;
|
2004-07-19 19:45:06 +00:00
|
|
|
struct ompi_proc_t *ompi_proc;
|
|
|
|
mca_ptl_gm_proc_t *ptl_proc;
|
|
|
|
mca_ptl_gm_peer_t *ptl_peer;
|
2004-08-12 23:37:37 +00:00
|
|
|
unsigned int lid;
|
2004-08-13 06:25:59 +00:00
|
|
|
ompi_proc_t* local_proc = ompi_proc_local();
|
2004-07-19 19:45:06 +00:00
|
|
|
|
|
|
|
for (i = 0; i < nprocs; i++) {
|
|
|
|
ompi_proc = ompi_procs[i];
|
2004-08-13 06:25:59 +00:00
|
|
|
if( ompi_proc == local_proc ) continue;
|
2004-11-05 14:53:38 +00:00
|
|
|
ptl_proc = mca_ptl_gm_proc_create ((mca_ptl_gm_module_t *) ptl, ompi_proc);
|
2004-07-19 19:45:06 +00:00
|
|
|
if (NULL == ptl_proc) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
OMPI_THREAD_LOCK (&ptl_proc->proc_lock);
|
|
|
|
if (ptl_proc->proc_addr_count == ptl_proc->proc_peer_count) {
|
|
|
|
OMPI_THREAD_UNLOCK (&ptl_proc->proc_lock);
|
|
|
|
return OMPI_ERR_UNREACH;
|
|
|
|
}
|
|
|
|
|
2004-08-13 06:25:59 +00:00
|
|
|
/* TODO: make this extensible to multiple nics */
|
2004-11-05 14:53:38 +00:00
|
|
|
for( j = 0; j < num_peer_ptls; j++ ) {
|
2004-08-13 06:25:59 +00:00
|
|
|
ptl_peer = OBJ_NEW (mca_ptl_gm_peer_t);
|
|
|
|
if (NULL == ptl_peer) {
|
|
|
|
OMPI_THREAD_UNLOCK (&ptl_proc->proc_lock);
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
2004-11-05 14:53:38 +00:00
|
|
|
|
2004-08-13 06:25:59 +00:00
|
|
|
ptl_peer->peer_ptl = (mca_ptl_gm_module_t *) ptl;
|
|
|
|
ptl_peer->peer_proc = ptl_proc;
|
|
|
|
ptl_peer->global_id = ptl_proc->proc_addrs->global_id;
|
|
|
|
ptl_peer->port_number = ptl_proc->proc_addrs->port_id;
|
|
|
|
if (GM_SUCCESS !=
|
2004-10-30 06:55:18 +00:00
|
|
|
gm_global_id_to_node_id (((mca_ptl_gm_module_t *) ptl)->gm_port,
|
2004-08-12 23:37:37 +00:00
|
|
|
ptl_proc->proc_addrs[j].global_id,
|
|
|
|
&lid)) {
|
2004-11-05 14:53:38 +00:00
|
|
|
ompi_output( 0, "[%s:%d] error in converting global to local id \n",
|
|
|
|
__FILE__, __LINE__ );
|
2004-08-12 23:37:37 +00:00
|
|
|
|
2004-08-13 06:25:59 +00:00
|
|
|
}
|
|
|
|
ptl_peer->local_id = lid;
|
|
|
|
ptl_proc->peer_arr[ptl_proc->proc_peer_count] = ptl_peer;
|
|
|
|
ptl_proc->proc_peer_count++;
|
|
|
|
ptl_peer->peer_addr = ptl_proc->proc_addrs + i;
|
|
|
|
}
|
2004-07-19 19:45:06 +00:00
|
|
|
ompi_bitmap_set_bit (reachable, i);
|
|
|
|
OMPI_THREAD_UNLOCK (&ptl_proc->proc_lock);
|
2004-08-12 23:37:37 +00:00
|
|
|
peers[i] = (struct mca_ptl_base_peer_t*)ptl_peer;
|
2004-07-19 19:45:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
int
|
2004-08-02 00:24:22 +00:00
|
|
|
mca_ptl_gm_del_procs (struct mca_ptl_base_module_t *ptl,
|
2004-07-19 19:45:06 +00:00
|
|
|
size_t nprocs,
|
|
|
|
struct ompi_proc_t **procs,
|
|
|
|
struct mca_ptl_base_peer_t **peers)
|
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
for (i = 0; i < nprocs; i++) {
|
|
|
|
OBJ_RELEASE (peers[i]);
|
|
|
|
}
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
int
|
2004-10-30 06:55:18 +00:00
|
|
|
mca_ptl_gm_finalize (struct mca_ptl_base_module_t *base_ptl)
|
2004-07-19 19:45:06 +00:00
|
|
|
{
|
2004-10-30 06:55:18 +00:00
|
|
|
uint32_t index;
|
|
|
|
mca_ptl_gm_module_t* ptl = (mca_ptl_gm_module_t*)base_ptl;
|
|
|
|
|
2004-11-18 00:23:19 +00:00
|
|
|
for( index = 0; index < mca_ptl_gm_component.gm_num_ptl_modules; index++ ) {
|
|
|
|
if( mca_ptl_gm_component.gm_ptl_modules[index] == ptl ) {
|
|
|
|
mca_ptl_gm_component.gm_ptl_modules[index] = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( index == mca_ptl_gm_component.gm_num_ptl_modules ) {
|
|
|
|
ompi_output( 0, "%p is not a GM PTL !!!\n", (void*)base_ptl );
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
|
2004-10-30 06:55:18 +00:00
|
|
|
/* we should do the same things as in the init step in reverse order.
|
|
|
|
* First we shutdown all threads if there are any.
|
|
|
|
*/
|
2004-11-05 14:53:38 +00:00
|
|
|
#if OMPI_HAVE_POSIX_THREADS
|
2004-10-30 06:55:18 +00:00
|
|
|
if( 0 != ptl->thread.t_handle ) {
|
2004-11-05 14:53:38 +00:00
|
|
|
void* thread_return;
|
|
|
|
|
2004-10-30 06:55:18 +00:00
|
|
|
pthread_cancel( ptl->thread.t_handle );
|
|
|
|
ompi_thread_join( &(ptl->thread), &thread_return );
|
|
|
|
}
|
2004-11-05 14:53:38 +00:00
|
|
|
#endif /* OMPI_HAVE_POSIX_THREADS */
|
2004-10-30 06:55:18 +00:00
|
|
|
|
2004-11-18 00:23:19 +00:00
|
|
|
/* Closing each port require several steps. As there is no way to cancel all
|
|
|
|
* already posted messages we start by unregistering all memory and then close
|
|
|
|
* the port. After we can release all internal data.
|
2004-10-30 06:55:18 +00:00
|
|
|
*/
|
2004-11-18 00:23:19 +00:00
|
|
|
if( ptl->gm_send_dma_memory != NULL ) {
|
|
|
|
gm_dma_free( ptl->gm_port, ptl->gm_send_dma_memory );
|
|
|
|
ptl->gm_send_dma_memory = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( ptl->gm_recv_dma_memory != NULL ) {
|
|
|
|
gm_dma_free( ptl->gm_port, ptl->gm_recv_dma_memory );
|
|
|
|
ptl->gm_recv_dma_memory = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now close the port if one is open */
|
|
|
|
if( ptl->gm_port != NULL ) {
|
|
|
|
gm_close( ptl->gm_port );
|
|
|
|
ptl->gm_port = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* And now release all internal ressources. */
|
|
|
|
OBJ_DESTRUCT( &(ptl->gm_send_frags) );
|
|
|
|
if( ptl->gm_send_fragments != NULL ) {
|
|
|
|
free( ptl->gm_send_fragments );
|
|
|
|
ptl->gm_send_fragments = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_DESTRUCT( &(ptl->gm_recv_frags_free) );
|
|
|
|
if( ptl->gm_recv_fragments != NULL ) {
|
|
|
|
free( ptl->gm_recv_fragments );
|
|
|
|
ptl->gm_recv_fragments = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* These are supposed to be empty by now */
|
|
|
|
OBJ_DESTRUCT( &(ptl->gm_send_frags_queue) );
|
|
|
|
OBJ_DESTRUCT( &(ptl->gm_pending_acks) );
|
|
|
|
OBJ_DESTRUCT( &(ptl->gm_recv_outstanding_queue) );
|
|
|
|
|
|
|
|
/* And finally release the PTL itself */
|
2004-10-30 06:55:18 +00:00
|
|
|
free( ptl );
|
|
|
|
|
2004-07-19 19:45:06 +00:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2004-11-05 14:53:38 +00:00
|
|
|
mca_ptl_gm_request_init( struct mca_ptl_base_module_t *ptl,
|
|
|
|
struct mca_pml_base_send_request_t *request )
|
2004-07-19 19:45:06 +00:00
|
|
|
{
|
|
|
|
|
2004-10-04 18:21:44 +00:00
|
|
|
#if 0
|
2004-11-05 14:53:38 +00:00
|
|
|
mca_ptl_gm_send_frag_t *frag;
|
|
|
|
struct mca_ptl_gm_send_request_t *req;
|
|
|
|
frag = mca_ptl_gm_alloc_send_frag(ptl, request);
|
2004-08-12 23:37:37 +00:00
|
|
|
|
2004-11-05 14:53:38 +00:00
|
|
|
if (NULL == frag) {
|
2004-08-12 23:37:37 +00:00
|
|
|
ompi_output(0,"[%s:%d] Unable to allocate a gm send fragment\n");
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2004-11-05 14:53:38 +00:00
|
|
|
} else {
|
|
|
|
req = (mca_ptl_gm_send_request_t *)request;
|
2004-08-12 23:37:37 +00:00
|
|
|
req->req_frag = frag;
|
|
|
|
frag->status = 0; /*MCA_PTL_GM_FRAG_CACHED;*/
|
|
|
|
frag->ptl = (mca_ptl_gm_module_t*)ptl;
|
|
|
|
}
|
|
|
|
return OMPI_SUCCESS;
|
2004-10-04 18:21:44 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return OMPI_ERROR;
|
2004-07-19 19:45:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void
|
2004-08-12 23:37:37 +00:00
|
|
|
mca_ptl_gm_request_fini (struct mca_ptl_base_module_t *ptl,
|
2004-09-14 15:29:43 +00:00
|
|
|
struct mca_pml_base_send_request_t *request)
|
2004-07-19 19:45:06 +00:00
|
|
|
{
|
2004-10-04 18:21:44 +00:00
|
|
|
|
|
|
|
#if 0
|
2004-08-12 23:37:37 +00:00
|
|
|
mca_ptl_gm_send_frag_t *frag;
|
|
|
|
frag = ((mca_ptl_gm_send_request_t *)request)->req_frag;
|
|
|
|
OMPI_FREE_LIST_RETURN(&(((mca_ptl_gm_module_t *)ptl)->gm_send_frags),
|
|
|
|
(ompi_list_item_t *)frag);
|
2004-10-04 18:21:44 +00:00
|
|
|
frag->status = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
OBJ_DESTRUCT(request+1);
|
2004-07-19 19:45:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initiate a put
|
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
2004-08-02 00:24:22 +00:00
|
|
|
mca_ptl_gm_put (struct mca_ptl_base_module_t *ptl,
|
2004-07-19 19:45:06 +00:00
|
|
|
struct mca_ptl_base_peer_t *ptl_peer,
|
|
|
|
struct mca_pml_base_send_request_t *sendreq,
|
|
|
|
size_t offset, size_t size, int flags)
|
|
|
|
{
|
2004-08-30 20:48:13 +00:00
|
|
|
int rc;
|
2004-09-07 21:29:18 +00:00
|
|
|
mca_ptl_gm_send_frag_t *putfrag;
|
2004-08-30 20:48:13 +00:00
|
|
|
|
2004-12-13 05:38:34 +00:00
|
|
|
putfrag = mca_ptl_gm_alloc_send_frag( (mca_ptl_gm_module_t*)ptl, sendreq ); /*alloc_put_frag */
|
|
|
|
rc = mca_ptl_gm_put_frag_init( putfrag,
|
|
|
|
(mca_ptl_gm_peer_t*)ptl_peer, (mca_ptl_gm_module_t*)ptl,
|
2004-11-05 14:53:38 +00:00
|
|
|
sendreq, offset, &size, flags );
|
2004-12-13 05:38:34 +00:00
|
|
|
|
|
|
|
rc = mca_ptl_gm_peer_send_continue( (mca_ptl_gm_peer_t *)ptl_peer, putfrag,
|
2004-12-17 08:39:07 +00:00
|
|
|
sendreq, offset, &size, flags );
|
2004-08-30 20:48:13 +00:00
|
|
|
return OMPI_SUCCESS;
|
2004-07-19 19:45:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* initiate a get.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
2004-08-02 00:24:22 +00:00
|
|
|
mca_ptl_gm_get (struct mca_ptl_base_module_t *ptl,
|
2004-07-19 19:45:06 +00:00
|
|
|
struct mca_ptl_base_peer_t *ptl_base_peer,
|
|
|
|
struct mca_pml_base_recv_request_t *request,
|
|
|
|
size_t offset, size_t size, int flags)
|
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* A posted receive has been matched - if required send an
|
|
|
|
* ack back to the peer and process the fragment.
|
|
|
|
*/
|
|
|
|
void
|
2004-08-13 04:17:31 +00:00
|
|
|
mca_ptl_gm_matched( mca_ptl_base_module_t * ptl,
|
|
|
|
mca_ptl_base_recv_frag_t * frag )
|
2004-07-19 19:45:06 +00:00
|
|
|
{
|
2004-08-13 04:17:31 +00:00
|
|
|
mca_pml_base_recv_request_t *request;
|
2004-12-13 05:38:34 +00:00
|
|
|
mca_ptl_base_header_t *hdr;
|
2004-12-23 00:32:32 +00:00
|
|
|
int rc;
|
2004-08-30 20:48:13 +00:00
|
|
|
mca_ptl_gm_module_t *gm_ptl;
|
|
|
|
mca_ptl_gm_send_frag_t *ack;
|
|
|
|
mca_ptl_gm_recv_frag_t *recv_frag;
|
2004-11-30 23:43:00 +00:00
|
|
|
mca_ptl_gm_peer_t* peer;
|
2005-01-06 00:02:47 +00:00
|
|
|
struct iovec iov = { NULL, 0};
|
|
|
|
|
2004-12-23 17:30:39 +00:00
|
|
|
gm_ptl = (mca_ptl_gm_module_t *)ptl;
|
2004-12-13 05:38:34 +00:00
|
|
|
hdr = &frag->frag_base.frag_header;
|
2004-08-13 04:17:31 +00:00
|
|
|
request = frag->frag_request;
|
2004-11-30 23:43:00 +00:00
|
|
|
recv_frag = (mca_ptl_gm_recv_frag_t *)frag;
|
|
|
|
peer = (mca_ptl_gm_peer_t*)recv_frag->frag_recv.frag_base.frag_peer;
|
2004-08-30 20:48:13 +00:00
|
|
|
|
2004-12-17 08:39:07 +00:00
|
|
|
if( hdr->hdr_common.hdr_flags & MCA_PTL_FLAGS_ACK ) {
|
2004-12-13 05:38:34 +00:00
|
|
|
/* need to send an ack back */
|
2004-11-30 23:43:00 +00:00
|
|
|
ack = mca_ptl_gm_alloc_send_frag( gm_ptl, NULL );
|
|
|
|
if( NULL == ack ) {
|
|
|
|
ompi_output(0,"[%s:%d] unable to alloc a gm fragment\n", __FILE__,__LINE__);
|
|
|
|
OMPI_THREAD_LOCK (&mca_ptl_gm_component.gm_lock);
|
2004-12-13 05:38:34 +00:00
|
|
|
ompi_list_append (&mca_ptl_gm_module.gm_pending_acks, (ompi_list_item_t *)frag);
|
2004-11-30 23:43:00 +00:00
|
|
|
OMPI_THREAD_UNLOCK (&mca_ptl_gm_component.gm_lock);
|
|
|
|
} else {
|
2004-12-13 05:38:34 +00:00
|
|
|
mca_ptl_base_header_t* ack_hdr = (mca_ptl_base_header_t*)ack->send_buf;
|
|
|
|
ack_hdr->hdr_ack.hdr_common.hdr_type = MCA_PTL_HDR_TYPE_ACK;
|
|
|
|
ack_hdr->hdr_ack.hdr_common.hdr_flags = 0;
|
2004-12-17 08:39:07 +00:00
|
|
|
ack_hdr->hdr_ack.hdr_src_ptr = hdr->hdr_rndv.hdr_src_ptr;
|
2004-12-13 05:38:34 +00:00
|
|
|
ack_hdr->hdr_ack.hdr_dst_match.lval = 0L;
|
2004-12-17 08:39:07 +00:00
|
|
|
/* just a easy way to remember that there is a request not a fragment */
|
|
|
|
ack_hdr->hdr_ack.hdr_dst_match.pval = request;
|
2004-12-13 05:38:34 +00:00
|
|
|
ack_hdr->hdr_ack.hdr_dst_addr.lval = 0L;
|
|
|
|
ack_hdr->hdr_ack.hdr_dst_size = request->req_bytes_packed;
|
|
|
|
gm_send_to_peer_with_callback( ((mca_ptl_gm_module_t*)ptl)->gm_port, ack_hdr,
|
|
|
|
GM_SIZE, sizeof(mca_ptl_base_ack_header_t), GM_LOW_PRIORITY,
|
|
|
|
peer->local_id,
|
|
|
|
send_callback, (void *)ack );
|
2004-11-30 23:43:00 +00:00
|
|
|
}
|
2004-08-13 04:17:31 +00:00
|
|
|
}
|
2004-11-05 14:53:38 +00:00
|
|
|
|
2004-12-13 05:38:34 +00:00
|
|
|
if( frag->frag_base.frag_size > 0 ) {
|
2004-11-30 23:43:00 +00:00
|
|
|
unsigned int max_data, out_size;
|
|
|
|
int freeAfter;
|
2005-01-06 00:02:47 +00:00
|
|
|
|
2005-01-06 08:20:45 +00:00
|
|
|
iov.iov_len = mca_ptl_gm_component.gm_segment_size - sizeof(mca_ptl_base_rendezvous_header_t);
|
2005-01-06 00:02:47 +00:00
|
|
|
if( frag->frag_base.frag_size < iov.iov_len ) {
|
|
|
|
iov.iov_len = frag->frag_base.frag_size;
|
|
|
|
}
|
2004-12-13 05:38:34 +00:00
|
|
|
/* Here we expect that frag_addr is the begin of the buffer header included */
|
2004-12-23 00:32:32 +00:00
|
|
|
iov.iov_base = frag->frag_base.frag_addr;
|
2004-12-13 05:38:34 +00:00
|
|
|
|
2004-11-30 23:43:00 +00:00
|
|
|
ompi_convertor_copy( peer->peer_proc->proc_ompi->proc_convertor,
|
2004-12-23 17:30:39 +00:00
|
|
|
&frag->frag_base.frag_convertor );
|
2004-12-17 09:27:10 +00:00
|
|
|
ompi_convertor_init_for_recv( &frag->frag_base.frag_convertor, 0,
|
2004-11-18 00:23:19 +00:00
|
|
|
request->req_base.req_datatype,
|
|
|
|
request->req_base.req_count,
|
|
|
|
request->req_base.req_addr,
|
2004-12-17 09:27:10 +00:00
|
|
|
0, NULL );
|
2004-11-30 23:43:00 +00:00
|
|
|
out_size = 1;
|
|
|
|
max_data = iov.iov_len;
|
|
|
|
rc = ompi_convertor_unpack( &frag->frag_base.frag_convertor, &(iov),
|
|
|
|
&out_size, &max_data, &freeAfter );
|
|
|
|
assert( rc >= 0 );
|
2004-12-17 09:27:10 +00:00
|
|
|
recv_frag->frag_bytes_processed += max_data;
|
2004-09-07 21:29:18 +00:00
|
|
|
}
|
2004-11-05 14:53:38 +00:00
|
|
|
|
2004-12-17 08:39:07 +00:00
|
|
|
/* update progress*/
|
2005-01-06 00:02:47 +00:00
|
|
|
ptl->ptl_recv_progress( ptl, request, iov.iov_len, iov.iov_len );
|
2004-11-05 14:53:38 +00:00
|
|
|
|
2004-08-13 04:17:31 +00:00
|
|
|
/* Now update the status of the fragment */
|
2004-11-05 14:53:38 +00:00
|
|
|
if( ((mca_ptl_gm_recv_frag_t*)frag)->have_allocated_buffer == true ) {
|
2004-12-22 00:14:31 +00:00
|
|
|
gm_release_local_buffer( ((mca_ptl_gm_recv_frag_t*)frag)->frag_recv.frag_base.frag_addr );
|
2004-11-30 23:43:00 +00:00
|
|
|
((mca_ptl_gm_recv_frag_t*)frag)->have_allocated_buffer = false;
|
2004-10-04 18:21:44 +00:00
|
|
|
}
|
2004-11-05 14:53:38 +00:00
|
|
|
|
2004-11-18 06:36:26 +00:00
|
|
|
/* I'm done with this fragment. Return it to the free list */
|
|
|
|
OMPI_FREE_LIST_RETURN( &(gm_ptl->gm_recv_frags_free), (ompi_list_item_t*)frag );
|
2004-07-19 19:45:06 +00:00
|
|
|
}
|
2004-11-30 23:43:00 +00:00
|
|
|
|