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