Upgrade macos
This commit is contained in:
184
macx64/mpi/openmpi/include/pmix/src/mca/ptl/base/base.h
Normal file
184
macx64/mpi/openmpi/include/pmix/src/mca/ptl/base/base.h
Normal file
@@ -0,0 +1,184 @@
|
||||
/* -*- C -*-
|
||||
*
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. 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 (c) 2012 Los Alamos National Security, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2020 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015-2020 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
|
||||
* Copyright (c) 2023 Triad National Security, LLC. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
*/
|
||||
#ifndef PMIX_PTL_BASE_H_
|
||||
#define PMIX_PTL_BASE_H_
|
||||
|
||||
#include "src/include/pmix_config.h"
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h> /* for struct timeval */
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#include "src/class/pmix_pointer_array.h"
|
||||
#include "src/mca/base/pmix_mca_base_framework.h"
|
||||
#include "src/mca/mca.h"
|
||||
|
||||
#include "src/include/pmix_globals.h"
|
||||
#include "src/include/pmix_stdatomic.h"
|
||||
#include "src/mca/ptl/base/ptl_base_handshake.h"
|
||||
#include "src/mca/ptl/ptl.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/*
|
||||
* MCA Framework
|
||||
*/
|
||||
PMIX_EXPORT extern pmix_mca_base_framework_t pmix_ptl_base_framework;
|
||||
/**
|
||||
* PTL select function
|
||||
*
|
||||
* Cycle across available components and construct the list
|
||||
* of active modules
|
||||
*/
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_select(void);
|
||||
|
||||
/* framework globals */
|
||||
struct pmix_ptl_base_t {
|
||||
bool initialized;
|
||||
bool selected;
|
||||
pmix_list_t posted_recvs; // list of pmix_ptl_posted_recv_t
|
||||
pmix_list_t unexpected_msgs;
|
||||
pmix_listener_t listener;
|
||||
struct sockaddr_storage *connection;
|
||||
uint32_t current_tag;
|
||||
size_t max_msg_size;
|
||||
char *session_tmpdir;
|
||||
char *system_tmpdir;
|
||||
char *report_uri;
|
||||
char *uri;
|
||||
char *urifile;
|
||||
char *sysctrlr_filename;
|
||||
char *scheduler_filename;
|
||||
char *system_filename;
|
||||
char *session_filename;
|
||||
char *nspace_filename;
|
||||
char *pid_filename;
|
||||
char *rendezvous_filename;
|
||||
bool created_rendezvous_file;
|
||||
bool created_session_tmpdir;
|
||||
bool created_system_tmpdir;
|
||||
bool created_sysctrlr_filename;
|
||||
bool created_scheduler_filename;
|
||||
bool created_system_filename;
|
||||
bool created_session_filename;
|
||||
bool created_nspace_filename;
|
||||
bool created_pid_filename;
|
||||
bool created_urifile;
|
||||
bool remote_connections;
|
||||
bool system_tool;
|
||||
bool session_tool;
|
||||
bool tool_support;
|
||||
char *if_include;
|
||||
char *if_exclude;
|
||||
int ipv4_port;
|
||||
bool disable_ipv4_family;
|
||||
int ipv6_port;
|
||||
bool disable_ipv6_family;
|
||||
int max_retries;
|
||||
int wait_to_connect;
|
||||
int handshake_wait_time;
|
||||
int handshake_max_retries;
|
||||
};
|
||||
typedef struct pmix_ptl_base_t pmix_ptl_base_t;
|
||||
|
||||
PMIX_EXPORT extern pmix_ptl_base_t pmix_ptl_base;
|
||||
|
||||
typedef struct {
|
||||
pmix_list_item_t super;
|
||||
int sd;
|
||||
char *nspace;
|
||||
pmix_rank_t rank;
|
||||
char *uri;
|
||||
char *version;
|
||||
} pmix_connection_t;
|
||||
PMIX_CLASS_DECLARATION(pmix_connection_t);
|
||||
|
||||
/* API stubs */
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_set_notification_cbfunc(pmix_ptl_cbfunc_t cbfunc);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_connect_to_peer(struct pmix_peer_t *peer,
|
||||
pmix_info_t info[], size_t ninfo,
|
||||
char **suri);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_parse_uri_file(char *filename,
|
||||
bool optional,
|
||||
pmix_list_t *connections);
|
||||
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_setup_connection(char *uri,
|
||||
struct sockaddr_storage *connection,
|
||||
size_t *len);
|
||||
|
||||
PMIX_EXPORT void pmix_ptl_base_post_recv(int fd, short args, void *cbdata);
|
||||
PMIX_EXPORT void pmix_ptl_base_cancel_recv(int sd, short args, void *cbdata);
|
||||
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_start_listening(pmix_info_t info[], size_t ninfo);
|
||||
PMIX_EXPORT void pmix_ptl_base_stop_listening(void);
|
||||
PMIX_EXPORT pmix_status_t pmix_base_write_rndz_file(char *filename, char *uri, bool *created);
|
||||
|
||||
/* base support functions */
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_check_server_uris(pmix_peer_t *peer, char **evar);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_check_directives(pmix_info_t *info, size_t ninfo);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_setup_fork(const pmix_proc_t *proc, char ***env);
|
||||
PMIX_EXPORT void pmix_ptl_base_send_handler(int sd, short flags, void *cbdata);
|
||||
PMIX_EXPORT void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata);
|
||||
PMIX_EXPORT void pmix_ptl_base_process_msg(int fd, short flags, void *cbdata);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_set_nonblocking(int sd);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_set_blocking(int sd);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_send_blocking(int sd, char *ptr, size_t size);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_recv_blocking(int sd, char *data, size_t size);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_connect(struct sockaddr_storage *addr, pmix_socklen_t len,
|
||||
int *fd);
|
||||
PMIX_EXPORT void pmix_ptl_base_connection_handler(int sd, short args, void *cbdata);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_setup_listener(pmix_info_t info[], size_t ninfo);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_send_connect_ack(int sd);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_recv_connect_ack(int sd);
|
||||
PMIX_EXPORT void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err);
|
||||
PMIX_EXPORT bool pmix_ptl_base_peer_is_earlier(pmix_peer_t *peer, uint8_t major, uint8_t minor,
|
||||
uint8_t release);
|
||||
PMIX_EXPORT void pmix_ptl_base_query_servers(int sd, short args, void *cbdata);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_parse_uri(const char *evar, char **nspace,
|
||||
pmix_rank_t *rank, char **suri);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_df_search(char *dirname, char *prefix, pmix_info_t info[],
|
||||
size_t ninfo, bool optional, pmix_list_t *connections);
|
||||
PMIX_EXPORT pmix_rnd_flag_t pmix_ptl_base_set_flag(size_t *sz);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_make_connection(pmix_peer_t *peer, char *suri,
|
||||
pmix_info_t *iptr, size_t niptr);
|
||||
PMIX_EXPORT void pmix_ptl_base_complete_connection(pmix_peer_t *peer, char *nspace,
|
||||
pmix_rank_t rank);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_set_timeout(pmix_peer_t *peer, struct timeval *save,
|
||||
pmix_socklen_t *sz, bool *sockopt);
|
||||
PMIX_EXPORT void pmix_ptl_base_setup_socket(pmix_peer_t *peer);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_client_handshake(pmix_peer_t *peer, pmix_status_t reply);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_tool_handshake(pmix_peer_t *peer, pmix_status_t rp);
|
||||
PMIX_EXPORT char **pmix_ptl_base_split_and_resolve(const char *orig_str,
|
||||
const char *name);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_set_peer(pmix_peer_t *peer, char *evar);
|
||||
PMIX_EXPORT char *pmix_ptl_base_get_cmd_line(void);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,215 @@
|
||||
/* -*- C -*-
|
||||
*
|
||||
* Copyright (c) 2020 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
*/
|
||||
#ifndef PMIX_PTL_BASE_HANDSHAKE_H_
|
||||
#define PMIX_PTL_BASE_HANDSHAKE_H_
|
||||
|
||||
#include "src/include/pmix_config.h"
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
/* The following macros are for use in the PTL connection
|
||||
* handler. For simplicity, they include variables that are
|
||||
* defined in the functions where they are used - thus, these
|
||||
* macros are NOT portable for use elsewhere
|
||||
*
|
||||
* A symmetric pair of macros are provided specifically to
|
||||
* make it easier to read and compare the two ends of the
|
||||
* handshake */
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/* define flag values that indicate the type of process attempting
|
||||
* to connect to a server:
|
||||
* 0 => simple client process
|
||||
* 1 => legacy tool - may or may not have an identifier
|
||||
* 2 => legacy launcher - may or may not have an identifier
|
||||
* ------------------------------------------
|
||||
* 3 => self-started tool process that needs an identifier
|
||||
* 4 => self-started tool process that was given an identifier by caller
|
||||
* 5 => tool that was started by a PMIx server - identifier specified by server
|
||||
* 6 => self-started launcher that needs an identifier
|
||||
* 7 => self-started launcher that was given an identifier by caller
|
||||
* 8 => launcher that was started by a PMIx server - identifier specified by server
|
||||
* 9 => singleton client - treated like a tool that has an identifier
|
||||
* ------------------------------------------
|
||||
* 10 => scheduler
|
||||
*/
|
||||
typedef uint8_t pmix_rnd_flag_t;
|
||||
#define PMIX_SIMPLE_CLIENT 0
|
||||
#define PMIX_LEGACY_TOOL 1
|
||||
#define PMIX_LEGACY_LAUNCHER 2
|
||||
#define PMIX_TOOL_NEEDS_ID 3
|
||||
#define PMIX_TOOL_GIVEN_ID 4
|
||||
#define PMIX_TOOL_CLIENT 5
|
||||
#define PMIX_LAUNCHER_NEEDS_ID 6
|
||||
#define PMIX_LAUNCHER_GIVEN_ID 7
|
||||
#define PMIX_LAUNCHER_CLIENT 8
|
||||
#define PMIX_SINGLETON_CLIENT 9
|
||||
#define PMIX_SCHEDULER_WITH_ID 10
|
||||
|
||||
/* The following macros are used in the ptl_base_connection_hdlr.c
|
||||
* file to parse the handshake message and extract its fields */
|
||||
|
||||
#define PMIX_PTL_GET_STRING(n) \
|
||||
do { \
|
||||
size_t _l; \
|
||||
PMIX_STRNLEN(_l, mg, cnt); \
|
||||
if (_l < cnt) { \
|
||||
(n) = strdup(mg); \
|
||||
mg += strlen((n)) + 1; \
|
||||
cnt -= strlen((n)) + 1; \
|
||||
} else { \
|
||||
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); \
|
||||
goto error; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* numerical value must be converted back to host
|
||||
* order, so we use an intermediate storage place
|
||||
* for that purpose */
|
||||
#define PMIX_PTL_GET_U32_NOERROR(r, n) \
|
||||
do { \
|
||||
uint32_t _u; \
|
||||
if (sizeof(uint32_t) <= cnt) { \
|
||||
memcpy(&_u, mg, sizeof(uint32_t)); \
|
||||
(n) = ntohl(_u); \
|
||||
mg += sizeof(uint32_t); \
|
||||
cnt -= sizeof(uint32_t); \
|
||||
(r) = PMIX_SUCCESS; \
|
||||
} else { \
|
||||
(r) = PMIX_ERR_BAD_PARAM; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define PMIX_PTL_GET_U32(n) \
|
||||
do { \
|
||||
uint32_t _u; \
|
||||
if (sizeof(uint32_t) <= cnt) { \
|
||||
memcpy(&_u, mg, sizeof(uint32_t)); \
|
||||
(n) = ntohl(_u); \
|
||||
mg += sizeof(uint32_t); \
|
||||
cnt -= sizeof(uint32_t); \
|
||||
} else { \
|
||||
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); \
|
||||
goto error; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define PMIX_PTL_GET_BLOB(b, l) \
|
||||
do { \
|
||||
if (0 < (l)) { \
|
||||
(b) = (char *) malloc((l)); \
|
||||
if (NULL == (b)) { \
|
||||
PMIX_ERROR_LOG(PMIX_ERR_NOMEM); \
|
||||
goto error; \
|
||||
} \
|
||||
memcpy((b), mg, (l)); \
|
||||
mg += (l); \
|
||||
cnt -= (l); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define PMIX_PTL_GET_U8(n) \
|
||||
do { \
|
||||
if (sizeof(uint8_t) <= cnt) { \
|
||||
memcpy(&(n), mg, sizeof(uint8_t)); \
|
||||
mg += sizeof(uint8_t); \
|
||||
cnt -= sizeof(uint8_t); \
|
||||
} else { \
|
||||
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); \
|
||||
goto error; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define PMIX_PTL_GET_PROCID(p) \
|
||||
do { \
|
||||
char *n; \
|
||||
uint32_t _r; \
|
||||
pmix_status_t _rc; \
|
||||
PMIX_PTL_GET_STRING(n); \
|
||||
PMIX_PTL_GET_U32_NOERROR(_rc, _r); \
|
||||
if (PMIX_SUCCESS != _rc) { \
|
||||
PMIX_ERROR_LOG(_rc); \
|
||||
free(n); \
|
||||
goto error; \
|
||||
} \
|
||||
PMIX_LOAD_PROCID(&(p), n, _r); \
|
||||
free(n); \
|
||||
} while (0)
|
||||
|
||||
/* The following macros are for use in the ptl_base_fns.c
|
||||
* when constructing the handshake message. */
|
||||
#define PMIX_PTL_PUT_STRING(n) \
|
||||
do { \
|
||||
memcpy(msg + csize, (n), strlen((n))); \
|
||||
csize += strlen((n)) + 1; \
|
||||
} while (0)
|
||||
|
||||
/* numerical value must be converted to network byte
|
||||
* order, so we use an intermediate storage place
|
||||
* for that purpose */
|
||||
#define PMIX_PTL_PUT_U32(n) \
|
||||
do { \
|
||||
uint32_t _u; \
|
||||
_u = htonl((uint32_t)(n)); \
|
||||
memcpy(msg + csize, &_u, sizeof(uint32_t)); \
|
||||
csize += sizeof(uint32_t); \
|
||||
} while (0)
|
||||
|
||||
#define PMIX_PTL_PUT_BLOB(b, l) \
|
||||
do { \
|
||||
if (0 < (l)) { \
|
||||
memcpy(msg + csize, (b), (l)); \
|
||||
csize += (l); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define PMIX_PTL_PUT_U8(n) \
|
||||
do { \
|
||||
memcpy(msg + csize, &(n), sizeof(uint8_t)); \
|
||||
csize += sizeof(uint8_t); \
|
||||
} while (0)
|
||||
|
||||
#define PMIX_PTL_PUT_PROCID(p) \
|
||||
do { \
|
||||
PMIX_PTL_PUT_STRING((p).nspace); \
|
||||
PMIX_PTL_PUT_U32((p).rank); \
|
||||
} while (0)
|
||||
|
||||
/* the following macros are for use in the ptl_base_fns.c
|
||||
* when sending/recving values during the handshake */
|
||||
#define PMIX_PTL_RECV_NSPACE(s, n) \
|
||||
do { \
|
||||
pmix_status_t r; \
|
||||
r = pmix_ptl_base_recv_blocking((s), (char *) (n), PMIX_MAX_NSLEN + 1); \
|
||||
(n)[PMIX_MAX_NSLEN] = '\0'; /* ensure NULL termination */ \
|
||||
if (PMIX_SUCCESS != r) { \
|
||||
return r; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define PMIX_PTL_RECV_U32(s, n) \
|
||||
do { \
|
||||
pmix_status_t r; \
|
||||
uint32_t _u; \
|
||||
r = pmix_ptl_base_recv_blocking((s), (char *) &_u, sizeof(uint32_t)); \
|
||||
if (PMIX_SUCCESS != r) { \
|
||||
return r; \
|
||||
} \
|
||||
(n) = htonl(_u); \
|
||||
} while (0)
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif
|
||||
222
macx64/mpi/openmpi/include/pmix/src/mca/ptl/ptl.h
Normal file
222
macx64/mpi/openmpi/include/pmix/src/mca/ptl/ptl.h
Normal file
@@ -0,0 +1,222 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. 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 (c) 2012 Los Alamos National Security, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2020 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2016 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Data packing subsystem.
|
||||
*/
|
||||
|
||||
#ifndef PMIX_PTL_H_
|
||||
#define PMIX_PTL_H_
|
||||
|
||||
#include "src/include/pmix_config.h"
|
||||
|
||||
#include "src/include/pmix_types.h"
|
||||
|
||||
#include "src/mca/base/pmix_mca_base_framework.h"
|
||||
#include "src/mca/base/pmix_mca_base_var.h"
|
||||
#include "src/mca/bfrops/bfrops_types.h"
|
||||
#include "src/mca/mca.h"
|
||||
|
||||
#include "ptl_types.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/* forward declaration */
|
||||
struct pmix_peer_t;
|
||||
|
||||
/* The overall objective of this framework is to provide transport
|
||||
* options by which a server can communicate with a client:
|
||||
*
|
||||
* (a) across different versions of the library - e.g., when the
|
||||
* connection handshake changes.
|
||||
*
|
||||
* (b) using different transports as necessitated by different
|
||||
* environments.
|
||||
*
|
||||
* This is a single-select framework - i.e., only one component
|
||||
* is selected and "active" at a time. The intent is
|
||||
* to have one component for each use-case, with the
|
||||
* expectation that the community will do its best not to revise
|
||||
* communications in manners that expand components to support (a).
|
||||
* Thus, new variations should be rare, and only a few components
|
||||
* will exist.
|
||||
*/
|
||||
|
||||
/**** MODULE INTERFACE DEFINITION ****/
|
||||
|
||||
/* initialize the active plugin */
|
||||
typedef pmix_status_t (*pmix_ptl_init_fn_t)(void);
|
||||
|
||||
/* finalize the active plugin */
|
||||
typedef void (*pmix_ptl_finalize_fn_t)(void);
|
||||
|
||||
/* (ONE-WAY) register a persistent recv */
|
||||
typedef pmix_status_t (*pmix_ptl_recv_fn_t)(struct pmix_peer_t *peer, pmix_ptl_cbfunc_t cbfunc,
|
||||
pmix_ptl_tag_t tag);
|
||||
|
||||
/* Cancel a persistent recv */
|
||||
typedef pmix_status_t (*pmix_ptl_cancel_fn_t)(struct pmix_peer_t *peer, pmix_ptl_tag_t tag);
|
||||
|
||||
/* connect to a peer - this is a blocking function
|
||||
* to establish a connection to a peer*/
|
||||
typedef pmix_status_t (*pmix_ptl_connect_to_peer_fn_t)(struct pmix_peer_t *peer,
|
||||
pmix_info_t info[],
|
||||
size_t ninfo,
|
||||
char **suri);
|
||||
|
||||
/* query available servers on the local node */
|
||||
typedef void (*pmix_ptl_query_servers_fn_t)(char *dirname, pmix_list_t *servers);
|
||||
|
||||
/* define an API for establishing a
|
||||
* communication rendezvous point for local procs. The active component
|
||||
* is given an opportunity to register a listener with the
|
||||
* PTL base */
|
||||
typedef pmix_status_t (*pmix_ptl_setup_listener_fn_t)(pmix_info_t info[], size_t ninfo);
|
||||
|
||||
/* define an API for obtaining any envars that are to
|
||||
* be passed to client procs upon fork */
|
||||
typedef pmix_status_t (*pmix_ptl_setup_fork_fn_t)(const pmix_proc_t *proc, char ***env);
|
||||
|
||||
/**
|
||||
* Base structure for a PTL module
|
||||
*/
|
||||
struct pmix_ptl_module_t {
|
||||
char *name;
|
||||
pmix_ptl_init_fn_t init;
|
||||
pmix_ptl_finalize_fn_t finalize;
|
||||
pmix_ptl_recv_fn_t recv;
|
||||
pmix_ptl_cancel_fn_t cancel;
|
||||
pmix_ptl_connect_to_peer_fn_t connect_to_peer;
|
||||
pmix_ptl_query_servers_fn_t query_servers;
|
||||
pmix_ptl_setup_listener_fn_t setup_listener;
|
||||
pmix_ptl_setup_fork_fn_t setup_fork;
|
||||
};
|
||||
typedef struct pmix_ptl_module_t pmix_ptl_module_t;
|
||||
|
||||
/***** MACROS FOR EXECUTING PTL FUNCTIONS *****/
|
||||
|
||||
/* (TWO-WAY) send a message to the peer, and get a response delivered
|
||||
* to the specified callback function. The buffer will be free'd
|
||||
* at the completion of the send, and the cbfunc will be called
|
||||
* when the corresponding reply is received */
|
||||
#define PMIX_PTL_SEND_RECV(r, p, b, c, d) \
|
||||
do { \
|
||||
pmix_ptl_sr_t *ms; \
|
||||
pmix_peer_t *pr = (pmix_peer_t *) (p); \
|
||||
if ((p)->finalized) { \
|
||||
(r) = PMIX_ERR_UNREACH; \
|
||||
} else { \
|
||||
ms = PMIX_NEW(pmix_ptl_sr_t); \
|
||||
PMIX_RETAIN(pr); \
|
||||
ms->peer = pr; \
|
||||
ms->bfr = (b); \
|
||||
ms->cbfunc = (c); \
|
||||
ms->cbdata = (d); \
|
||||
PMIX_THREADSHIFT(ms, pmix_ptl_base_send_recv); \
|
||||
(r) = PMIX_SUCCESS; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* (ONE-WAY) send a message to the peer. The buffer will be free'd
|
||||
* at the completion of the send */
|
||||
#define PMIX_PTL_SEND_ONEWAY(r, p, b, t) \
|
||||
do { \
|
||||
pmix_ptl_queue_t *q; \
|
||||
pmix_peer_t *pr = (pmix_peer_t *) (p); \
|
||||
if ((p)->finalized) { \
|
||||
(r) = PMIX_ERR_UNREACH; \
|
||||
} else { \
|
||||
q = PMIX_NEW(pmix_ptl_queue_t); \
|
||||
PMIX_RETAIN(pr); \
|
||||
q->peer = pr; \
|
||||
q->buf = (b); \
|
||||
q->tag = (t); \
|
||||
PMIX_THREADSHIFT(q, pmix_ptl_base_send); \
|
||||
(r) = PMIX_SUCCESS; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define PMIX_PTL_RECV(r, c, t) \
|
||||
do { \
|
||||
pmix_ptl_posted_recv_t *req; \
|
||||
req = PMIX_NEW(pmix_ptl_posted_recv_t); \
|
||||
if (NULL == req) { \
|
||||
(r) = PMIX_ERR_NOMEM; \
|
||||
} else { \
|
||||
req->tag = (t); \
|
||||
req->cbfunc = (c); \
|
||||
pmix_event_assign(&(req->ev), pmix_globals.evbase, -1, EV_WRITE, \
|
||||
pmix_ptl_base_post_recv, req); \
|
||||
pmix_event_active(&(req->ev), EV_WRITE, 1); \
|
||||
(r) = PMIX_SUCCESS; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define PMIX_PTL_CANCEL(r, t) \
|
||||
do { \
|
||||
pmix_ptl_posted_recv_t *req; \
|
||||
req = PMIX_NEW(pmix_ptl_posted_recv_t); \
|
||||
if (NULL == req) { \
|
||||
(r) = PMIX_ERR_NOMEM; \
|
||||
} else { \
|
||||
req->tag = (t); \
|
||||
pmix_event_assign(&(req->ev), pmix_globals.evbase, -1, EV_WRITE, \
|
||||
pmix_ptl_base_cancel_recv, req); \
|
||||
pmix_event_active(&(req->ev), EV_WRITE, 1); \
|
||||
(r) = PMIX_SUCCESS; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* expose functions used by the macros */
|
||||
PMIX_EXPORT extern void pmix_ptl_base_send(int sd, short args, void *cbdata);
|
||||
PMIX_EXPORT extern void pmix_ptl_base_send_recv(int sd, short args, void *cbdata);
|
||||
PMIX_EXPORT extern void pmix_ptl_base_register_recv(int sd, short args, void *cbdata);
|
||||
PMIX_EXPORT extern void pmix_ptl_base_cancel_recv(int sd, short args, void *cbdata);
|
||||
|
||||
/**** COMPONENT STRUCTURE DEFINITION ****/
|
||||
|
||||
/*
|
||||
* the standard component data structure
|
||||
*/
|
||||
struct pmix_ptl_base_component_t {
|
||||
pmix_mca_base_component_t base;
|
||||
int priority;
|
||||
char *uri;
|
||||
};
|
||||
typedef struct pmix_ptl_base_component_t pmix_ptl_base_component_t;
|
||||
|
||||
/* export the PTL module struct */
|
||||
PMIX_EXPORT extern pmix_ptl_module_t pmix_ptl;
|
||||
|
||||
/*
|
||||
* Macro for use in components that are of type ptl
|
||||
*/
|
||||
#define PMIX_PTL_BASE_VERSION_2_0_0 PMIX_MCA_BASE_VERSION_1_0_0("ptl", 2, 0, 0)
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* PMIX_PTL_H */
|
||||
435
macx64/mpi/openmpi/include/pmix/src/mca/ptl/ptl_types.h
Normal file
435
macx64/mpi/openmpi/include/pmix/src/mca/ptl/ptl_types.h
Normal file
@@ -0,0 +1,435 @@
|
||||
/* -*- C -*-
|
||||
*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. 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 (c) 2007-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2020 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Buffer management types.
|
||||
*/
|
||||
|
||||
#ifndef PMIX_PTL_TYPES_H_
|
||||
#define PMIX_PTL_TYPES_H_
|
||||
|
||||
#include "src/include/pmix_config.h"
|
||||
#include "src/include/pmix_types.h"
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
# include <sys/un.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_UIO_H
|
||||
# include <sys/uio.h>
|
||||
#endif
|
||||
#ifdef HAVE_NET_UIO_H
|
||||
# include <net/uio.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#include <event.h>
|
||||
|
||||
#include "src/class/pmix_list.h"
|
||||
#include "src/include/pmix_stdatomic.h"
|
||||
#include "src/mca/bfrops/bfrops_types.h"
|
||||
#include "src/mca/ptl/base/ptl_base_handshake.h"
|
||||
#include "src/util/pmix_output.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
// forward declaration
|
||||
struct pmix_peer_t;
|
||||
struct pmix_ptl_module_t;
|
||||
|
||||
/* define a process type */
|
||||
typedef struct {
|
||||
uint32_t type;
|
||||
uint8_t major;
|
||||
uint8_t minor;
|
||||
uint8_t release;
|
||||
uint8_t flag; // see pmix_ptl_base_set_flag for definition of values
|
||||
} pmix_proc_type_t;
|
||||
|
||||
#define PMIX_MAJOR_WILDCARD 255
|
||||
#define PMIX_MINOR_WILDCARD 255
|
||||
#define PMIX_RELEASE_WILDCARD 255
|
||||
|
||||
/* use 255 as WILDCARD for the release triplet values */
|
||||
#define PMIX_PROC_TYPE_STATIC_INIT \
|
||||
{ \
|
||||
.type = PMIX_PROC_UNDEF, \
|
||||
.major = PMIX_MAJOR_WILDCARD, \
|
||||
.minor = PMIX_MINOR_WILDCARD, \
|
||||
.release = PMIX_RELEASE_WILDCARD, \
|
||||
.flag = 0 \
|
||||
}
|
||||
|
||||
/* Define process types - we use a bit-mask as procs can
|
||||
* span multiple types */
|
||||
#define PMIX_PROC_UNDEF 0x00000000
|
||||
#define PMIX_PROC_CLIENT 0x00000001 // simple client process
|
||||
#define PMIX_PROC_SERVER 0x00000002 // simple server process
|
||||
#define PMIX_PROC_TOOL 0x00000004 // simple tool
|
||||
#define PMIX_PROC_SINGLETON_ACT 0x00000008 // self-started client process
|
||||
#define PMIX_PROC_SINGLETON (PMIX_PROC_CLIENT | PMIX_PROC_SINGLETON_ACT)
|
||||
#define PMIX_PROC_LAUNCHER_ACT 0x10000000 // process acting as launcher
|
||||
#define PMIX_PROC_LAUNCHER (PMIX_PROC_TOOL | PMIX_PROC_SERVER | PMIX_PROC_LAUNCHER_ACT)
|
||||
#define PMIX_PROC_CLIENT_LAUNCHER (PMIX_PROC_LAUNCHER | PMIX_PROC_CLIENT)
|
||||
#define PMIX_PROC_CLIENT_TOOL_ACT 0x20000000
|
||||
#define PMIX_PROC_CLIENT_TOOL (PMIX_PROC_TOOL | PMIX_PROC_CLIENT | PMIX_PROC_CLIENT_TOOL_ACT)
|
||||
#define PMIX_PROC_GATEWAY_ACT 0x40000000
|
||||
#define PMIX_PROC_GATEWAY (PMIX_PROC_SERVER | PMIX_PROC_GATEWAY_ACT)
|
||||
#define PMIX_PROC_SCHEDULER_ACT 0x80000000
|
||||
#define PMIX_PROC_SCHEDULER (PMIX_PROC_SERVER | PMIX_PROC_SCHEDULER_ACT)
|
||||
#define PMIX_PROC_SYS_CTRLR_ACT 0x01000000
|
||||
#define PMIX_PROC_SYS_CTRLR (PMIX_PROC_SERVER | PMIX_PROC_SYS_CTRLR_ACT)
|
||||
|
||||
|
||||
#define PMIX_SET_PEER_TYPE(a, b) (a)->proc_type.type |= (b)
|
||||
#define PMIX_SET_PROC_TYPE(a, b) (a)->type |= (b)
|
||||
|
||||
/* define some convenience macros for testing proc type */
|
||||
#define PMIX_PEER_IS_CLIENT(p) (PMIX_PROC_CLIENT & (p)->proc_type.type)
|
||||
#define PMIX_PEER_IS_SINGLETON(p) (PMIX_PROC_SINGLETON_ACT & (p)->proc_type.type)
|
||||
#define PMIX_PEER_IS_SERVER(p) (PMIX_PROC_SERVER & (p)->proc_type.type)
|
||||
#define PMIX_PEER_IS_TOOL(p) (PMIX_PROC_TOOL & (p)->proc_type.type)
|
||||
#define PMIX_PEER_IS_LAUNCHER(p) (PMIX_PROC_LAUNCHER_ACT & (p)->proc_type.type)
|
||||
#define PMIX_PEER_IS_CLIENT_LAUNCHER(p) \
|
||||
((PMIX_PROC_LAUNCHER_ACT & (p)->proc_type.type) && (PMIX_PROC_CLIENT & (p)->proc_type.type))
|
||||
#define PMIX_PEER_IS_CLIENT_TOOL(p) \
|
||||
((PMIX_PROC_CLIENT_TOOL_ACT & (p)->proc_type.type) && (PMIX_PROC_CLIENT & (p)->proc_type.type))
|
||||
#define PMIX_PEER_IS_GATEWAY(p) (PMIX_PROC_GATEWAY_ACT & (p)->proc_type.type)
|
||||
#define PMIX_PEER_IS_SCHEDULER(p) (PMIX_PROC_SCHEDULER_ACT & (p)->proc_type.type)
|
||||
#define PMIX_PEER_IS_SYS_CTRLR(p) (PMIX_PROC_SYS_CTRLR_ACT & (p)->proc_type.type)
|
||||
|
||||
|
||||
#define PMIX_PROC_IS_CLIENT(p) (PMIX_PROC_CLIENT & (p)->type)
|
||||
#define PMIX_PROC_IS_SERVER(p) (PMIX_PROC_SERVER & (p)->type)
|
||||
#define PMIX_PROC_IS_TOOL(p) (PMIX_PROC_TOOL & (p)->type)
|
||||
#define PMIX_PROC_IS_LAUNCHER(p) (PMIX_PROC_LAUNCHER_ACT & (p)->type)
|
||||
#define PMIX_PROC_IS_CLIENT_LAUNCHER(p) \
|
||||
((PMIX_PROC_LAUNCHER_ACT & (p)->type) && (PMIX_PROC_CLIENT & (p)->type))
|
||||
#define PMIX_PROC_IS_CLIENT_TOOL(p) \
|
||||
((PMIX_PROC_CLIENT_TOOL_ACT & (p)->type) && (PMIX_PROC_CLIENT & (p)->type))
|
||||
#define PMIX_PROC_IS_GATEWAY(p) (PMIX_PROC_GATEWAY_ACT & (p)->type)
|
||||
#define PMIX_PROC_IS_SCHEDULER(p) (PMIX_PROC_SCHEDULER_ACT & (p)->type)
|
||||
#define PMIX_PROC_IS_SYS_CTRLR(p) (PMIX_PROC_SYS_CTRLR_ACT & (p)->type)
|
||||
|
||||
|
||||
/* provide macros for setting the major, minor, and release values
|
||||
* just so people don't have to deal with the details of the struct */
|
||||
#define PMIX_SET_PEER_VERSION(p, e, a, b) \
|
||||
do { \
|
||||
char *e2; \
|
||||
unsigned long mj, mn, rl; \
|
||||
if (NULL != e) { \
|
||||
if ('v' == e[0]) { \
|
||||
mj = strtoul(&e[1], &e2, 10); \
|
||||
} else { \
|
||||
mj = strtoul(e, &e2, 10); \
|
||||
} \
|
||||
++e2; \
|
||||
mn = strtoul(e2, &e2, 10); \
|
||||
++e2; \
|
||||
rl = strtoul(e2, NULL, 10); \
|
||||
PMIX_SET_PEER_MAJOR((p), mj); \
|
||||
PMIX_SET_PEER_MINOR((p), mn); \
|
||||
PMIX_SET_PEER_RELEASE((p), rl); \
|
||||
} else { \
|
||||
PMIX_SET_PEER_MAJOR((p), (a)); \
|
||||
PMIX_SET_PEER_MINOR((p), (b)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define PMIX_SET_PEER_MAJOR(p, a) (p)->proc_type.major = (a)
|
||||
#define PMIX_SET_PEER_MINOR(p, a) (p)->proc_type.minor = (a)
|
||||
#define PMIX_SET_PEER_RELEASE(p, a) (p)->proc_type.release = (a)
|
||||
#define PMIX_SET_PROC_MAJOR(p, a) (p)->major = (a)
|
||||
#define PMIX_SET_PROC_MINOR(p, a) (p)->minor = (a)
|
||||
#define PMIX_SET_PROC_RELEASE(p, a) (p)->release = (a)
|
||||
|
||||
/* define some convenience macros for testing version */
|
||||
#define PMIX_PEER_MAJOR_VERSION(p) (p)->proc_type.major
|
||||
#define PMIX_PEER_MINOR_VERSION(p) (p)->proc_type.minor
|
||||
#define PMIX_PEER_REL_VERSION(p) (p)->proc_type.release
|
||||
#define PMIX_PROC_MAJOR_VERSION(p) (p)->major
|
||||
#define PMIX_PROC_MINOR_VERSION(p) (p)->minor
|
||||
#define PMIX_PROC_REL_VERSION(p) (p)->release
|
||||
#define PMIX_PEER_IS_V1(p) ((p)->proc_type.major == 1)
|
||||
#define PMIX_PEER_IS_V20(p) ((p)->proc_type.major == 2 && (p)->proc_type.minor == 0)
|
||||
#define PMIX_PEER_IS_V21(p) ((p)->proc_type.major == 2 && (p)->proc_type.minor == 1)
|
||||
#define PMIX_PEER_IS_V3(p) ((p)->proc_type.major == 3)
|
||||
#define PMIX_PEER_IS_V40(p) ((p)->proc_type.major == 4 && (p)->proc_type.minor == 0)
|
||||
#define PMIX_PEER_IS_V41(p) ((p)->proc_type.major == 4 && (p)->proc_type.minor == 1)
|
||||
|
||||
#define PMIX_PEER_TRIPLET(p, a, b, c) \
|
||||
((PMIX_PEER_MAJOR_VERSION(p) == PMIX_MAJOR_WILDCARD || (a) == PMIX_MAJOR_WILDCARD \
|
||||
|| PMIX_PEER_MAJOR_VERSION(p) == (a)) \
|
||||
&& (PMIX_PEER_MINOR_VERSION(p) == PMIX_MINOR_WILDCARD || (b) == PMIX_MINOR_WILDCARD \
|
||||
|| PMIX_PEER_MINOR_VERSION(p) == (b)) \
|
||||
&& (PMIX_PEER_REL_VERSION(p) == PMIX_RELEASE_WILDCARD || (c) == PMIX_RELEASE_WILDCARD \
|
||||
|| PMIX_PEER_REL_VERSION(p) == (c)))
|
||||
|
||||
#define PMIX_PROC_TRIPLET(p, a, b, c) \
|
||||
((PMIX_PROC_MAJOR_VERSION(p) == PMIX_MAJOR_WILDCARD || PMIX_PROC_MAJOR_VERSION(p) == (a)) \
|
||||
&& (PMIX_PROC_MINOR_VERSION(p) == PMIX_MINOR_WILDCARD || PMIX_PROC_MINOR_VERSION(p) == (b)) \
|
||||
&& (PMIX_PROC_REL_VERSION(p) == PMIX_RELEASE_WILDCARD || PMIX_PROC_REL_VERSION(p) == (c)))
|
||||
|
||||
#define PMIX_PEER_IS_EARLIER(p, a, b, c) pmix_ptl_base_peer_is_earlier(p, a, b, c)
|
||||
|
||||
/**** MESSAGING STRUCTURES ****/
|
||||
typedef uint32_t pmix_ptl_tag_t;
|
||||
/* define a range of "reserved" tags - these
|
||||
* are tags that are used for persistent recvs
|
||||
* within the system */
|
||||
#define PMIX_PTL_TAG_NOTIFY 0
|
||||
#define PMIX_PTL_TAG_HEARTBEAT 1
|
||||
#define PMIX_PTL_TAG_IOF 2
|
||||
|
||||
/* define the start of dynamic tags that are
|
||||
* assigned for send/recv operations */
|
||||
#define PMIX_PTL_TAG_DYNAMIC 100
|
||||
|
||||
/* header for messages */
|
||||
typedef struct {
|
||||
int32_t pindex;
|
||||
pmix_ptl_tag_t tag;
|
||||
uint32_t nbytes;
|
||||
#if SIZEOF_SIZE_T == 8
|
||||
uint32_t padding;
|
||||
#endif
|
||||
} pmix_ptl_hdr_t;
|
||||
|
||||
/* define the messaging cbfunc */
|
||||
typedef void (*pmix_ptl_cbfunc_t)(struct pmix_peer_t *peer, pmix_ptl_hdr_t *hdr, pmix_buffer_t *buf,
|
||||
void *cbdata);
|
||||
|
||||
/* define a callback function for notifying that server connection
|
||||
* has completed */
|
||||
typedef void (*pmix_ptl_connect_cbfunc_t)(pmix_status_t status, void *cbdata);
|
||||
|
||||
/* define a callback function for processing pending connections */
|
||||
typedef void (*pmix_ptl_pending_cbfunc_t)(int sd, short args, void *cbdata);
|
||||
|
||||
/* structure for sending a message */
|
||||
typedef struct {
|
||||
pmix_list_item_t super;
|
||||
pmix_event_t ev;
|
||||
pmix_ptl_hdr_t hdr;
|
||||
pmix_buffer_t *data;
|
||||
bool hdr_sent;
|
||||
char *sdptr;
|
||||
size_t sdbytes;
|
||||
} pmix_ptl_send_t;
|
||||
PMIX_CLASS_DECLARATION(pmix_ptl_send_t);
|
||||
|
||||
/* structure for recving a message */
|
||||
typedef struct {
|
||||
pmix_list_item_t super;
|
||||
pmix_event_t ev;
|
||||
struct pmix_peer_t *peer;
|
||||
int sd;
|
||||
pmix_ptl_hdr_t hdr;
|
||||
char *data;
|
||||
bool hdr_recvd;
|
||||
char *rdptr;
|
||||
size_t rdbytes;
|
||||
} pmix_ptl_recv_t;
|
||||
PMIX_CLASS_DECLARATION(pmix_ptl_recv_t);
|
||||
|
||||
/* structure for tracking posted recvs */
|
||||
typedef struct {
|
||||
pmix_list_item_t super;
|
||||
pmix_event_t ev;
|
||||
uint32_t tag;
|
||||
pmix_ptl_cbfunc_t cbfunc;
|
||||
void *cbdata;
|
||||
} pmix_ptl_posted_recv_t;
|
||||
PMIX_CLASS_DECLARATION(pmix_ptl_posted_recv_t);
|
||||
|
||||
/* struct for posting send/recv request */
|
||||
typedef struct {
|
||||
pmix_object_t super;
|
||||
volatile bool active;
|
||||
pmix_event_t ev;
|
||||
struct pmix_peer_t *peer;
|
||||
pmix_status_t status;
|
||||
pmix_buffer_t *bfr;
|
||||
pmix_ptl_cbfunc_t cbfunc;
|
||||
void *cbdata;
|
||||
} pmix_ptl_sr_t;
|
||||
PMIX_CLASS_DECLARATION(pmix_ptl_sr_t);
|
||||
|
||||
typedef struct {
|
||||
pmix_object_t super;
|
||||
volatile bool active;
|
||||
pmix_event_t ev;
|
||||
struct pmix_peer_t *peer;
|
||||
pmix_buffer_t *buf;
|
||||
pmix_ptl_tag_t tag;
|
||||
} pmix_ptl_queue_t;
|
||||
PMIX_CLASS_DECLARATION(pmix_ptl_queue_t);
|
||||
|
||||
/* define listener protocol types */
|
||||
typedef uint16_t pmix_listener_protocol_t;
|
||||
#define PMIX_PROTOCOL_UNDEF 0
|
||||
#define PMIX_PROTOCOL_V1 1 // legacy usock
|
||||
#define PMIX_PROTOCOL_V2 2 // tcp
|
||||
|
||||
/* connection support */
|
||||
typedef struct {
|
||||
pmix_object_t super;
|
||||
pmix_event_t ev;
|
||||
pmix_listener_protocol_t protocol;
|
||||
int sd;
|
||||
bool need_id;
|
||||
pmix_rnd_flag_t flag;
|
||||
pmix_proc_t proc;
|
||||
pmix_info_t *info;
|
||||
size_t ninfo;
|
||||
pmix_status_t status;
|
||||
struct sockaddr_storage addr;
|
||||
struct pmix_peer_t *peer;
|
||||
char *version;
|
||||
char *bfrops;
|
||||
char *psec;
|
||||
char *gds;
|
||||
pmix_bfrop_buffer_type_t buffer_type;
|
||||
char *cred;
|
||||
size_t len;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
pmix_proc_type_t proc_type;
|
||||
} pmix_pending_connection_t;
|
||||
PMIX_CLASS_DECLARATION(pmix_pending_connection_t);
|
||||
|
||||
/* listener objects */
|
||||
typedef struct pmix_listener_t {
|
||||
pmix_list_item_t super;
|
||||
pmix_event_t ev;
|
||||
pmix_atomic_bool_t active;
|
||||
pmix_listener_protocol_t protocol;
|
||||
int socket;
|
||||
char *varname;
|
||||
char *uri;
|
||||
uint32_t owner;
|
||||
bool owner_given;
|
||||
uint32_t group;
|
||||
bool group_given;
|
||||
uint32_t mode;
|
||||
pmix_ptl_pending_cbfunc_t cbfunc;
|
||||
} pmix_listener_t;
|
||||
PMIX_CLASS_DECLARATION(pmix_listener_t);
|
||||
|
||||
#define PMIX_LISTENER_STATIC_INIT \
|
||||
{ \
|
||||
.super = PMIX_LIST_ITEM_STATIC_INIT, \
|
||||
.active = false, \
|
||||
.protocol = PMIX_PROTOCOL_UNDEF, \
|
||||
.socket = 0, \
|
||||
.varname = NULL, \
|
||||
.uri = NULL, \
|
||||
.owner = 0, \
|
||||
.owner_given = false, \
|
||||
.group = 0, \
|
||||
.mode = 0, \
|
||||
.cbfunc = NULL \
|
||||
}
|
||||
|
||||
/* provide a backdoor to the framework output for debugging */
|
||||
PMIX_EXPORT extern int pmix_ptl_base_output;
|
||||
|
||||
#define PMIX_ACTIVATE_POST_MSG(ms) \
|
||||
do { \
|
||||
pmix_event_assign(&((ms)->ev), pmix_globals.evbase, -1, EV_WRITE, \
|
||||
pmix_ptl_base_process_msg, (ms)); \
|
||||
PMIX_POST_OBJECT(ms); \
|
||||
pmix_event_active(&((ms)->ev), EV_WRITE, 1); \
|
||||
} while (0)
|
||||
|
||||
#define PMIX_SND_CADDY(c, h, s) \
|
||||
do { \
|
||||
(c) = PMIX_NEW(pmix_server_caddy_t); \
|
||||
(void) memcpy(&(c)->hdr, &(h), sizeof(pmix_ptl_hdr_t)); \
|
||||
PMIX_RETAIN((s)); \
|
||||
(c)->snd = (s); \
|
||||
} while (0)
|
||||
|
||||
/* queue a message to be sent to one of our procs - must
|
||||
* provide the following params:
|
||||
* p - pmix_peer_t of target recipient
|
||||
* t - tag to be sent to
|
||||
* b - buffer to be sent
|
||||
*/
|
||||
#define PMIX_SERVER_QUEUE_REPLY(r, p, t, b) \
|
||||
do { \
|
||||
pmix_ptl_send_t *snd; \
|
||||
uint32_t nbytes; \
|
||||
pmix_output_verbose(5, pmix_ptl_base_output, \
|
||||
"[%s:%d] queue callback called: reply to %s:%d on tag %d size %d", \
|
||||
__FILE__, __LINE__, (p)->info->pname.nspace, (p)->info->pname.rank, \
|
||||
(t), (int) (b)->bytes_used); \
|
||||
if ((p)->finalized) { \
|
||||
(r) = PMIX_ERR_UNREACH; \
|
||||
} else { \
|
||||
snd = PMIX_NEW(pmix_ptl_send_t); \
|
||||
snd->hdr.pindex = htonl(pmix_globals.pindex); \
|
||||
snd->hdr.tag = htonl(t); \
|
||||
nbytes = (b)->bytes_used; \
|
||||
snd->hdr.nbytes = htonl(nbytes); \
|
||||
snd->data = (b); \
|
||||
/* always start with the header */ \
|
||||
snd->sdptr = (char *) &snd->hdr; \
|
||||
snd->sdbytes = sizeof(pmix_ptl_hdr_t); \
|
||||
/* if there is no message on-deck, put this one there */ \
|
||||
if (NULL == (p)->send_msg) { \
|
||||
(p)->send_msg = snd; \
|
||||
} else { \
|
||||
/* add it to the queue */ \
|
||||
pmix_list_append(&(p)->send_queue, &snd->super); \
|
||||
} \
|
||||
/* ensure the send event is active */ \
|
||||
if (!(p)->send_ev_active && 0 <= (p)->sd) { \
|
||||
(p)->send_ev_active = true; \
|
||||
PMIX_POST_OBJECT(snd); \
|
||||
pmix_event_add(&(p)->send_event, 0); \
|
||||
} \
|
||||
(r) = PMIX_SUCCESS; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define CLOSE_THE_SOCKET(s) \
|
||||
do { \
|
||||
if (0 <= (s)) { \
|
||||
shutdown((s), 2); \
|
||||
close((s)); \
|
||||
(s) = -1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* PMIX_PTL_TYPES_H */
|
||||
Reference in New Issue
Block a user