![]() |
|
|||
File indexing completed on 2025-02-22 10:47:29
0001 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ 0002 /* 0003 * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana 0004 * University Research and Technology 0005 * Corporation. All rights reserved. 0006 * Copyright (c) 2004-2005 The University of Tennessee and The University 0007 * of Tennessee Research Foundation. All rights 0008 * reserved. 0009 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 0010 * University of Stuttgart. All rights reserved. 0011 * Copyright (c) 2004-2005 The Regents of the University of California. 0012 * All rights reserved. 0013 * Copyright (c) 2007-2020 Cisco Systems, Inc. All rights reserved 0014 * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights 0015 * reserved. 0016 * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. 0017 * Copyright (c) 2021-2022 Nanook Consulting All rights reserved. 0018 * $COPYRIGHT$ 0019 * 0020 * Additional copyrights may follow 0021 * 0022 * $HEADER$ 0023 */ 0024 /** 0025 * @file 0026 * 0027 * I/O Forwarding Service 0028 * The I/O forwarding service (IOF) is used to connect stdin, stdout, and 0029 * stderr file descriptor streams from MPI processes to the user 0030 * 0031 * The design is fairly simple: when a proc is spawned, the IOF establishes 0032 * connections between its stdin, stdout, and stderr to a 0033 * corresponding IOF stream. In addition, the IOF designates a separate 0034 * stream for passing OMPI/PRTE internal diagnostic/help output to mpirun. 0035 * This is done specifically to separate such output from the user's 0036 * stdout/err - basically, it allows us to present it to the user in 0037 * a separate format for easier recognition. Data read from a source 0038 * on any stream (e.g., printed to stdout by the proc) is relayed 0039 * by the local daemon to the other end of the stream - i.e., stdin 0040 * is relayed to the local proc, while stdout/err is relayed to mpirun. 0041 * Thus, the eventual result is to connect ALL streams to/from 0042 * the application process and mpirun. 0043 * 0044 * Note: By default, data read from stdin is forwarded -only- to rank=0. 0045 * Stdin for all other procs is tied to "/dev/null". 0046 * 0047 * External tools can "pull" copies of stdout/err and 0048 * the diagnostic stream from mpirun for any process. In this case, 0049 * mpirun will send a copy of the output to the "pulling" process. Note that external tools 0050 * cannot "push" something into stdin unless the user specifically directed 0051 * that stdin remain open, nor under any conditions "pull" a copy of the 0052 * stdin being sent to rank=0. 0053 * 0054 * Tools can exploit either of two mechanisms for this purpose: 0055 * 0056 * (a) call prte_init themselves and utilize the PRTE tool comm 0057 * library to access the IOF. This also provides access to 0058 * other tool library functions - e.g., to order that a job 0059 * be spawned; or 0060 * 0061 * (b) fork/exec the "prte-iof" tool and let it serve as the interface 0062 * to mpirun. This lets the tool avoid calling prte_init, and means 0063 * the tool will not have to compile against the PRTE/OMPI libraries. 0064 * However, the prte-iof tool is limited solely to interfacing 0065 * stdio and cannot be used for other functions included in 0066 * the tool comm library 0067 * 0068 * Thus, mpirun acts as a "switchyard" for IO, taking input from stdin 0069 * and passing it to rank=0 of the job, and taking stdout/err/diag from all 0070 * ranks and passing it to its own stdout/err/diag plus any "pull" 0071 * requestors. 0072 * 0073 * Streams are identified by PRTE process name (to include wildcards, 0074 * such as "all processes in PRTE job X") and tag. There are 0075 * currently only 4 allowed predefined tags: 0076 * 0077 * - PRTE_IOF_STDIN (value 0) 0078 * - PRTE_IOF_STDOUT (value 1) 0079 * - PRTE_IOF_STDERR (value 2) 0080 * - PRTE_IOF_INTERNAL (value 3): for "internal" messages 0081 * from the infrastructure, just to differentiate them from user job 0082 * stdout/stderr 0083 * 0084 * Note that since streams are identified by PRTE process name, the 0085 * caller has no idea whether the stream is on the local node or a 0086 * remote node -- it's just a stream. 0087 * 0088 * IOF components are selected on a "one of many" basis, meaning that 0089 * only one IOF component will be selected for a given process. 0090 * Details for the various components are given in their source code 0091 * bases. 0092 * 0093 * Each IOF component must support the following API: 0094 * 0095 * push: Tie a local file descriptor (*not* a stream!) to the stdin 0096 * of the specified process. If the user has not specified that stdin 0097 * of the specified process is to remain open, this will return an error. 0098 * 0099 * pull: Tie a local file descriptor (*not* a stream!) to a stream. 0100 * Subsequent input that appears via the stream will 0101 * automatically be sent to the target file descriptor until the 0102 * stream is "closed" or an EOF is received on the local file descriptor. 0103 * Valid source values include PRTE_IOF_STDOUT, PRTE_IOF_STDERR, and 0104 * PRTE_IOF_INTERNAL 0105 * 0106 * close: Closes a stream, flushing any pending data down it and 0107 * terminating any "push/pull" connections against it. Unclear yet 0108 * if this needs to be blocking, or can be done non-blocking. 0109 * 0110 * flush: Block until all pending data on all open streams has been 0111 * written down local file descriptors and/or completed sending across 0112 * the OOB to remote process targets. 0113 * 0114 */ 0115 0116 #ifndef PRTE_IOF_H 0117 #define PRTE_IOF_H 0118 0119 #include "prte_config.h" 0120 #include "types.h" 0121 0122 #include "src/mca/mca.h" 0123 #include "src/pmix/pmix-internal.h" 0124 0125 #include "src/runtime/prte_globals.h" 0126 0127 #include "iof_types.h" 0128 0129 BEGIN_C_DECLS 0130 0131 /* Initialize the selected module */ 0132 typedef int (*prte_iof_base_init_fn_t)(void); 0133 0134 /** 0135 * Explicitly push data from the specified input file descriptor to 0136 * the stdin of the indicated peer(s). The provided peer name can 0137 * include wildcard values. 0138 * 0139 * @param peer Name of target peer(s) 0140 * @param fd Local file descriptor for input. 0141 */ 0142 typedef int (*prte_iof_base_push_fn_t)(const pmix_proc_t *peer, prte_iof_tag_t src_tag, int fd); 0143 0144 /** 0145 * Explicitly pull data from the specified set of SOURCE peers and 0146 * dump to the indicated output file descriptor. Any fragments that 0147 * arrive on the stream will automatically be written down the fd. 0148 * 0149 * @param peer Name used to qualify set of origin peers. 0150 * @param source_tag Indicates the output streams to be forwarded 0151 * @param fd Local file descriptor for output. 0152 */ 0153 typedef int (*prte_iof_base_pull_fn_t)(const pmix_proc_t *peer, prte_iof_tag_t source_tag, int fd); 0154 0155 /** 0156 * Close the specified iof stream(s) from the indicated peer(s) 0157 */ 0158 typedef int (*prte_iof_base_close_fn_t)(const pmix_proc_t *peer, prte_iof_tag_t source_tag); 0159 0160 typedef int (*prte_iof_base_push_stdin_fn_t)(const pmix_proc_t *dst_name, uint8_t *data, size_t sz); 0161 0162 /* Flag that a job is complete */ 0163 typedef void (*prte_iof_base_complete_fn_t)(const prte_job_t *jdata); 0164 0165 /* finalize the selected module */ 0166 typedef int (*prte_iof_base_finalize_fn_t)(void); 0167 0168 /** 0169 * IOF module. 0170 */ 0171 struct prte_iof_base_module_2_0_0_t { 0172 prte_iof_base_init_fn_t init; 0173 prte_iof_base_push_fn_t push; 0174 prte_iof_base_pull_fn_t pull; 0175 prte_iof_base_close_fn_t close; 0176 prte_iof_base_complete_fn_t complete; 0177 prte_iof_base_finalize_fn_t finalize; 0178 prte_iof_base_push_stdin_fn_t push_stdin; 0179 }; 0180 0181 typedef struct prte_iof_base_module_2_0_0_t prte_iof_base_module_2_0_0_t; 0182 typedef prte_iof_base_module_2_0_0_t prte_iof_base_module_t; 0183 PRTE_EXPORT extern prte_iof_base_module_t prte_iof; 0184 0185 typedef pmix_mca_base_component_t prte_iof_base_component_t; 0186 0187 END_C_DECLS 0188 0189 /* 0190 * Macro for use in components that are of type iof 0191 */ 0192 #define PRTE_IOF_BASE_VERSION_2_0_0 PRTE_MCA_BASE_VERSION_3_0_0("iof", 2, 0, 0) 0193 0194 #endif /* PRTE_IOF_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |