photon  1.1
photon_exchange.h
Go to the documentation of this file.
1 // =============================================================================
2 // Photon RDMA Library (libphoton)
3 //
4 // Copyright (c) 2016, Trustees of Indiana University,
5 // All rights reserved.
6 //
7 // This software may be modified and distributed under the terms of the BSD
8 // license. See the COPYING file for details.
9 //
10 // This software was created at the Indiana University Center for Research in
11 // Extreme Scale Technologies (CREST).
12 // =============================================================================
13 
14 #ifndef PHOTON_EXCHANGE_H
15 #define PHOTON_EXCHANGE_H
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #include "photon_backend.h"
22 #include "util.h"
23 
24 #define PHOTON_TPROC (_photon_nproc + _photon_nforw)
25 
26 #define PHOTON_INFO_SSIZE(c) (c * sizeof(struct photon_ri_ledger_entry_t) + sizeof(struct photon_ri_ledger_t))
27 #define PHOTON_LEDG_SSIZE(c, s) (c * ALIGN(s,8) + sizeof(struct photon_rdma_ledger_t))
28 #define PHOTON_EBUF_SSIZE(c) (c + sizeof(struct photon_rdma_eager_buf_t))
29 
30 #define PHOTON_INFO_SIZE (PHOTON_INFO_SSIZE(_LEDGER_SIZE))
31 #define PHOTON_LEDG_SIZE (PHOTON_LEDG_SSIZE(_LEDGER_SIZE, sizeof(struct photon_rdma_ledger_entry_t)))
32 #define PHOTON_PEDG_SIZE (PHOTON_LEDG_SSIZE(_LEDGER_SIZE, PHOTON_CID_ENTRY_SIZE))
33 #define PHOTON_RPEDG_SIZE (PHOTON_LEDG_SSIZE(_LEDGER_SIZE, PHOTON_CID_RECV_ENTRY_SIZE))
34 #define PHOTON_EBUF_SIZE (PHOTON_EBUF_SSIZE(_photon_ebsize))
35 #define PHOTON_PBUF_SIZE (PHOTON_EBUF_SSIZE(_photon_pbsize))
36 
37 #define PHOTON_NP_INFO_SIZE (PHOTON_TPROC * PHOTON_INFO_SIZE)
38 #define PHOTON_NP_LEDG_SIZE (PHOTON_TPROC * PHOTON_LEDG_SIZE)
39 #define PHOTON_NP_PEDG_SIZE (PHOTON_TPROC * PHOTON_PEDG_SIZE)
40 #define PHOTON_NP_RPEDG_SIZE (PHOTON_TPROC * PHOTON_RPEDG_SIZE)
41 #define PHOTON_NP_EBUF_SIZE (PHOTON_TPROC * PHOTON_EBUF_SIZE)
42 #define PHOTON_NP_PBUF_SIZE (PHOTON_TPROC * PHOTON_PBUF_SIZE)
43 
44 // The ledger buffer (shared_storage) is laid out as follows:
45 // | local_rcv | remote_rcv | local_snd | remote_snd | local_fin | remote_fin |
46 // | local_pwc | remote_pwc | local_eager | remote_eager | local_eager_bufs | remote_eager_bufs |
47 // | local_pwc_bufs | remote_pwc_bufs |
48 
49 // accounting structs are now included at the end of each buffer
50 
51 #define PHOTON_LRI_PTR(a) (a)
52 #define PHOTON_RRI_PTR(a) (a + PHOTON_NP_INFO_SIZE)
53 #define PHOTON_LSI_PTR(a) (a + PHOTON_NP_INFO_SIZE * 2)
54 #define PHOTON_RSI_PTR(a) (a + PHOTON_NP_INFO_SIZE * 3)
55 #define PHOTON_LF_PTR(a) (a + PHOTON_NP_INFO_SIZE * 4)
56 #define PHOTON_RF_PTR(a) (PHOTON_LF_PTR(a) + PHOTON_NP_LEDG_SIZE)
57 #define PHOTON_LP_PTR(a) (PHOTON_LF_PTR(a) + PHOTON_NP_LEDG_SIZE * 2)
58 #define PHOTON_RP_PTR(a) (PHOTON_LP_PTR(a) + PHOTON_NP_RPEDG_SIZE)
59 #define PHOTON_LE_PTR(a) (PHOTON_LP_PTR(a) + PHOTON_NP_RPEDG_SIZE + PHOTON_NP_PEDG_SIZE)
60 #define PHOTON_RE_PTR(a) (PHOTON_LE_PTR(a) + PHOTON_NP_LEDG_SIZE)
61 #define PHOTON_LEB_PTR(a) (PHOTON_LE_PTR(a) + PHOTON_NP_LEDG_SIZE * 2)
62 #define PHOTON_REB_PTR(a) (PHOTON_LEB_PTR(a) + PHOTON_NP_EBUF_SIZE)
63 #define PHOTON_LPB_PTR(a) (PHOTON_LEB_PTR(a) + PHOTON_NP_EBUF_SIZE * 2)
64 #define PHOTON_RPB_PTR(a) (PHOTON_LPB_PTR(a) + PHOTON_NP_PBUF_SIZE)
65 
66 int photon_exchange_init(photonConfig lcfg, photonConfig cfg);
67 int photon_exchange_finalize(photonConfig lcfg);
68 int photon_exchange_allgather(void *s, void *d, int n);
70 int photon_exchange_ledgers(ProcessInfo *processes, int flags);
71 int photon_setup_ri_ledger(ProcessInfo *processes, char *buf, int num_entries);
72 int photon_setup_eager_ledger(ProcessInfo *processes, char *buf, int num_entries);
73 int photon_setup_fin_ledger(ProcessInfo *processes, char *buf, int num_entries);
74 int photon_setup_pwc_ledger(ProcessInfo *processes, char *buf, int num_entries);
75 int photon_setup_eager_buf(ProcessInfo *processes, char *buf, int num_entries);
76 int photon_setup_pwc_buf(ProcessInfo *processes, char *buf, int num_entries);
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif
int photon_exchange_barrier()
int photon_setup_pwc_ledger(ProcessInfo *processes, char *buf, int num_entries)
int photon_setup_eager_buf(ProcessInfo *processes, char *buf, int num_entries)
int photon_exchange_allgather(void *s, void *d, int n)
int photon_exchange_ledgers(ProcessInfo *processes, int flags)
int photon_setup_eager_ledger(ProcessInfo *processes, char *buf, int num_entries)
int photon_exchange_finalize(photonConfig lcfg)
int photon_setup_fin_ledger(ProcessInfo *processes, char *buf, int num_entries)
int photon_exchange_init(photonConfig lcfg, photonConfig cfg)
int photon_setup_ri_ledger(ProcessInfo *processes, char *buf, int num_entries)
int photon_setup_pwc_buf(ProcessInfo *processes, char *buf, int num_entries)