2007-12-21 09:02:00 +03:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
2005-11-22 20:24:47 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2007-12-21 09:02:00 +03:00
|
|
|
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
2005-11-22 20:24:47 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2006-03-28 02:44:26 +04:00
|
|
|
* Copyright (c) 2004-2006 The Regents of the University of California.
|
2005-11-22 20:24:47 +03:00
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "pml_dr.h"
|
|
|
|
#include "pml_dr_comm.h"
|
2006-03-29 20:19:17 +04:00
|
|
|
#include "pml_dr_endpoint.h"
|
2006-03-23 02:06:18 +03:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
static void mca_pml_dr_comm_proc_construct(mca_pml_dr_comm_proc_t* proc)
|
|
|
|
{
|
|
|
|
proc->expected_sequence = 1;
|
|
|
|
proc->send_sequence = 0;
|
|
|
|
OBJ_CONSTRUCT(&proc->frags_cant_match, opal_list_t);
|
|
|
|
OBJ_CONSTRUCT(&proc->specific_receives, opal_list_t);
|
2006-03-22 18:02:36 +03:00
|
|
|
OBJ_CONSTRUCT(&proc->matched_receives, opal_list_t);
|
2005-11-22 20:24:47 +03:00
|
|
|
OBJ_CONSTRUCT(&proc->unexpected_frags, opal_list_t);
|
2006-03-29 20:19:17 +04:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void mca_pml_dr_comm_proc_destruct(mca_pml_dr_comm_proc_t* proc)
|
|
|
|
{
|
|
|
|
OBJ_DESTRUCT(&proc->frags_cant_match);
|
2006-03-22 18:02:36 +03:00
|
|
|
OBJ_DESTRUCT(&proc->matched_receives);
|
2005-11-22 20:24:47 +03:00
|
|
|
OBJ_DESTRUCT(&proc->specific_receives);
|
|
|
|
OBJ_DESTRUCT(&proc->unexpected_frags);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static OBJ_CLASS_INSTANCE(
|
|
|
|
mca_pml_dr_comm_proc_t,
|
|
|
|
opal_object_t,
|
|
|
|
mca_pml_dr_comm_proc_construct,
|
|
|
|
mca_pml_dr_comm_proc_destruct);
|
|
|
|
|
|
|
|
static void mca_pml_dr_comm_construct(mca_pml_dr_comm_t* comm)
|
|
|
|
{
|
|
|
|
OBJ_CONSTRUCT(&comm->wild_receives, opal_list_t);
|
|
|
|
OBJ_CONSTRUCT(&comm->matching_lock, opal_mutex_t);
|
2007-12-21 09:02:00 +03:00
|
|
|
OBJ_CONSTRUCT(&comm->sparse_procs, opal_pointer_array_t);
|
2005-11-22 20:24:47 +03:00
|
|
|
comm->recv_sequence = 0;
|
|
|
|
comm->procs = NULL;
|
|
|
|
comm->num_procs = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void mca_pml_dr_comm_destruct(mca_pml_dr_comm_t* comm)
|
|
|
|
{
|
|
|
|
size_t i;
|
2006-03-29 20:19:17 +04:00
|
|
|
for(i=0; i<comm->num_procs; i++) {
|
2005-11-22 20:24:47 +03:00
|
|
|
OBJ_DESTRUCT((&comm->procs[i]));
|
2006-03-29 20:19:17 +04:00
|
|
|
}
|
|
|
|
if(NULL != comm->procs) {
|
2005-11-22 20:24:47 +03:00
|
|
|
free(comm->procs);
|
2006-03-29 20:19:17 +04:00
|
|
|
}
|
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
OBJ_DESTRUCT(&comm->wild_receives);
|
|
|
|
OBJ_DESTRUCT(&comm->matching_lock);
|
2006-03-29 20:19:17 +04:00
|
|
|
OBJ_DESTRUCT(&comm->sparse_procs);
|
2005-11-22 20:24:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE(
|
|
|
|
mca_pml_dr_comm_t,
|
|
|
|
opal_object_t,
|
|
|
|
mca_pml_dr_comm_construct,
|
|
|
|
mca_pml_dr_comm_destruct);
|
|
|
|
|
|
|
|
|
2005-12-21 00:42:58 +03:00
|
|
|
int mca_pml_dr_comm_init(mca_pml_dr_comm_t* dr_comm, ompi_communicator_t* ompi_comm)
|
2005-11-22 20:24:47 +03:00
|
|
|
{
|
|
|
|
size_t i;
|
2005-12-21 00:42:58 +03:00
|
|
|
size_t size = ompi_comm->c_remote_group->grp_proc_count;
|
2006-03-29 20:19:17 +04:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* send message sequence-number support - sender side */
|
2006-08-24 20:38:08 +04:00
|
|
|
dr_comm->procs = (mca_pml_dr_comm_proc_t*)malloc(sizeof(mca_pml_dr_comm_proc_t)*size);
|
2005-12-21 00:42:58 +03:00
|
|
|
if(NULL == dr_comm->procs) {
|
2005-11-22 20:24:47 +03:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
for(i=0; i<size; i++) {
|
2006-03-29 20:19:17 +04:00
|
|
|
mca_pml_dr_comm_proc_t* proc;
|
2006-07-04 05:20:20 +04:00
|
|
|
mca_pml_dr_endpoint_t* pml_ep;
|
2006-03-29 20:19:17 +04:00
|
|
|
ompi_proc_t* ompi_proc;
|
|
|
|
proc = dr_comm->procs+i;
|
|
|
|
OBJ_CONSTRUCT(proc, mca_pml_dr_comm_proc_t);
|
|
|
|
proc->comm_rank = i;
|
2007-08-04 04:41:26 +04:00
|
|
|
ompi_proc = ompi_group_peer_lookup(ompi_comm->c_remote_group,i);
|
2006-03-29 20:19:17 +04:00
|
|
|
proc->ompi_proc = ompi_proc;
|
2006-07-04 05:20:20 +04:00
|
|
|
pml_ep = (mca_pml_dr_endpoint_t*) ompi_proc->proc_pml;
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&dr_comm->sparse_procs,
|
2006-07-04 05:20:20 +04:00
|
|
|
pml_ep->dst, /* from our view this is the
|
2006-03-29 20:19:17 +04:00
|
|
|
peers source 'global rank' */
|
|
|
|
proc);
|
2006-07-04 05:20:20 +04:00
|
|
|
proc->pml_endpoint = pml_ep;
|
|
|
|
proc->bml_endpoint = ompi_proc->proc_bml;
|
2005-11-22 20:24:47 +03:00
|
|
|
}
|
2005-12-21 00:42:58 +03:00
|
|
|
dr_comm->num_procs = size;
|
2005-11-22 20:24:47 +03:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|