mpid_rma_types.h 4.13 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
 *  (C) 2001 by Argonne National Laboratory.
 *      See COPYRIGHT in top-level directory.
 */

#if !defined(MPID_RMA_TYPES_H_INCLUDED)
#define MPID_RMA_TYPES_H_INCLUDED

#include "mpidi_ch3_impl.h"

/* Special case RMA operations */

enum MPIDI_RMA_Datatype {
    MPIDI_RMA_DATATYPE_BASIC = 50,
    MPIDI_RMA_DATATYPE_DERIVED = 51
};

19
#define MPID_LOCK_NONE 60
20

21 22 23 24 25
/*
 * RMA Declarations.  We should move these into something separate from
 * a Request.
 */

26 27 28 29 30
typedef enum MPIDI_RMA_Pool_type {
    MPIDI_RMA_POOL_WIN = 6,
    MPIDI_RMA_POOL_GLOBAL = 7
} MPIDI_RMA_Pool_type_t;

31 32 33
/* for keeping track of RMA ops, which will be executed at the next sync call */
typedef struct MPIDI_RMA_Op {
    struct MPIDI_RMA_Op *next;  /* pointer to next element in list */
34

35 36 37
    void *origin_addr;
    int origin_count;
    MPI_Datatype origin_datatype;
38 39 40 41

    void *compare_addr;
    MPI_Datatype compare_datatype;

42 43 44
    void *result_addr;
    int result_count;
    MPI_Datatype result_datatype;
45

46 47 48 49 50
    struct MPID_Request *single_req;    /* used for unstreamed RMA ops */
    struct MPID_Request **multi_reqs;   /* used for streamed RMA ops */
    MPI_Aint reqs_size;         /* when reqs_size == 0, neither single_req nor multi_reqs is used;
                                 * when reqs_size == 1, single_req is used;
                                 * when reqs_size > 1, multi_reqs is used. */
51

52 53 54
    int target_rank;

    MPIDI_CH3_Pkt_t pkt;
55
    MPIDI_RMA_Pool_type_t pool_type;
56
    int piggyback_lock_candidate;
57

58 59 60
    int issued_stream_count;    /* when >= 0, it specifies number of stream units that have been issued;
                                 * when < 0, it means all stream units of this operation haven been issued. */

61
    MPID_Request *ureq;
62 63
} MPIDI_RMA_Op_t;

64
typedef struct MPIDI_RMA_Target {
65 66 67
    struct MPIDI_RMA_Op *issued_read_op_list_head, *issued_read_op_list_tail;
    struct MPIDI_RMA_Op *issued_write_op_list_head, *issued_write_op_list_tail;
    struct MPIDI_RMA_Op *issued_dt_op_list_head, *issued_dt_op_list_tail;
68
    struct MPIDI_RMA_Op *pending_op_list_head, *pending_op_list_tail;
69 70 71
    struct MPIDI_RMA_Op *next_op_to_issue;
    struct MPIDI_RMA_Target *next;
    int target_rank;
72
    enum MPIDI_RMA_states access_state;
73
    int lock_type;              /* NONE, SHARED, EXCLUSIVE */
74
    int lock_mode;              /* e.g., MODE_NO_CHECK */
75
    int win_complete_flag;
76 77
    int put_acc_issued;         /* indicate if PUT/ACC is issued in this epoch
                                 * after the previous synchronization calls. */
78 79 80 81 82 83 84 85 86 87 88 89 90 91

    /* The target structure is free to be cleaned up when all of the
     * following conditions hold true:
     *   - No operations are queued up (op_list == NULL)
     *   - There are no outstanding acks (outstanding_acks == 0)
     *   - There are no sync messages to be sent (sync_flag == NONE)
     */
    struct {
        /* next synchronization flag to be sent to the target (either
         * piggybacked or as a separate packet */
        enum MPIDI_RMA_sync_types sync_flag;    /* UNLOCK, FLUSH or FLUSH_LOCAL */

        /* packets sent out that we are expecting an ack for */
        int outstanding_acks;
92 93 94

        /* Marked when FLUSH_LOCAL is upgraded to FLUSH */
        int upgrade_flush_local;
95 96 97 98 99
    } sync;

    MPIDI_RMA_Pool_type_t pool_type;
} MPIDI_RMA_Target_t;

Xin Zhao's avatar
Xin Zhao committed
100
typedef struct MPIDI_RMA_Slot {
101
    struct MPIDI_RMA_Target *target_list_head;
Xin Zhao's avatar
Xin Zhao committed
102 103 104
    struct MPIDI_RMA_Target *target_list_tail;
} MPIDI_RMA_Slot_t;

Xin Zhao's avatar
Xin Zhao committed
105 106 107 108 109 110 111
typedef struct MPIDI_RMA_Win_list {
    MPID_Win *win_ptr;
    struct MPIDI_RMA_Win_list *next;
} MPIDI_RMA_Win_list_t;

extern MPIDI_RMA_Win_list_t *MPIDI_RMA_Win_list, *MPIDI_RMA_Win_list_tail;

112 113
typedef struct MPIDI_RMA_Target_lock_entry {
    struct MPIDI_RMA_Target_lock_entry *next;
114
    MPIDI_CH3_Pkt_t pkt;        /* all information for this request packet */
115
    MPIDI_VC_t *vc;
116
    void *data;                 /* for queued PUTs / ACCs / GACCs, data is copied here */
117
    int buf_size;
118
    int all_data_recved;        /* indicate if all data has been received */
119
} MPIDI_RMA_Target_lock_entry_t;
120 121 122 123

typedef MPIDI_RMA_Op_t *MPIDI_RMA_Ops_list_t;

#endif /* MPID_RMA_TYPES_H_INCLUDED */