2004-02-10 00:09:36 +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.
|
2004-11-28 20:09:25 +00:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 12:43:37 +00:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 01:38:40 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-02-10 00:09:36 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-10-20 01:03:09 +00:00
|
|
|
#include "ompi_config.h"
|
2004-03-19 14:08:34 +00:00
|
|
|
#include <string.h>
|
2005-04-13 03:19:48 +00:00
|
|
|
|
|
|
|
#include "mca/pml/pml.h"
|
2005-01-25 20:01:06 +00:00
|
|
|
#include "mca/ptl/base/ptl_base_comm.h"
|
2004-01-14 15:57:54 +00:00
|
|
|
|
2004-03-18 14:05:32 +00:00
|
|
|
static void mca_pml_ptl_comm_construct(mca_pml_ptl_comm_t* comm);
|
|
|
|
static void mca_pml_ptl_comm_destruct(mca_pml_ptl_comm_t* comm);
|
2004-02-04 17:11:57 +00:00
|
|
|
|
|
|
|
|
2005-07-03 16:06:07 +00:00
|
|
|
opal_class_t mca_pml_ptl_comm_t_class = {
|
2004-03-18 14:05:32 +00:00
|
|
|
"mca_pml_ptl_comm_t",
|
2005-07-03 16:06:07 +00:00
|
|
|
OBJ_CLASS(opal_object_t),
|
|
|
|
(opal_construct_t)mca_pml_ptl_comm_construct,
|
|
|
|
(opal_destruct_t)mca_pml_ptl_comm_destruct
|
2004-01-28 23:47:02 +00:00
|
|
|
};
|
2004-02-10 00:09:36 +00:00
|
|
|
|
2004-02-10 14:04:27 +00:00
|
|
|
|
2004-03-18 14:05:32 +00:00
|
|
|
static void mca_pml_ptl_comm_construct(mca_pml_ptl_comm_t* comm)
|
2004-01-28 23:47:02 +00:00
|
|
|
{
|
2005-07-03 16:22:16 +00:00
|
|
|
OBJ_CONSTRUCT(&comm->c_wild_receives, opal_list_t);
|
2005-07-03 22:45:48 +00:00
|
|
|
OBJ_CONSTRUCT(&comm->c_matching_lock, opal_mutex_t);
|
2004-03-31 17:00:38 +00:00
|
|
|
comm->c_recv_seq = 0;
|
2004-01-28 23:47:02 +00:00
|
|
|
}
|
2004-01-14 15:57:54 +00:00
|
|
|
|
2004-03-26 14:15:20 +00:00
|
|
|
|
2004-03-18 14:05:32 +00:00
|
|
|
static void mca_pml_ptl_comm_destruct(mca_pml_ptl_comm_t* comm)
|
2004-01-14 15:57:54 +00:00
|
|
|
{
|
2004-02-10 00:09:36 +00:00
|
|
|
free(comm->c_msg_seq);
|
|
|
|
free(comm->c_next_msg_seq);
|
|
|
|
free(comm->c_unexpected_frags);
|
|
|
|
free(comm->c_frags_cant_match);
|
|
|
|
free(comm->c_specific_receives);
|
2004-02-10 16:53:41 +00:00
|
|
|
OBJ_DESTRUCT(&comm->c_wild_receives);
|
2004-03-31 17:00:38 +00:00
|
|
|
OBJ_DESTRUCT(&comm->c_matching_lock);
|
2004-01-14 15:57:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-18 14:05:32 +00:00
|
|
|
int mca_pml_ptl_comm_init_size(mca_pml_ptl_comm_t* comm, size_t size)
|
2004-01-14 15:57:54 +00:00
|
|
|
{
|
2004-01-28 23:47:02 +00:00
|
|
|
size_t i;
|
|
|
|
|
|
|
|
/* send message sequence-number support - sender side */
|
2004-12-02 21:47:40 +00:00
|
|
|
comm->c_msg_seq = malloc(sizeof(uint32_t) * size);
|
2004-01-28 23:47:02 +00:00
|
|
|
if(NULL == comm->c_msg_seq)
|
2004-06-07 15:33:53 +00:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2004-12-02 21:47:40 +00:00
|
|
|
memset(comm->c_msg_seq, 0, sizeof(uint32_t) * size);
|
2004-01-28 23:47:02 +00:00
|
|
|
|
|
|
|
/* send message sequence-number support - receiver side */
|
2004-12-02 21:47:40 +00:00
|
|
|
comm->c_next_msg_seq = malloc(sizeof(uint16_t) * size);
|
2004-01-28 23:47:02 +00:00
|
|
|
if(NULL == comm->c_next_msg_seq)
|
2004-06-07 15:33:53 +00:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2004-12-02 21:47:40 +00:00
|
|
|
memset(comm->c_next_msg_seq, 0, sizeof(uint16_t) * size);
|
2004-01-28 23:47:02 +00:00
|
|
|
|
|
|
|
/* unexpected fragments queues */
|
2005-07-03 16:22:16 +00:00
|
|
|
comm->c_unexpected_frags = malloc(sizeof(opal_list_t) * size);
|
2004-01-29 23:50:31 +00:00
|
|
|
if(NULL == comm->c_unexpected_frags)
|
2004-06-07 15:33:53 +00:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2004-03-11 22:02:01 +00:00
|
|
|
for(i=0; i<size; i++) {
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_t* object = comm->c_unexpected_frags+i;
|
|
|
|
OBJ_CONSTRUCT(object, opal_list_t);
|
2004-03-11 22:02:01 +00:00
|
|
|
}
|
2004-01-28 23:47:02 +00:00
|
|
|
|
|
|
|
/* out-of-order fragments queues */
|
2005-07-03 16:22:16 +00:00
|
|
|
comm->c_frags_cant_match = malloc(sizeof(opal_list_t) * size);
|
2004-01-29 23:50:31 +00:00
|
|
|
if(NULL == comm->c_frags_cant_match)
|
2004-06-07 15:33:53 +00:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2004-03-11 22:02:01 +00:00
|
|
|
for(i=0; i<size; i++) {
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_t* object = comm->c_frags_cant_match+i;
|
|
|
|
OBJ_CONSTRUCT(object, opal_list_t);
|
2004-03-11 22:02:01 +00:00
|
|
|
}
|
2004-01-28 23:47:02 +00:00
|
|
|
|
|
|
|
/* queues of unmatched specific (source process specified) receives */
|
2005-07-03 16:22:16 +00:00
|
|
|
comm->c_specific_receives = malloc(sizeof(opal_list_t) * size);
|
2004-01-29 23:50:31 +00:00
|
|
|
if(NULL == comm->c_specific_receives)
|
2004-06-07 15:33:53 +00:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2004-03-11 22:02:01 +00:00
|
|
|
for(i=0; i<size; i++) {
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_t *object = comm->c_specific_receives+i;
|
|
|
|
OBJ_CONSTRUCT(object, opal_list_t);
|
2004-03-11 22:02:01 +00:00
|
|
|
}
|
2004-06-07 15:33:53 +00:00
|
|
|
return OMPI_SUCCESS;
|
2004-01-14 15:57:54 +00:00
|
|
|
}
|
|
|
|
|
2004-01-28 23:47:02 +00:00
|
|
|
|