2005-05-24 02:06:50 +04: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.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*/
|
2005-05-24 02:22:20 +04:00
|
|
|
#ifndef OMPI_PML_OB1_SEND_REQUEST_H
|
|
|
|
#define OMPI_PML_OB1_SEND_REQUEST_H
|
2005-05-24 02:06:50 +04:00
|
|
|
|
|
|
|
#include "mca/bmi/bmi.h"
|
|
|
|
#include "mca/pml/base/pml_base_sendreq.h"
|
2005-06-22 00:58:24 +04:00
|
|
|
#include "mca/mpool/base/base.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
#include "pml_ob1_proc.h"
|
|
|
|
#include "pml_ob1_comm.h"
|
2005-06-01 18:34:22 +04:00
|
|
|
#include "pml_ob1_hdr.h"
|
2005-06-08 23:10:15 +04:00
|
|
|
#include "datatype/convertor.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
|
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2005-06-01 18:34:22 +04:00
|
|
|
typedef enum {
|
|
|
|
MCA_PML_OB1_SR_INIT,
|
2005-06-02 01:09:43 +04:00
|
|
|
MCA_PML_OB1_SR_START,
|
2005-06-09 07:11:51 +04:00
|
|
|
MCA_PML_OB1_SR_ACKED,
|
2005-06-01 18:34:22 +04:00
|
|
|
MCA_PML_OB1_SR_COMPLETE
|
|
|
|
} mca_pml_ob1_send_request_state_t;
|
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
|
|
|
|
struct mca_pml_ob1_send_request_t {
|
|
|
|
mca_pml_base_send_request_t req_send;
|
|
|
|
mca_pml_ob1_proc_t* req_proc;
|
|
|
|
mca_pml_ob1_endpoint_t* req_endpoint;
|
2005-06-01 18:34:22 +04:00
|
|
|
mca_pml_ob1_send_request_state_t req_state;
|
2005-06-22 00:58:24 +04:00
|
|
|
struct mca_mpool_base_chunk_t* req_chunk;
|
2005-06-02 01:09:43 +04:00
|
|
|
ompi_ptr_t req_recv;
|
2005-06-01 18:34:22 +04:00
|
|
|
int32_t req_lock;
|
2005-06-09 07:11:51 +04:00
|
|
|
size_t req_pipeline_depth;
|
2005-06-09 00:37:19 +04:00
|
|
|
size_t req_bytes_delivered;
|
|
|
|
size_t req_send_offset;
|
|
|
|
size_t req_rdma_offset;
|
2005-06-17 22:25:44 +04:00
|
|
|
|
|
|
|
#if MCA_PML_OB1_TIMESTAMPS
|
|
|
|
unsigned long long t_start;
|
|
|
|
unsigned long long t_send1;
|
|
|
|
unsigned long long t_send2;
|
|
|
|
unsigned long long t_scheduled;
|
|
|
|
unsigned long long t_pin[MCA_PML_OB1_NUM_TSTAMPS];
|
|
|
|
unsigned long long t_put[MCA_PML_OB1_NUM_TSTAMPS];
|
|
|
|
unsigned long long t_fin[MCA_PML_OB1_NUM_TSTAMPS];
|
|
|
|
int t_pin_index;
|
|
|
|
int t_put_index;
|
|
|
|
int t_fin_index;
|
|
|
|
#endif
|
2005-05-24 02:06:50 +04:00
|
|
|
};
|
|
|
|
typedef struct mca_pml_ob1_send_request_t mca_pml_ob1_send_request_t;
|
|
|
|
|
|
|
|
|
|
|
|
OBJ_CLASS_DECLARATION(mca_pml_ob1_send_request_t);
|
|
|
|
|
|
|
|
|
2005-06-01 18:34:22 +04:00
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_ALLOC( \
|
2005-05-24 02:06:50 +04:00
|
|
|
comm, \
|
|
|
|
dst, \
|
|
|
|
sendreq, \
|
|
|
|
rc) \
|
|
|
|
{ \
|
2005-06-01 18:34:22 +04:00
|
|
|
mca_pml_ob1_proc_t *proc = comm->c_pml_procs[dst]; \
|
2005-05-24 02:06:50 +04:00
|
|
|
ompi_list_item_t* item; \
|
|
|
|
\
|
|
|
|
if(NULL == proc) { \
|
|
|
|
rc = OMPI_ERR_OUT_OF_RESOURCE; \
|
|
|
|
} else { \
|
|
|
|
rc = OMPI_SUCCESS; \
|
2005-06-01 18:34:22 +04:00
|
|
|
OMPI_FREE_LIST_WAIT(&mca_pml_ob1.send_requests, item, rc); \
|
|
|
|
sendreq = (mca_pml_ob1_send_request_t*)item; \
|
2005-05-24 02:06:50 +04:00
|
|
|
sendreq->req_proc = proc; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-01 18:34:22 +04:00
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_INIT( \
|
2005-05-24 02:06:50 +04:00
|
|
|
sendreq, \
|
|
|
|
buf, \
|
|
|
|
count, \
|
|
|
|
datatype, \
|
|
|
|
dst, \
|
|
|
|
tag, \
|
|
|
|
comm, \
|
|
|
|
sendmode, \
|
|
|
|
persistent) \
|
|
|
|
{ \
|
2005-06-02 01:09:43 +04:00
|
|
|
sendreq->req_state = MCA_PML_OB1_SR_INIT; \
|
2005-05-24 02:06:50 +04:00
|
|
|
MCA_PML_BASE_SEND_REQUEST_INIT(&sendreq->req_send, \
|
|
|
|
buf, \
|
|
|
|
count, \
|
|
|
|
datatype, \
|
|
|
|
dst, \
|
|
|
|
tag, \
|
|
|
|
comm, \
|
|
|
|
sendmode, \
|
|
|
|
persistent); \
|
|
|
|
}
|
|
|
|
|
2005-06-17 22:25:44 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Diagnostic output to trace rdma protocol timing
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if MCA_PML_OB1_TIMESTAMPS
|
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_TSTAMPS_DUMP(sendreq) \
|
|
|
|
{ \
|
|
|
|
int i; \
|
|
|
|
ompi_output(0, "[%d,%d,%d] src start, %llu\n", \
|
|
|
|
ORTE_NAME_ARGS(orte_process_info.my_name), (sendreq)->t_start); \
|
|
|
|
\
|
|
|
|
ompi_output(0, "[%d,%d,%d] src send start, %llu\n", \
|
|
|
|
ORTE_NAME_ARGS(orte_process_info.my_name), (sendreq)->t_send1); \
|
|
|
|
\
|
|
|
|
ompi_output(0, "[%d,%d,%d] src scheduled, %llu\n", \
|
|
|
|
ORTE_NAME_ARGS(orte_process_info.my_name), (sendreq)->t_scheduled); \
|
|
|
|
\
|
|
|
|
ompi_output(0, "[%d,%d,%d] src send complete, %llu\n", \
|
|
|
|
ORTE_NAME_ARGS(orte_process_info.my_name), (sendreq)->t_send2); \
|
|
|
|
\
|
|
|
|
for(i=0; i<(sendreq)->t_pin_index; i++) \
|
|
|
|
ompi_output(0, "[%d,%d,%d] src pin, %llu %llu\n", \
|
|
|
|
ORTE_NAME_ARGS(orte_process_info.my_name), (sendreq)->t_pin[i], \
|
|
|
|
(sendreq)->t_put[i] - (sendreq)->t_pin[i]); \
|
|
|
|
for(i=0; i<(sendreq)->t_put_index; i++) \
|
|
|
|
ompi_output(0, "[%d,%d,%d] src put, %llu %llu\n", \
|
|
|
|
ORTE_NAME_ARGS(orte_process_info.my_name), (sendreq)->t_put[i], \
|
|
|
|
(sendreq)->t_fin[i] - (sendreq)->t_put[i]); \
|
|
|
|
for(i=0; i<(sendreq)->t_fin_index; i++) \
|
|
|
|
ompi_output(0, "[%d,%d,%d] src fin, %llu\n", \
|
|
|
|
ORTE_NAME_ARGS(orte_process_info.my_name), (sendreq)->t_fin[i]); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_TSTAMPS_INIT(sendreq) \
|
|
|
|
{ \
|
|
|
|
sendreq->t_pin_index = 0; \
|
|
|
|
sendreq->t_put_index = 0; \
|
|
|
|
sendreq->t_fin_index = 0; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_TSTAMPS_DUMP(sendreq)
|
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_TSTAMPS_INIT(sendreq)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
/**
|
|
|
|
* Start a send request.
|
|
|
|
*/
|
|
|
|
|
2005-06-01 18:34:22 +04:00
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_START(sendreq, rc) \
|
2005-05-24 02:06:50 +04:00
|
|
|
{ \
|
2005-06-01 18:34:22 +04:00
|
|
|
mca_pml_ob1_endpoint_t* endpoint; \
|
|
|
|
mca_pml_ob1_proc_t* proc = sendreq->req_proc; \
|
2005-05-24 02:06:50 +04:00
|
|
|
\
|
|
|
|
/* select next endpoint */ \
|
2005-06-09 00:37:19 +04:00
|
|
|
endpoint = mca_pml_ob1_ep_array_get_next(&proc->bmi_eager); \
|
2005-06-02 23:36:35 +04:00
|
|
|
sendreq->req_lock = 0; \
|
2005-06-17 22:25:44 +04:00
|
|
|
MCA_PML_OB1_SEND_REQUEST_TSTAMPS_INIT(sendreq); \
|
2005-06-09 07:11:51 +04:00
|
|
|
sendreq->req_pipeline_depth = 0; \
|
2005-06-09 00:37:19 +04:00
|
|
|
sendreq->req_bytes_delivered = 0; \
|
2005-06-22 00:58:24 +04:00
|
|
|
sendreq->req_chunk = NULL; \
|
2005-06-09 00:37:19 +04:00
|
|
|
sendreq->req_send_offset = 0; \
|
2005-06-02 01:09:43 +04:00
|
|
|
sendreq->req_state = MCA_PML_OB1_SR_START; \
|
2005-05-24 02:06:50 +04:00
|
|
|
sendreq->req_send.req_base.req_ompi.req_complete = false; \
|
|
|
|
sendreq->req_send.req_base.req_ompi.req_state = OMPI_REQUEST_ACTIVE; \
|
|
|
|
sendreq->req_send.req_base.req_sequence = OMPI_THREAD_ADD32(&proc->proc_sequence,1); \
|
|
|
|
sendreq->req_endpoint = endpoint; \
|
|
|
|
\
|
|
|
|
/* handle buffered send */ \
|
|
|
|
if(sendreq->req_send.req_send_mode == MCA_PML_BASE_SEND_BUFFERED) { \
|
|
|
|
mca_pml_base_bsend_request_start(&sendreq->req_send.req_base.req_ompi); \
|
|
|
|
} \
|
2005-06-09 00:37:19 +04:00
|
|
|
rc = mca_pml_ob1_send_request_start(sendreq, endpoint); \
|
2005-05-24 02:06:50 +04:00
|
|
|
}
|
|
|
|
|
2005-06-17 22:25:44 +04:00
|
|
|
|
2005-06-10 00:16:33 +04:00
|
|
|
/*
|
|
|
|
* Complete a send request
|
|
|
|
*/
|
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_COMPLETE(sendreq) \
|
|
|
|
{ \
|
|
|
|
(sendreq)->req_send.req_base.req_pml_complete = true; \
|
|
|
|
if ((sendreq)->req_send.req_base.req_ompi.req_complete == false) { \
|
|
|
|
(sendreq)->req_send.req_base.req_ompi.req_status.MPI_SOURCE = \
|
|
|
|
(sendreq)->req_send.req_base.req_comm->c_my_rank; \
|
|
|
|
(sendreq)->req_send.req_base.req_ompi.req_status.MPI_TAG = \
|
|
|
|
(sendreq)->req_send.req_base.req_tag; \
|
|
|
|
(sendreq)->req_send.req_base.req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS; \
|
|
|
|
(sendreq)->req_send.req_base.req_ompi.req_status._count = \
|
|
|
|
(sendreq)->req_send.req_bytes_packed; \
|
|
|
|
(sendreq)->req_send.req_base.req_ompi.req_complete = true; \
|
|
|
|
(sendreq)->req_state = MCA_PML_OB1_SR_COMPLETE; \
|
2005-06-17 22:25:44 +04:00
|
|
|
MCA_PML_OB1_SEND_REQUEST_TSTAMPS_DUMP(sendreq); \
|
2005-06-10 00:16:33 +04:00
|
|
|
if(ompi_request_waiting) { \
|
|
|
|
ompi_condition_broadcast(&ompi_request_cond); \
|
|
|
|
} \
|
2005-06-17 22:25:44 +04:00
|
|
|
} else if((sendreq)->req_send.req_base.req_free_called) { \
|
2005-06-10 00:16:33 +04:00
|
|
|
MCA_PML_OB1_FREE((ompi_request_t**)&sendreq); \
|
2005-06-17 22:25:44 +04:00
|
|
|
} else if ((sendreq)->req_send.req_send_mode == MCA_PML_BASE_SEND_BUFFERED) { \
|
2005-06-10 00:16:33 +04:00
|
|
|
mca_pml_base_bsend_request_fini((ompi_request_t*)sendreq); \
|
|
|
|
sendreq->req_state = MCA_PML_OB1_SR_COMPLETE; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2005-06-01 18:34:22 +04:00
|
|
|
/*
|
|
|
|
* Advance a request
|
|
|
|
*/
|
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2005-06-01 18:34:22 +04:00
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_RETURN(sendreq) \
|
2005-05-24 02:06:50 +04:00
|
|
|
{ \
|
|
|
|
/* Let the base handle the reference counts */ \
|
|
|
|
MCA_PML_BASE_SEND_REQUEST_FINI((&sendreq->req_send)); \
|
|
|
|
OMPI_FREE_LIST_RETURN( \
|
2005-06-01 18:34:22 +04:00
|
|
|
&mca_pml_ob1.send_requests, (ompi_list_item_t*)sendreq); \
|
2005-05-24 02:06:50 +04:00
|
|
|
}
|
|
|
|
|
2005-06-01 18:34:22 +04:00
|
|
|
/**
|
2005-06-09 00:37:19 +04:00
|
|
|
*
|
2005-06-01 18:34:22 +04:00
|
|
|
*/
|
|
|
|
|
2005-06-09 00:37:19 +04:00
|
|
|
int mca_pml_ob1_send_request_start(
|
2005-06-01 18:34:22 +04:00
|
|
|
mca_pml_ob1_send_request_t* sendreq,
|
|
|
|
mca_pml_ob1_endpoint_t* endpoint);
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2005-06-02 01:09:43 +04:00
|
|
|
int mca_pml_ob1_send_request_schedule(
|
2005-06-01 18:34:22 +04:00
|
|
|
mca_pml_ob1_send_request_t* sendreq);
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2005-06-09 07:11:51 +04:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2005-06-10 00:16:33 +04:00
|
|
|
void mca_pml_ob1_send_request_put(
|
|
|
|
mca_pml_ob1_send_request_t* sendreq,
|
|
|
|
mca_bmi_base_module_t* bmi,
|
|
|
|
mca_pml_ob1_rdma_hdr_t* hdr);
|
2005-06-09 07:11:51 +04:00
|
|
|
|
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|