2005-05-24 02:06:50 +04:00
|
|
|
/*
|
2007-03-17 02:11:45 +03:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2007-07-11 03:45:23 +04:00
|
|
|
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-09-10 08:06:49 +04:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2005-05-24 02:06:50 +04:00
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
2005-09-10 08:06:49 +04:00
|
|
|
*
|
2005-05-24 02:06:50 +04:00
|
|
|
* Additional copyrights may follow
|
2005-09-10 08:06:49 +04:00
|
|
|
*
|
2005-05-24 02:06:50 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/class/ompi_bitmap.h"
|
|
|
|
#include "ompi/mca/pml/pml.h"
|
2007-03-17 02:11:45 +03:00
|
|
|
#include "ompi/mca/pml/base/base.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mca/btl/btl.h"
|
2007-02-09 19:38:16 +03:00
|
|
|
#include "ompi/mca/pml/base/base.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mca/btl/base/base.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
#include "pml_ob1.h"
|
|
|
|
#include "pml_ob1_component.h"
|
|
|
|
#include "pml_ob1_comm.h"
|
|
|
|
#include "pml_ob1_hdr.h"
|
2005-06-02 01:09:43 +04:00
|
|
|
#include "pml_ob1_recvfrag.h"
|
2005-07-12 09:40:56 +04:00
|
|
|
#include "pml_ob1_sendreq.h"
|
|
|
|
#include "pml_ob1_recvreq.h"
|
|
|
|
#include "pml_ob1_rdmafrag.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mca/bml/base/base.h"
|
2006-08-17 00:56:22 +04:00
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
2007-07-20 05:34:02 +04:00
|
|
|
#include "orte/mca/grpcomm/grpcomm.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2007-04-19 07:05:12 +04:00
|
|
|
#include "ompi/runtime/ompi_cr.h"
|
2007-07-09 21:16:34 +04:00
|
|
|
#include "ompi/runtime/ompi_module_exchange.h"
|
2007-04-19 07:05:12 +04:00
|
|
|
#include "orte/mca/smr/smr.h"
|
|
|
|
#include "orte/mca/rml/rml.h"
|
|
|
|
#include "orte/mca/gpr/gpr.h"
|
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
mca_pml_ob1_t mca_pml_ob1 = {
|
|
|
|
{
|
2007-07-11 03:45:23 +04:00
|
|
|
mca_pml_ob1_add_procs,
|
|
|
|
mca_pml_ob1_del_procs,
|
|
|
|
mca_pml_ob1_enable,
|
|
|
|
mca_pml_ob1_progress,
|
|
|
|
mca_pml_ob1_add_comm,
|
|
|
|
mca_pml_ob1_del_comm,
|
|
|
|
mca_pml_ob1_irecv_init,
|
|
|
|
mca_pml_ob1_irecv,
|
|
|
|
mca_pml_ob1_recv,
|
|
|
|
mca_pml_ob1_isend_init,
|
|
|
|
mca_pml_ob1_isend,
|
|
|
|
mca_pml_ob1_send,
|
|
|
|
mca_pml_ob1_iprobe,
|
|
|
|
mca_pml_ob1_probe,
|
|
|
|
mca_pml_ob1_start,
|
|
|
|
mca_pml_ob1_dump,
|
|
|
|
mca_pml_ob1_ft_event,
|
|
|
|
32768,
|
|
|
|
INT_MAX
|
2005-05-24 02:06:50 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2006-08-17 00:56:22 +04:00
|
|
|
|
2007-07-11 03:45:23 +04:00
|
|
|
void mca_pml_ob1_error_handler( struct mca_btl_base_module_t* btl,
|
|
|
|
int32_t flags );
|
2006-08-17 00:56:22 +04:00
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
int mca_pml_ob1_enable(bool enable)
|
|
|
|
{
|
2005-07-12 09:40:56 +04:00
|
|
|
if( false == enable ) return OMPI_SUCCESS;
|
2007-07-11 03:45:23 +04:00
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&mca_pml_ob1.lock, opal_mutex_t);
|
|
|
|
|
|
|
|
/* fragments */
|
|
|
|
OBJ_CONSTRUCT(&mca_pml_ob1.rdma_frags, ompi_free_list_t);
|
|
|
|
ompi_free_list_init( &mca_pml_ob1.rdma_frags,
|
|
|
|
sizeof(mca_pml_ob1_rdma_frag_t),
|
|
|
|
OBJ_CLASS(mca_pml_ob1_rdma_frag_t),
|
|
|
|
mca_pml_ob1.free_list_num,
|
|
|
|
mca_pml_ob1.free_list_max,
|
|
|
|
mca_pml_ob1.free_list_inc,
|
|
|
|
NULL );
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&mca_pml_ob1.recv_frags, ompi_free_list_t);
|
|
|
|
|
|
|
|
ompi_free_list_init( &mca_pml_ob1.recv_frags,
|
|
|
|
sizeof(mca_pml_ob1_recv_frag_t) + mca_pml_ob1.unexpected_limit,
|
|
|
|
OBJ_CLASS(mca_pml_ob1_recv_frag_t),
|
|
|
|
mca_pml_ob1.free_list_num,
|
|
|
|
mca_pml_ob1.free_list_max,
|
|
|
|
mca_pml_ob1.free_list_inc,
|
|
|
|
NULL );
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&mca_pml_ob1.pending_pckts, ompi_free_list_t);
|
|
|
|
ompi_free_list_init( &mca_pml_ob1.pending_pckts,
|
|
|
|
sizeof(mca_pml_ob1_pckt_pending_t),
|
|
|
|
OBJ_CLASS(mca_pml_ob1_pckt_pending_t),
|
|
|
|
mca_pml_ob1.free_list_num,
|
|
|
|
mca_pml_ob1.free_list_max,
|
|
|
|
mca_pml_ob1.free_list_inc,
|
|
|
|
NULL );
|
|
|
|
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&mca_pml_ob1.buffers, ompi_free_list_t);
|
|
|
|
OBJ_CONSTRUCT(&mca_pml_ob1.send_ranges, ompi_free_list_t);
|
|
|
|
ompi_free_list_init( &mca_pml_ob1.send_ranges,
|
|
|
|
sizeof(mca_pml_ob1_send_range_t) +
|
|
|
|
(mca_pml_ob1.max_send_per_range - 1) * sizeof(mca_pml_ob1_com_btl_t),
|
|
|
|
OBJ_CLASS(mca_pml_ob1_send_range_t),
|
|
|
|
mca_pml_ob1.free_list_num,
|
|
|
|
mca_pml_ob1.free_list_max,
|
|
|
|
mca_pml_ob1.free_list_inc,
|
|
|
|
NULL );
|
|
|
|
|
|
|
|
/* pending operations */
|
|
|
|
OBJ_CONSTRUCT(&mca_pml_ob1.send_pending, opal_list_t);
|
|
|
|
OBJ_CONSTRUCT(&mca_pml_ob1.recv_pending, opal_list_t);
|
|
|
|
OBJ_CONSTRUCT(&mca_pml_ob1.pckt_pending, opal_list_t);
|
|
|
|
OBJ_CONSTRUCT(&mca_pml_ob1.rdma_pending, opal_list_t);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If we get here this is the PML who get selected for the run. We
|
|
|
|
* should get ownership for the send and receive requests list, and
|
|
|
|
* initialize them with the size of our own requests.
|
|
|
|
*/
|
|
|
|
ompi_free_list_init( &mca_pml_base_send_requests,
|
2007-08-20 16:06:27 +04:00
|
|
|
sizeof(mca_pml_ob1_send_request_t) +
|
|
|
|
(mca_pml_ob1.max_rdma_per_request - 1) *
|
|
|
|
sizeof(mca_pml_ob1_com_btl_t),
|
2007-07-11 03:45:23 +04:00
|
|
|
OBJ_CLASS(mca_pml_ob1_send_request_t),
|
|
|
|
mca_pml_ob1.free_list_num,
|
|
|
|
mca_pml_ob1.free_list_max,
|
|
|
|
mca_pml_ob1.free_list_inc,
|
|
|
|
NULL );
|
|
|
|
|
|
|
|
ompi_free_list_init( &mca_pml_base_recv_requests,
|
2007-08-20 16:06:27 +04:00
|
|
|
sizeof(mca_pml_ob1_recv_request_t) +
|
|
|
|
(mca_pml_ob1.max_rdma_per_request - 1) *
|
|
|
|
sizeof(mca_pml_ob1_com_btl_t),
|
2007-07-11 03:45:23 +04:00
|
|
|
OBJ_CLASS(mca_pml_ob1_recv_request_t),
|
|
|
|
mca_pml_ob1.free_list_num,
|
|
|
|
mca_pml_ob1.free_list_max,
|
|
|
|
mca_pml_ob1.free_list_inc,
|
|
|
|
NULL );
|
|
|
|
|
2005-09-10 08:06:49 +04:00
|
|
|
mca_pml_ob1.enabled = true;
|
2005-05-24 02:06:50 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mca_pml_ob1_add_comm(ompi_communicator_t* comm)
|
|
|
|
{
|
|
|
|
/* allocate pml specific comm data */
|
|
|
|
mca_pml_ob1_comm_t* pml_comm = OBJ_NEW(mca_pml_ob1_comm_t);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (NULL == pml_comm) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
mca_pml_ob1_comm_init_size(pml_comm, comm->c_remote_group->grp_proc_count);
|
|
|
|
comm->c_pml_comm = pml_comm;
|
|
|
|
|
2006-09-21 02:14:46 +04:00
|
|
|
for( i = 0; i < comm->c_remote_group->grp_proc_count; i++ ) {
|
2007-08-04 04:41:26 +04:00
|
|
|
pml_comm->procs[i].ompi_proc = ompi_group_peer_lookup(comm->c_remote_group,i);
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
2005-05-24 02:06:50 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mca_pml_ob1_del_comm(ompi_communicator_t* comm)
|
|
|
|
{
|
|
|
|
OBJ_RELEASE(comm->c_pml_comm);
|
|
|
|
comm->c_pml_comm = NULL;
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For each proc setup a datastructure that indicates the PTLs
|
|
|
|
* that can be used to reach the destination.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_pml_ob1_add_procs(ompi_proc_t** procs, size_t nprocs)
|
|
|
|
{
|
|
|
|
ompi_bitmap_t reachable;
|
2005-09-10 08:06:49 +04:00
|
|
|
struct mca_bml_base_endpoint_t ** bml_endpoints = NULL;
|
2005-05-24 02:06:50 +04:00
|
|
|
int rc;
|
2006-07-04 05:20:20 +04:00
|
|
|
size_t i;
|
2005-09-10 08:06:49 +04:00
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
if(nprocs == 0)
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
|
2007-07-01 20:17:43 +04:00
|
|
|
/* we don't have any endpoint data we need to cache on the
|
|
|
|
ompi_proc_t, so set proc_pml to NULL */
|
|
|
|
for (i = 0 ; i < nprocs ; ++i) {
|
|
|
|
procs[i]->proc_pml = NULL;
|
|
|
|
}
|
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
OBJ_CONSTRUCT(&reachable, ompi_bitmap_t);
|
2006-10-20 07:57:44 +04:00
|
|
|
rc = ompi_bitmap_init(&reachable, (int)nprocs);
|
2005-05-24 02:06:50 +04:00
|
|
|
if(OMPI_SUCCESS != rc)
|
|
|
|
return rc;
|
|
|
|
|
2007-03-17 02:11:45 +03:00
|
|
|
/*
|
|
|
|
* JJH: Disable this in FT enabled builds since
|
|
|
|
* we use a wrapper PML. It will cause this check to
|
|
|
|
* return failure as all processes will return the wrapper PML
|
|
|
|
* component in use instead of the wrapped PML component underneath.
|
|
|
|
*/
|
|
|
|
#if OPAL_ENABLE_FT == 0
|
2007-02-09 19:38:16 +03:00
|
|
|
/* make sure remote procs are using the same PML as us */
|
|
|
|
if (OMPI_SUCCESS != (rc = mca_pml_base_pml_check_selected("ob1",
|
|
|
|
procs,
|
|
|
|
nprocs))) {
|
|
|
|
return rc;
|
|
|
|
}
|
2007-03-17 02:11:45 +03:00
|
|
|
#endif
|
2007-02-09 19:38:16 +03:00
|
|
|
|
2005-10-13 00:59:25 +04:00
|
|
|
bml_endpoints = (struct mca_bml_base_endpoint_t **) malloc ( nprocs *
|
|
|
|
sizeof(struct mca_bml_base_endpoint_t*));
|
|
|
|
if ( NULL == bml_endpoints ) {
|
2007-07-01 20:17:43 +04:00
|
|
|
rc = OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
goto cleanup_and_return;
|
2005-10-13 00:59:25 +04:00
|
|
|
}
|
|
|
|
|
2007-07-01 20:17:43 +04:00
|
|
|
rc = mca_bml.bml_add_procs( nprocs,
|
|
|
|
procs,
|
|
|
|
bml_endpoints,
|
|
|
|
&reachable );
|
2005-09-10 08:06:49 +04:00
|
|
|
if(OMPI_SUCCESS != rc)
|
2007-07-01 20:17:43 +04:00
|
|
|
goto cleanup_and_return;
|
2005-09-10 08:06:49 +04:00
|
|
|
|
2007-07-01 20:17:43 +04:00
|
|
|
rc = mca_bml.bml_register( MCA_BTL_TAG_PML,
|
|
|
|
mca_pml_ob1_recv_frag_callback,
|
|
|
|
NULL );
|
|
|
|
if(OMPI_SUCCESS != rc)
|
|
|
|
goto cleanup_and_return;
|
2006-08-17 00:56:22 +04:00
|
|
|
|
|
|
|
/* register error handlers */
|
|
|
|
rc = mca_bml.bml_register_error(mca_pml_ob1_error_handler);
|
2007-07-01 20:17:43 +04:00
|
|
|
if(OMPI_SUCCESS != rc)
|
|
|
|
goto cleanup_and_return;
|
2006-08-17 00:56:22 +04:00
|
|
|
|
2007-07-01 20:17:43 +04:00
|
|
|
cleanup_and_return:
|
|
|
|
if( NULL != bml_endpoints) {
|
|
|
|
free ( bml_endpoints);
|
2005-10-13 00:59:25 +04:00
|
|
|
}
|
2006-02-27 14:06:01 +03:00
|
|
|
OBJ_DESTRUCT(&reachable);
|
2007-07-01 20:17:43 +04:00
|
|
|
|
2005-09-10 08:06:49 +04:00
|
|
|
return rc;
|
2005-05-24 02:06:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* iterate through each proc and notify any PTLs associated
|
|
|
|
* with the proc that it is/has gone away
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_pml_ob1_del_procs(ompi_proc_t** procs, size_t nprocs)
|
|
|
|
{
|
2005-08-12 06:41:14 +04:00
|
|
|
return mca_bml.bml_del_procs(nprocs, procs);
|
2005-05-24 02:06:50 +04:00
|
|
|
}
|
|
|
|
|
2006-03-17 21:46:48 +03:00
|
|
|
/*
|
|
|
|
* diagnostics
|
|
|
|
*/
|
|
|
|
|
2006-03-20 18:41:45 +03:00
|
|
|
int mca_pml_ob1_dump(struct ompi_communicator_t* comm, int verbose)
|
2006-03-17 21:46:48 +03:00
|
|
|
{
|
|
|
|
struct mca_pml_comm_t* pml_comm = comm->c_pml_comm;
|
2007-02-02 09:47:35 +03:00
|
|
|
int i;
|
2006-03-17 21:46:48 +03:00
|
|
|
|
|
|
|
/* iterate through all procs on communicator */
|
2007-02-02 09:47:35 +03:00
|
|
|
for( i = 0; i < (int)pml_comm->num_procs; i++ ) {
|
2006-03-17 21:46:48 +03:00
|
|
|
mca_pml_ob1_comm_proc_t* proc = &pml_comm->procs[i];
|
2006-09-21 02:14:46 +04:00
|
|
|
mca_bml_base_endpoint_t* ep = (mca_bml_base_endpoint_t*)proc->ompi_proc->proc_bml;
|
2006-03-17 21:46:48 +03:00
|
|
|
size_t n;
|
|
|
|
|
|
|
|
opal_output(0, "[Rank %d]\n", i);
|
|
|
|
/* dump all receive queues */
|
|
|
|
|
|
|
|
/* dump all btls */
|
|
|
|
for(n=0; n<ep->btl_eager.arr_size; n++) {
|
2006-03-21 21:18:22 +03:00
|
|
|
mca_bml_base_btl_t* bml_btl = &ep->btl_eager.bml_btls[n];
|
2006-03-17 21:46:48 +03:00
|
|
|
bml_btl->btl->btl_dump(bml_btl->btl, bml_btl->btl_endpoint, verbose);
|
|
|
|
}
|
|
|
|
}
|
2006-03-20 18:41:45 +03:00
|
|
|
return OMPI_SUCCESS;
|
2006-03-17 21:46:48 +03:00
|
|
|
}
|
|
|
|
|
2007-07-11 03:45:23 +04:00
|
|
|
static void mca_pml_ob1_fin_completion( mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* ep,
|
|
|
|
struct mca_btl_base_descriptor_t* des,
|
|
|
|
int status )
|
2006-07-20 18:44:35 +04:00
|
|
|
{
|
|
|
|
|
|
|
|
mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) des->des_context;
|
|
|
|
|
|
|
|
MCA_BML_BASE_BTL_DES_RETURN(bml_btl, des);
|
|
|
|
|
|
|
|
/* check for pending requests */
|
|
|
|
MCA_PML_OB1_PROGRESS_PENDING(bml_btl);
|
|
|
|
}
|
|
|
|
|
2007-07-11 03:45:23 +04:00
|
|
|
int mca_pml_ob1_send_fin( ompi_proc_t* proc,
|
|
|
|
mca_bml_base_btl_t* bml_btl,
|
|
|
|
void *hdr_des,
|
|
|
|
uint8_t order,
|
|
|
|
uint32_t status )
|
2006-07-20 18:44:35 +04:00
|
|
|
{
|
|
|
|
mca_btl_base_descriptor_t* fin;
|
|
|
|
mca_pml_ob1_fin_hdr_t* hdr;
|
|
|
|
int rc;
|
|
|
|
|
2007-05-27 12:29:38 +04:00
|
|
|
MCA_PML_OB1_DES_ALLOC(bml_btl, fin, order, sizeof(mca_pml_ob1_fin_hdr_t));
|
2006-07-20 18:44:35 +04:00
|
|
|
if(NULL == fin) {
|
2007-06-03 12:31:58 +04:00
|
|
|
MCA_PML_OB1_ADD_FIN_TO_PENDING(proc, hdr_des, bml_btl, order, status);
|
2006-07-20 18:44:35 +04:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
fin->des_flags |= MCA_BTL_DES_FLAGS_PRIORITY;
|
|
|
|
fin->des_cbfunc = mca_pml_ob1_fin_completion;
|
|
|
|
fin->des_cbdata = NULL;
|
|
|
|
|
|
|
|
/* fill in header */
|
2007-01-05 01:07:37 +03:00
|
|
|
hdr = (mca_pml_ob1_fin_hdr_t*)fin->des_src->seg_addr.pval;
|
2006-07-20 18:44:35 +04:00
|
|
|
hdr->hdr_common.hdr_flags = 0;
|
|
|
|
hdr->hdr_common.hdr_type = MCA_PML_OB1_HDR_TYPE_FIN;
|
2007-01-05 01:07:37 +03:00
|
|
|
hdr->hdr_des.pval = hdr_des;
|
2007-06-03 12:31:58 +04:00
|
|
|
hdr->hdr_fail = status;
|
2006-07-20 18:44:35 +04:00
|
|
|
|
|
|
|
#if OMPI_ENABLE_HETEROGENEOUS_SUPPORT
|
|
|
|
#ifdef WORDS_BIGENDIAN
|
|
|
|
hdr->hdr_common.hdr_flags |= MCA_PML_OB1_HDR_FLAGS_NBO;
|
|
|
|
#else
|
|
|
|
/* if we are little endian and the remote side is big endian,
|
|
|
|
we're responsible for making sure the data is in network byte
|
|
|
|
order */
|
|
|
|
if (proc->proc_arch & OMPI_ARCH_ISBIGENDIAN) {
|
|
|
|
hdr->hdr_common.hdr_flags |= MCA_PML_OB1_HDR_FLAGS_NBO;
|
|
|
|
MCA_PML_OB1_FIN_HDR_HTON(*hdr);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* queue request */
|
|
|
|
rc = mca_bml_base_send(
|
|
|
|
bml_btl,
|
|
|
|
fin,
|
|
|
|
MCA_BTL_TAG_PML
|
|
|
|
);
|
|
|
|
if(OMPI_SUCCESS != rc) {
|
|
|
|
MCA_BML_BASE_BTL_DES_RETURN(bml_btl, fin);
|
2007-06-03 12:31:58 +04:00
|
|
|
MCA_PML_OB1_ADD_FIN_TO_PENDING(proc, hdr_des, bml_btl, order, status);
|
2006-07-20 18:44:35 +04:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
void mca_pml_ob1_process_pending_packets(mca_bml_base_btl_t* bml_btl)
|
|
|
|
{
|
|
|
|
mca_pml_ob1_pckt_pending_t *pckt;
|
2006-10-20 07:57:44 +04:00
|
|
|
int32_t i, rc, s = (int32_t)opal_list_get_size(&mca_pml_ob1.pckt_pending);
|
2006-07-20 18:44:35 +04:00
|
|
|
|
|
|
|
for(i = 0; i < s; i++) {
|
2006-12-03 13:12:09 +03:00
|
|
|
mca_bml_base_btl_t *send_dst = NULL;
|
2006-07-20 18:44:35 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_pml_ob1.lock);
|
|
|
|
pckt = (mca_pml_ob1_pckt_pending_t*)
|
|
|
|
opal_list_remove_first(&mca_pml_ob1.pckt_pending);
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_ob1.lock);
|
|
|
|
if(NULL == pckt)
|
|
|
|
break;
|
2006-12-03 13:12:09 +03:00
|
|
|
if(pckt->bml_btl != NULL &&
|
|
|
|
pckt->bml_btl->btl == bml_btl->btl) {
|
|
|
|
send_dst = pckt->bml_btl;
|
|
|
|
} else {
|
|
|
|
send_dst = mca_bml_base_btl_array_find(
|
|
|
|
&pckt->proc->proc_bml->btl_eager, bml_btl->btl);
|
|
|
|
}
|
2006-10-26 17:21:47 +04:00
|
|
|
if(NULL == send_dst) {
|
|
|
|
OPAL_THREAD_LOCK(&mca_pml_ob1.lock);
|
|
|
|
opal_list_append(&mca_pml_ob1.pckt_pending,
|
|
|
|
(opal_list_item_t*)pckt);
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_ob1.lock);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2006-07-20 18:44:35 +04:00
|
|
|
switch(pckt->hdr.hdr_common.hdr_type) {
|
|
|
|
case MCA_PML_OB1_HDR_TYPE_ACK:
|
|
|
|
rc = mca_pml_ob1_recv_request_ack_send_btl(pckt->proc,
|
2006-10-26 17:21:47 +04:00
|
|
|
send_dst,
|
2007-01-05 01:07:37 +03:00
|
|
|
pckt->hdr.hdr_ack.hdr_src_req.lval,
|
|
|
|
pckt->hdr.hdr_ack.hdr_dst_req.pval,
|
2007-06-03 12:30:07 +04:00
|
|
|
pckt->hdr.hdr_ack.hdr_send_offset);
|
2006-07-20 18:44:35 +04:00
|
|
|
MCA_PML_OB1_PCKT_PENDING_RETURN(pckt);
|
|
|
|
if(OMPI_ERR_OUT_OF_RESOURCE == rc) {
|
|
|
|
MCA_PML_OB1_ADD_ACK_TO_PENDING(pckt->proc,
|
2007-01-05 01:07:37 +03:00
|
|
|
pckt->hdr.hdr_ack.hdr_src_req.lval,
|
|
|
|
pckt->hdr.hdr_ack.hdr_dst_req.pval,
|
2007-06-03 12:30:07 +04:00
|
|
|
pckt->hdr.hdr_ack.hdr_send_offset);
|
2006-07-20 18:44:35 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MCA_PML_OB1_HDR_TYPE_FIN:
|
2007-05-28 10:51:12 +04:00
|
|
|
rc = mca_pml_ob1_send_fin(pckt->proc, send_dst,
|
2007-05-24 23:51:26 +04:00
|
|
|
pckt->hdr.hdr_fin.hdr_des.pval,
|
2007-06-03 12:31:58 +04:00
|
|
|
pckt->order,
|
|
|
|
pckt->hdr.hdr_fin.hdr_fail);
|
2006-07-20 18:44:35 +04:00
|
|
|
MCA_PML_OB1_PCKT_PENDING_RETURN(pckt);
|
2007-05-28 10:51:12 +04:00
|
|
|
if(OMPI_ERR_OUT_OF_RESOURCE == rc)
|
2006-07-20 18:44:35 +04:00
|
|
|
return;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
opal_output(0, "[%s:%d] wrong header type\n",
|
|
|
|
__FILE__, __LINE__);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void mca_pml_ob1_process_pending_rdma(void)
|
|
|
|
{
|
|
|
|
mca_pml_ob1_rdma_frag_t* frag;
|
2006-10-20 07:57:44 +04:00
|
|
|
int32_t i, rc, s = (int32_t)opal_list_get_size(&mca_pml_ob1.rdma_pending);
|
2006-07-20 18:44:35 +04:00
|
|
|
|
|
|
|
for(i = 0; i < s; i++) {
|
|
|
|
OPAL_THREAD_LOCK(&mca_pml_ob1.lock);
|
|
|
|
frag = (mca_pml_ob1_rdma_frag_t*)
|
|
|
|
opal_list_remove_first(&mca_pml_ob1.rdma_pending);
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_ob1.lock);
|
|
|
|
if(NULL == frag)
|
|
|
|
break;
|
|
|
|
if(frag->rdma_state == MCA_PML_OB1_RDMA_PUT) {
|
2007-06-03 12:31:58 +04:00
|
|
|
frag->retries++;
|
2006-07-20 18:44:35 +04:00
|
|
|
rc = mca_pml_ob1_send_request_put_frag(frag);
|
|
|
|
} else {
|
|
|
|
rc = mca_pml_ob1_recv_request_get_frag(frag);
|
|
|
|
}
|
|
|
|
if(OMPI_ERR_OUT_OF_RESOURCE == rc)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-08-17 00:56:22 +04:00
|
|
|
|
|
|
|
|
|
|
|
void mca_pml_ob1_error_handler(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
int32_t flags) {
|
|
|
|
orte_errmgr.abort();
|
|
|
|
}
|
2007-04-05 17:52:05 +04:00
|
|
|
|
|
|
|
int mca_pml_ob1_ft_event( int state )
|
|
|
|
{
|
2007-06-19 04:46:16 +04:00
|
|
|
ompi_proc_t** procs = NULL;
|
2007-04-19 07:05:12 +04:00
|
|
|
size_t num_procs;
|
|
|
|
int ret, p;
|
2007-04-05 17:52:05 +04:00
|
|
|
|
|
|
|
if(OPAL_CRS_CHECKPOINT == state) {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
else if(OPAL_CRS_CONTINUE == state) {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
else if(OPAL_CRS_RESTART == state) {
|
2007-04-19 07:05:12 +04:00
|
|
|
/*
|
|
|
|
* Get a list of processes
|
|
|
|
*/
|
|
|
|
procs = ompi_proc_all(&num_procs);
|
|
|
|
if(NULL == procs) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Clean out the modex information since it is invalid now.
|
|
|
|
*/
|
|
|
|
opal_output_verbose(10, ompi_cr_output,
|
|
|
|
"pml:ob1: ft_event(Restart): Restart Modex information");
|
2007-07-09 21:16:34 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = ompi_modex_finalize())) {
|
2007-04-19 07:05:12 +04:00
|
|
|
opal_output(0,
|
|
|
|
"pml:ob1: ft_event(Restart): modex_finalize Failed %d",
|
|
|
|
ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(p = 0; p < (int)num_procs; ++p) {
|
|
|
|
if( NULL != procs[p]->proc_modex ) {
|
|
|
|
OBJ_RELEASE(procs[p]->proc_modex);
|
|
|
|
procs[p]->proc_modex = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-09 21:16:34 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = ompi_modex_init())) {
|
2007-04-19 07:05:12 +04:00
|
|
|
opal_output(0,
|
|
|
|
"pml:ob1: ft_event(Restart): modex_init Failed %d",
|
|
|
|
ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-04-05 17:52:05 +04:00
|
|
|
}
|
|
|
|
else if(OPAL_CRS_TERM == state ) {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Call the BML
|
|
|
|
* BML is expected to call ft_event in
|
|
|
|
* - BTL(s)
|
|
|
|
* - MPool(s)
|
|
|
|
*/
|
|
|
|
if( OMPI_SUCCESS != (ret = mca_bml.bml_ft_event(state))) {
|
|
|
|
opal_output(0, "pml:base: ft_event: BML ft_event function failed: %d\n",
|
|
|
|
ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(OPAL_CRS_CHECKPOINT == state) {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
else if(OPAL_CRS_CONTINUE == state) {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
else if(OPAL_CRS_RESTART == state) {
|
2007-04-19 07:05:12 +04:00
|
|
|
/*
|
2007-07-09 21:16:34 +04:00
|
|
|
* Re-subscribe to the modex information
|
2007-04-19 07:05:12 +04:00
|
|
|
*/
|
2007-07-09 21:16:34 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = ompi_modex_subscribe_job(ORTE_PROC_MY_NAME->jobid))) {
|
2007-04-19 07:05:12 +04:00
|
|
|
opal_output(0,
|
2007-07-09 21:16:34 +04:00
|
|
|
"pml:ob1: ft_event(Restart): Failed to subscribe to the modex information %d",
|
2007-04-19 07:05:12 +04:00
|
|
|
ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
opal_output_verbose(10, ompi_cr_output,
|
|
|
|
"pml:ob1: ft_event(Restart): Enter Stage Gate 1");
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_smr.set_proc_state(orte_process_info.my_name,
|
|
|
|
ORTE_PROC_STATE_AT_STG1, 0))) {
|
|
|
|
opal_output(0,
|
|
|
|
"pml:ob1: ft_event(Restart): Stage Gate 1 Failed %d",
|
|
|
|
ret);
|
|
|
|
return ret;
|
|
|
|
}
|
2007-04-14 06:06:05 +04:00
|
|
|
|
2007-07-20 05:34:02 +04:00
|
|
|
if (ORTE_SUCCESS != (ret = orte_grpcomm.xcast_gate(orte_gpr.deliver_notify_msg))) {
|
2007-04-19 07:05:12 +04:00
|
|
|
opal_output(0,
|
|
|
|
"pml:ob1: ft_event(Restart): Stage Gate 1 Failed %d",
|
|
|
|
ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( OMPI_SUCCESS != (ret = mca_pml_ob1_add_procs(procs, num_procs) ) ) {
|
|
|
|
opal_output(0, "pml:ob1: readd_procs: Failed in add_procs (%d)", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
2007-04-14 06:06:05 +04:00
|
|
|
|
2007-04-19 07:05:12 +04:00
|
|
|
/*
|
|
|
|
* Set the STAGE 2 State
|
|
|
|
*/
|
|
|
|
opal_output_verbose(10, ompi_cr_output,
|
|
|
|
"pml:ob1: ft_event(Restart): Enter Stage Gate 2");
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_smr.set_proc_state(orte_process_info.my_name,
|
|
|
|
ORTE_PROC_STATE_AT_STG2, 0))) {
|
|
|
|
opal_output(0,"pml:ob1: ft_event(Restart): Stage Gate 1 Failed %d",
|
|
|
|
ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-07-20 05:34:02 +04:00
|
|
|
if (ORTE_SUCCESS != (ret = orte_grpcomm.xcast_gate(orte_gpr.deliver_notify_msg))) {
|
2007-04-19 07:05:12 +04:00
|
|
|
opal_output(0,"pml:ob1: ft_event(Restart): Stage Gate 1 Failed %d",
|
|
|
|
ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( NULL != procs ) {
|
|
|
|
for(p = 0; p < (int)num_procs; ++p) {
|
|
|
|
OBJ_RELEASE(procs[p]);
|
|
|
|
}
|
|
|
|
free(procs);
|
|
|
|
procs = NULL;
|
|
|
|
}
|
2007-04-05 17:52:05 +04:00
|
|
|
}
|
|
|
|
else if(OPAL_CRS_TERM == state ) {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2007-07-01 15:34:23 +04:00
|
|
|
|
|
|
|
int mca_pml_ob1_com_btl_comp(const void *v1, const void *v2)
|
|
|
|
{
|
|
|
|
const mca_pml_ob1_com_btl_t *b1 = v1, *b2 = v2;
|
|
|
|
|
|
|
|
if(b1->bml_btl->btl_weight < b2->bml_btl->btl_weight)
|
|
|
|
return 1;
|
|
|
|
if(b1->bml_btl->btl_weight > b2->bml_btl->btl_weight)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|