22 #include "photon_forwarder.h" 27 #include "photon_shmem_posix.h" 28 #include "photon_shmem_cma.h" 36 #include "photon_ugni.h" 40 #include "photon_fi.h" 66 #if defined(ENABLE_DEBUG) || defined(ENABLE_CALLTRACE) 67 int _photon_start_debugging = 1;
70 #if defined(ENABLE_CALLTRACE) 92 photonBackend be = NULL;
93 photonConfig lcfg = NULL;
98 log_warn(
"Photon already initialized");
104 log_warn(
"Photon fabric backend is still initializing");
111 log_err(
"Could not allocate space for internal config!");
116 if (cfg->ibv.eth_dev)
117 lcfg->ibv.eth_dev = strdup(cfg->ibv.eth_dev);
119 lcfg->ibv.ib_dev = strdup(cfg->ibv.ib_dev);
120 if (cfg->ibv.ud_gid_prefix)
121 lcfg->ibv.ud_gid_prefix = strdup(cfg->ibv.ud_gid_prefix);
123 lcfg->fi.eth_dev = strdup(cfg->fi.eth_dev);
124 if (cfg->fi.provider)
125 lcfg->fi.provider = strdup(cfg->fi.provider);
127 lcfg->fi.node = strdup(cfg->fi.node);
129 lcfg->fi.domain = strdup(cfg->fi.domain);
131 lcfg->fi.service = strdup(cfg->fi.service);
148 one_debug(
"Photon initializing");
150 switch (lcfg->backend) {
157 errmsg =
"IB Verbs backend";
168 errmsg =
"uGNI backend";
175 #ifdef HAVE_LIBFABRIC 179 errmsg =
"libfabric backend";
199 one_debug(
"No network fabric detected, using shared memory only");
201 errmsg =
"network fabric backend";
204 one_debug(
"Photon configured with %s backend", PHOTON_BACKEND_TO_STRING[lcfg->backend]);
209 switch (lcfg->meta_exch) {
212 errmsg =
"MPI exchange";
218 errmsg =
"PMI exchange";
224 errmsg =
"XSP exchange";
229 if ((lcfg->exch.allgather == NULL) ||
230 (lcfg->exch.barrier == NULL)) {
231 errmsg =
"External exchange function (see config)";
234 assert(lcfg->exch.allgather);
235 assert(lcfg->exch.barrier);
239 errmsg =
"unknown exchange";
245 #ifdef HAVE_SHMEM_CMA 247 #elif HAVE_SHMEM_POSIX 250 errmsg =
"shmem backend";
271 if (lcfg->cap.max_rd < 0)
273 if (lcfg->cap.default_rd <= 0)
275 if (lcfg->cap.num_cq <= 0)
277 if (lcfg->cap.use_rcq < 0)
286 (lcfg->cap.use_rcq <= 0)) {
287 lcfg->cap.use_rcq = 1;
288 one_debug(
"Enabling remote completion support for %s backend",
289 PHOTON_BACKEND_TO_STRING[lcfg->backend]);
294 one_warn(
"Requesting (num_cq > nproc), setting num_cq to nproc");
306 if (lcfg->forwarder.use_forwarder) {
309 if ((
int)lcfg->address >= lcfg->nproc) {
323 log_warn(
"Photon was built without forwarder support!");
331 log_err(
"photon_init(): %s support not present", errmsg);
341 dbg_err(
"Error in backend cancel");
353 log_err(
"Error in backend finalize");
478 #ifdef PHOTON_MULTITHREADED 489 #ifdef PHOTON_MULTITHREADED 512 int photon_recv(uint64_t request,
void *ptr, uint64_t size,
int flags) {
int _photon_get_with_completion(int proc, uint64_t size, photonBuffer lbuf, photonBuffer rbuf, photon_cid local, photon_cid remote, int flags, pwc_cid_type type, pwc_command cmd)
int _photon_post_send_request_rdma(int proc, uint64_t size, int tag, photon_rid *request)
int _photon_collective_join(photon_rid request, void *in, void *out, int scount, int rcount, photonDatatype stype, photonDatatype rtype, int root, void *op)
int photon_recv(uint64_t request, void *ptr, uint64_t size, int flags)
photon_datatype_t photonDatatype
#define PHOTON_EXCH_PMI
Use PMI for metadata exchange.
int _photon_send(photonAddr addr, void *ptr, uint64_t size, int flags, photon_rid *request)
The Photon completion ID used by the PWC API.
int photon_io_init(char *file, int amode, void *view, int niter)
int _photon_wait_recv_buffer_rdma(int proc, uint64_t size, int tag, photon_rid *request)
PHOTON_INTERNAL int _photon_initialized(void)
int photon_post_os_put(photon_rid request, int proc, void *ptr, uint64_t size, int tag, uint64_t r_offset)
int photon_probe_ledger(int proc, int *flag, int type, photonStatus status)
int photon_wait_send_request_rdma(int tag)
photonBackend __photon_shmem
int photon_exchange_finalize(photonConfig lcfg)
The main Photon configuration structure, passed to photon_init(). -1 may be set for integer values to...
int photon_probe(photonAddr addr, int *flag, photonStatus status)
int photon_cancel(photon_rid request, int flags)
uint64_t photon_rid
The Photon request ID.
photonBackend __photon_fabric
int photon_init(photonConfig cfg)
int photon_register_addr(photonAddr addr, int af)
int photon_probe_completion(int proc, int *flag, int *remaining, photon_cid *comp, int *src, void(*cb)(photon_cid), int flags)
int photon_post_os_get_direct(int proc, void *ptr, uint64_t size, photonBuffer rbuf, int flags, photon_rid *request)
struct photon_forwarder_t * photonForwarder
#define PHOTON_ERROR_NOINIT
Error code, subsystem not initialized.
int photon_post_recv_buffer_rdma(int proc, void *ptr, uint64_t size, int tag, photon_rid *request)
int photon_post_send_request_rdma(int proc, uint64_t size, int tag, photon_rid *request)
int _photon_post_os_get_direct(int proc, void *ptr, uint64_t size, photonBuffer rbuf, int flags, photon_rid *request)
union photon_addr_t * photonAddr
Convenience pointer type for the address union.
int _photon_post_recv_buffer_rdma(int proc, void *ptr, uint64_t size, int tag, photon_rid *request)
int photon_test(photon_rid request, int *flag, int *type, photonStatus status)
photonForwarder __photon_forwarder
int photon_unregister_addr(photonAddr addr, int af)
int photon_unregister_buffer(void *buf, uint64_t size)
int _photon_init(photonConfig cfg, ProcessInfo *info, photonBufferHandle ss)
int _photon_wait_send_request_rdma(int tag)
int _photon_collective_init_new_comm(void *active, int num_active, int total, photon_coll ctype, photon_cid local, photon_rid *request, int flags, photonComm *c)
int _photon_recv(photon_rid request, void *ptr, uint64_t size, int flags)
int photon_get_with_completion(int proc, uint64_t size, photonBuffer lbuf, photonBuffer rbuf, photon_cid local, photon_cid remote, int flags)
int photon_send(photonAddr addr, void *ptr, uint64_t size, int flags, uint64_t *request)
Experimental UD interface.
int _photon_post_os_put(photon_rid request, int proc, void *ptr, uint64_t size, int tag, uint64_t r_offset)
int _photon_wait_any(int *ret_proc, photon_rid *ret_req)
int _photon_wait(photon_rid request)
int _photon_io_finalize()
#define PHOTON_ERROR
Error code, general error.
int _photon_send_FIN(photon_rid request, int proc, int flags)
Use Verbs photon backend.
int photon_collective_comm_create(void *active, int num_active, int total, photonComm *c)
In-progress communicator handling.
int photon_send_FIN(photon_rid request, int proc, int flags)
int photon_get_buffer_remote(photon_rid request, photonBuffer ret_buf)
int _photon_get_buffer_remote(photon_rid request, photonBuffer ret_buf)
void photon_io_print_info(void *io)
int _photon_post_os_get(photon_rid request, int proc, void *ptr, uint64_t size, int tag, uint64_t r_offset)
int photon_wait_send_buffer_rdma(int proc, uint64_t size, int tag, photon_rid *request)
#define PHOTON_OK
Photon success code.
int _photon_get_buffer_private(void *addr, uint64_t size, const struct photon_buffer_priv_t **pptr)
#define PHOTON_EXCH_MPI
Use MPI for metadata exchange.
int _photon_put_with_completion(int proc, uint64_t size, photonBuffer lbuf, photonBuffer rbuf, photon_cid local, photon_cid remote, int flags, pwc_cid_type type, pwc_command cmd)
int photon_wait(photon_rid request)
int _photon_collective_init(photonComm c, photon_coll ctype, photon_cid local, photon_rid *request, int flags)
int photon_get_dev_addr(int af, photonAddr addr)
int _photon_probe(photonAddr addr, int *flag, photonStatus status)
#define PHOTON_EXCH_XSP
Use XSP for metadata exchange.
int photon_buffer_init(photonBufferInterface bi)
int photon_register_buffer(void *buf, uint64_t size)
int photon_collective_init_new_comm(void *active, int num_active, int total, photon_coll ctype, photon_cid local, photon_rid *request, int flags, photonComm *c)
In-progress communicator handling.
int _photon_probe_ledger(int proc, int *flag, int type, photonStatus status)
int photon_exchange_init(photonConfig lcfg, photonConfig cfg)
Convenience pointer type for the private buffer structure.
int _photon_cancel(photon_rid request, int flags)
int _photon_register_buffer(void *addr, uint64_t size)
int _photon_io_init(char *file, int amode, void *view, int niter)
int photon_collective_join(photon_rid request, void *in, void *out, int scount, int rcount, photonDatatype stype, photonDatatype rtype, int root, void *op)
photonConfig __photon_config
#define PHOTON_EXCH_EXTERNAL
Use externally defined functions for metadata exchange.
int photon_post_send_buffer_rdma(int proc, void *ptr, uint64_t size, int tag, photon_rid *request)
int photon_wait_recv_buffer_rdma(int proc, uint64_t size, int tag, photon_rid *request)
int _photon_unregister_buffer(void *addr, uint64_t size)
int _photon_post_send_buffer_rdma(int proc, void *ptr, uint64_t size, int tag, photon_rid *request)
int photon_post_os_get(photon_rid request, int proc, void *ptr, uint64_t size, int tag, uint64_t r_offset)
int photon_collective_init(photonComm comm, photon_coll ctype, photon_cid local, photon_rid *request, int flags)
#define DEF_SMALL_MSG_SIZE
int photon_put_with_completion(int proc, uint64_t size, photonBuffer lbuf, photonBuffer rbuf, photon_cid local, photon_cid remote, int flags)
int _photon_wait_any_ledger(int *ret_proc, photon_rid *ret_req)
int photon_get_buffer_private(void *buf, uint64_t size, const struct photon_buffer_priv_t **pptr)
int _photon_probe_completion(int proc, int *flag, int *remaining, photon_cid *comp, int *src, void(*cb)(photon_cid), int flags)
#define DEF_EAGER_BUF_SIZE
int _photon_collective_comm_create(void *active, int num_active, int total, photonComm *c)
int _photon_test(photon_rid request, int *flag, int *type, photonStatus status)
int _photon_wait_send_buffer_rdma(int proc, uint64_t size, int tag, photon_rid *request)
int photon_wait_any(int *ret_proc, photon_rid *ret_req)
int _photon_post_os_put_direct(int proc, void *ptr, uint64_t size, photonBuffer rbuf, int flags, photon_rid *request)
int photon_wait_any_ledger(int *ret_proc, photon_rid *ret_req)
int photon_post_os_put_direct(int proc, void *ptr, uint64_t size, photonBuffer rbuf, int flags, photon_rid *request)
int photon_get_dev_name(char **dev_name)