2004-03-26 14:15:20 +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-03-26 14:15:20 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*/
|
2004-01-14 03:44:11 +00:00
|
|
|
#ifndef MCA_PML_COMM_H
|
|
|
|
#define MCA_PML_COMM_H
|
|
|
|
|
2005-07-03 22:45:48 +00:00
|
|
|
#include "opal/threads/mutex.h"
|
|
|
|
#include "opal/threads/condition.h"
|
2004-03-17 18:45:16 +00:00
|
|
|
#include "mca/ptl/ptl.h"
|
2005-07-03 16:22:16 +00:00
|
|
|
#include "opal/class/opal_list.h"
|
2004-10-20 22:31:03 +00:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2005-07-03 16:06:07 +00:00
|
|
|
OMPI_DECLSPEC extern opal_class_t mca_pml_ptl_comm_t_class;
|
2004-01-14 03:44:11 +00:00
|
|
|
|
2004-03-26 14:15:20 +00:00
|
|
|
/**
|
2004-06-07 15:33:53 +00:00
|
|
|
* Cached on ompi_communicator_t to hold queues/state
|
2004-03-26 14:15:20 +00:00
|
|
|
* used by the PML<->PTL interface for matching logic.
|
|
|
|
*/
|
2004-01-14 03:44:11 +00:00
|
|
|
struct mca_pml_comm_t {
|
2005-07-03 16:06:07 +00:00
|
|
|
opal_object_t super;
|
2004-12-02 21:47:40 +00:00
|
|
|
uint32_t *c_msg_seq; /**< send message sequence number - sender side */
|
2004-11-17 22:47:08 +00:00
|
|
|
uint16_t *c_next_msg_seq; /**< send message sequence number - receiver side */
|
|
|
|
mca_ptl_sequence_t c_recv_seq; /**< recv request sequence number - receiver side */
|
2005-07-03 22:45:48 +00:00
|
|
|
opal_mutex_t c_matching_lock; /**< matching lock */
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_t *c_unexpected_frags; /**< unexpected fragment queues */
|
|
|
|
opal_list_t *c_frags_cant_match; /**< out-of-order fragment queues */
|
|
|
|
opal_list_t *c_specific_receives; /**< queues of unmatched specific (source process specified) receives */
|
|
|
|
opal_list_t c_wild_receives; /**< queue of unmatched wild (source process not specified) receives */
|
2004-01-14 03:44:11 +00:00
|
|
|
};
|
2004-03-18 14:05:32 +00:00
|
|
|
typedef struct mca_pml_comm_t mca_pml_ptl_comm_t;
|
2004-01-14 03:44:11 +00:00
|
|
|
|
|
|
|
|
2004-03-26 14:15:20 +00:00
|
|
|
/**
|
|
|
|
* Initialize an instance of mca_pml_ptl_comm_t based on the communicator size.
|
|
|
|
*
|
|
|
|
* @param comm Instance of mca_pml_ptl_comm_t
|
|
|
|
* @param size Size of communicator
|
2004-06-07 15:33:53 +00:00
|
|
|
* @return OMPI_SUCCESS or error status on failure.
|
2004-03-26 14:15:20 +00:00
|
|
|
*/
|
|
|
|
|
2004-10-22 16:06:05 +00:00
|
|
|
OMPI_DECLSPEC extern int mca_pml_ptl_comm_init_size(mca_pml_ptl_comm_t* comm, size_t size);
|
2004-03-26 14:15:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the next sequence number (MPI) for a given destination rank.
|
|
|
|
*
|
|
|
|
* @param comm Instance of mca_pml_ptl_comm_t
|
|
|
|
* @param dst Rank of destination.
|
|
|
|
* @return Next available sequence number.
|
|
|
|
*/
|
2004-03-11 22:02:01 +00:00
|
|
|
|
2004-12-02 21:47:40 +00:00
|
|
|
static inline mca_ptl_sequence_t mca_pml_ptl_comm_send_sequence(mca_pml_ptl_comm_t* comm, int dst)
|
2004-03-11 22:02:01 +00:00
|
|
|
{
|
2004-12-02 21:47:40 +00:00
|
|
|
volatile int32_t *msg_seq = (volatile int32_t*)(comm->c_msg_seq+dst);
|
2005-07-03 22:45:48 +00:00
|
|
|
return (mca_ptl_sequence_t)OPAL_THREAD_ADD32(msg_seq, 1)-1;
|
2004-03-11 22:02:01 +00:00
|
|
|
}
|
2004-01-14 15:57:54 +00:00
|
|
|
|
2004-10-20 22:31:03 +00:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
2004-01-14 03:44:11 +00:00
|
|
|
#endif
|
|
|
|
|