Upgrade macos

This commit is contained in:
Bassem Girgis
2025-03-19 08:52:56 -05:00
parent 53580cb51f
commit d29ef955f5
8041 changed files with 1936720 additions and 130842 deletions

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 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-2013 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2017-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef PRTE_MCA_ERRMGR_BASE_H
#define PRTE_MCA_ERRMGR_BASE_H
/*
* includes
*/
#include "prte_config.h"
#include "constants.h"
#include "src/class/pmix_list.h"
#include "src/mca/errmgr/errmgr.h"
#include "src/mca/mca.h"
BEGIN_C_DECLS
/*
* MCA Framework
*/
PRTE_EXPORT extern pmix_mca_base_framework_t prte_errmgr_base_framework;
/* select a component */
PRTE_EXPORT int prte_errmgr_base_select(void);
END_C_DECLS
#endif

View File

@@ -0,0 +1,60 @@
/*
* Copyright (c) 2004-2010 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-2010 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) 2010-2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2011 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2017-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2024 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef PRTE_MCA_ERRMGR_PRIVATE_H
#define PRTE_MCA_ERRMGR_PRIVATE_H
/*
* includes
*/
#include "prte_config.h"
#include "constants.h"
#include "types.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
#include "src/mca/plm/plm_types.h"
#include "src/runtime/prte_globals.h"
#include "src/mca/errmgr/errmgr.h"
/*
* Functions for use solely within the ERRMGR framework
*/
BEGIN_C_DECLS
/* declare the base default module */
PRTE_EXPORT extern prte_errmgr_base_module_t prte_errmgr_default_fns;
/*
* Base functions
*/
PRTE_EXPORT void prte_errmgr_base_log(int error_code, char *filename, int line);
END_C_DECLS
#endif

View File

@@ -0,0 +1,141 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 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) 2009-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2010-2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2013-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2014 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2021-2024 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
* The PRTE Error and Recovery Manager (ErrMgr)
*
* This framework is the logically central clearing house for process/daemon
* state updates. In particular when a process fails and another process detects
* it, then that information is reported through this framework. This framework
* then (depending on the active component) decides how to handle the failure.
*
* For example, if a process fails this may activate an automatic recovery
* of the process from a previous checkpoint, or initial state. Conversely,
* the active component could decide not to continue the job, and request that
* it be terminated. The error and recovery policy is determined by individual
* components within this framework.
*
*/
#ifndef PRTE_MCA_ERRMGR_H
#define PRTE_MCA_ERRMGR_H
/*
* includes
*/
#include "prte_config.h"
#include "constants.h"
#include "types.h"
#include "src/pmix/pmix-internal.h"
#include "src/mca/base/pmix_base.h"
#include "src/mca/mca.h"
#include "src/class/pmix_object.h"
#include "src/class/pmix_pointer_array.h"
#include "src/util/error.h"
#include "src/util/pmix_output.h"
#include "src/mca/plm/plm_types.h"
#include "src/runtime/prte_globals.h"
BEGIN_C_DECLS
/*
* Macro definitions
*/
/*
* Thess macros and associated error name array are used to output intelligible error
* messages.
*/
#define PRTE_ERROR_NAME(n) prte_strerror(n)
/*
* Framework Interfaces
*/
/**
* Module initialization function.
*
* @retval PRTE_SUCCESS The operation completed successfully
* @retval PRTE_ERROR An unspecifed error occurred
*/
typedef int (*prte_errmgr_base_module_init_fn_t)(void);
/**
* Module finalization function.
*
* @retval PRTE_SUCCESS The operation completed successfully
* @retval PRTE_ERROR An unspecifed error occurred
*/
typedef int (*prte_errmgr_base_module_finalize_fn_t)(void);
/**
* This is not part of any module so it can be used at any time!
*/
typedef void (*prte_errmgr_base_module_log_fn_t)(int error_code, char *filename, int line);
/*
* Module Structure
*/
struct prte_errmgr_base_module_2_3_0_t {
/** Initialization Function */
prte_errmgr_base_module_init_fn_t init;
/** Finalization Function */
prte_errmgr_base_module_finalize_fn_t finalize;
prte_errmgr_base_module_log_fn_t logfn;
};
typedef struct prte_errmgr_base_module_2_3_0_t prte_errmgr_base_module_2_3_0_t;
typedef prte_errmgr_base_module_2_3_0_t prte_errmgr_base_module_t;
PRTE_EXPORT extern prte_errmgr_base_module_t prte_errmgr;
/*
* ErrMgr Component
*/
struct prte_errmgr_base_component_3_0_0_t {
/** MCA base component */
pmix_mca_base_component_t base_version;
/** Verbosity Level */
int verbose;
/** Output Handle for pmix_output */
int output_handle;
/** Default Priority */
int priority;
};
typedef struct prte_errmgr_base_component_3_0_0_t prte_errmgr_base_component_3_0_0_t;
typedef prte_errmgr_base_component_3_0_0_t prte_errmgr_base_component_t;
/*
* Macro for use in components that are of type errmgr
*/
#define PRTE_ERRMGR_BASE_VERSION_3_0_0 PRTE_MCA_BASE_VERSION_3_0_0("errmgr", 3, 0, 0)
END_C_DECLS
#endif

View File

@@ -0,0 +1,96 @@
/*
* 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) 2011-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
* Copyright (c) 2013-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef MCA_ESS_BASE_H
#define MCA_ESS_BASE_H
#include "prte_config.h"
#include "types.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/mca/mca.h"
#include "src/pmix/pmix-internal.h"
#include "src/mca/ess/ess.h"
BEGIN_C_DECLS
/*
* MCA Framework
*/
PRTE_EXPORT extern pmix_mca_base_framework_t prte_ess_base_framework;
/**
* Select a ess module
*/
PRTE_EXPORT int prte_ess_base_select(void);
/*
* stdout/stderr buffering control parameter
*/
PRTE_EXPORT extern int prte_ess_base_std_buffering;
PRTE_EXPORT extern int prte_ess_base_num_procs;
PRTE_EXPORT extern char *prte_ess_base_nspace;
PRTE_EXPORT extern char *prte_ess_base_vpid;
PRTE_EXPORT extern pmix_list_t prte_ess_base_signals;
/*
* Internal helper functions used by components
*/
PRTE_EXPORT int prte_ess_env_get(void);
PRTE_EXPORT int prte_ess_base_std_prolog(void);
PRTE_EXPORT int prte_ess_base_prted_setup(void);
PRTE_EXPORT int prte_ess_base_prted_finalize(void);
PRTE_EXPORT int prte_ess_base_setup_signals(char *signals);
/* Detect whether or not this proc is bound - if not,
* see if it should bind itself
*/
PRTE_EXPORT int prte_ess_base_proc_binding(void);
/*
* Put functions
*/
PRTE_EXPORT int prte_ess_env_put(int32_t num_procs, int32_t num_local_procs, char ***env);
/* read a bootstrap configuration file */
PRTE_EXPORT int prte_ess_base_bootstrap(void);
typedef struct {
pmix_list_item_t super;
char *signame;
int signal;
bool can_forward;
} prte_ess_base_signal_t;
PMIX_CLASS_DECLARATION(prte_ess_base_signal_t);
END_C_DECLS
#endif

View File

@@ -0,0 +1,84 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2010 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) 2011-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2012-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2018-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2021-2024 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
* The PRTE Environment-Specific Services
*
*/
#ifndef PRTE_ESS_H
#define PRTE_ESS_H
#include "prte_config.h"
#include "types.h"
#include "src/hwloc/hwloc-internal.h"
#include "src/pmix/pmix-internal.h"
#include "src/mca/mca.h"
#include "src/runtime/runtime.h"
#include "src/util/proc_info.h"
BEGIN_C_DECLS
/*
* API functions
*/
/*
* Initialize the RTE for this environment
*/
typedef int (*prte_ess_base_module_init_fn_t)(int argc, char **argv);
/*
* Finalize the RTE for this environment
*/
typedef int (*prte_ess_base_module_finalize_fn_t)(void);
/*
* the standard module data structure
*/
struct prte_ess_base_module_3_0_0_t {
prte_ess_base_module_init_fn_t init;
prte_ess_base_module_finalize_fn_t finalize;
};
typedef struct prte_ess_base_module_3_0_0_t prte_ess_base_module_3_0_0_t;
typedef struct prte_ess_base_module_3_0_0_t prte_ess_base_module_t;
/*
* the standard component data structure
*/
typedef pmix_mca_base_component_t prte_ess_base_component_t;
/*
* Macro for use in components that are of type ess
*/
#define PRTE_ESS_BASE_VERSION_3_0_0 PRTE_MCA_BASE_VERSION_3_0_0("ess", 3, 0, 0)
/* Global structure for accessing ESS functions */
PRTE_EXPORT extern prte_ess_base_module_t prte_ess; /* holds selected module's function pointers */
END_C_DECLS
#endif

View File

@@ -0,0 +1,91 @@
/*
* Copyright (c) 2004-2009 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-2013 Los Alamos National Security, LLC.
* All rights reserved
* Copyright (c) 2018-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PRTE_FILEM_BASE_H
#define PRTE_FILEM_BASE_H
#include "prte_config.h"
#include "src/mca/filem/filem.h"
#include "src/rml/rml.h"
#include "src/pmix/pmix-internal.h"
#include "src/util/pmix_printf.h"
BEGIN_C_DECLS
/*
* MCA framework
*/
PRTE_EXPORT extern pmix_mca_base_framework_t prte_filem_base_framework;
/*
* Select an available component.
*/
PRTE_EXPORT int prte_filem_base_select(void);
/*
* cmds for base receive
*/
typedef uint8_t prte_filem_cmd_flag_t;
#define PRTE_FILEM_CMD PMIX_UINT8
#define PRTE_FILEM_GET_PROC_NODE_NAME_CMD 1
#define PRTE_FILEM_GET_REMOTE_PATH_CMD 2
/**
* Globals
*/
PRTE_EXPORT extern prte_filem_base_module_t prte_filem;
PRTE_EXPORT extern bool prte_filem_base_is_active;
/**
* 'None' component functions
* These are to be used when no component is selected.
* They just return success, and empty strings as necessary.
*/
int prte_filem_base_module_init(void);
int prte_filem_base_module_finalize(void);
PRTE_EXPORT int prte_filem_base_none_put(prte_filem_base_request_t *request);
PRTE_EXPORT int prte_filem_base_none_put_nb(prte_filem_base_request_t *request);
PRTE_EXPORT int prte_filem_base_none_get(prte_filem_base_request_t *request);
PRTE_EXPORT int prte_filem_base_none_get_nb(prte_filem_base_request_t *request);
PRTE_EXPORT int prte_filem_base_none_rm(prte_filem_base_request_t *request);
PRTE_EXPORT int prte_filem_base_none_rm_nb(prte_filem_base_request_t *request);
PRTE_EXPORT int prte_filem_base_none_wait(prte_filem_base_request_t *request);
PRTE_EXPORT int prte_filem_base_none_wait_all(pmix_list_t *request_list);
int prte_filem_base_none_preposition_files(prte_job_t *jdata, prte_filem_completion_cbfunc_t cbfunc,
void *cbdata);
int prte_filem_base_none_link_local_files(prte_job_t *jdata, prte_app_context_t *app);
/**
* Some utility functions
*/
/* base comm functions */
PRTE_EXPORT int prte_filem_base_comm_start(void);
PRTE_EXPORT int prte_filem_base_comm_stop(void);
PRTE_EXPORT void prte_filem_base_recv(int status, pmix_proc_t *sender, pmix_data_buffer_t *buffer,
prte_rml_tag_t tag, void *cbdata);
END_C_DECLS
#endif /* PRTE_FILEM_BASE_H */

View File

@@ -0,0 +1,385 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2009 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-2015 Los Alamos National Security, LLC. All rights
* reserved
* Copyright (c) 2019 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* Remote File Management (FileM) Interface
*
*/
#ifndef MCA_FILEM_H
#define MCA_FILEM_H
#include "prte_config.h"
#include "constants.h"
#include "types.h"
#include "src/pmix/pmix-internal.h"
#include "src/mca/base/pmix_base.h"
#include "src/mca/mca.h"
#include "src/class/pmix_object.h"
#include "src/runtime/prte_globals.h"
BEGIN_C_DECLS
/**
* A set of flags that determine the type of the file
* in question
*/
#define PRTE_FILEM_TYPE_FILE 0
#define PRTE_FILEM_TYPE_DIR 1
#define PRTE_FILEM_TYPE_UNKNOWN 2
#define PRTE_FILEM_TYPE_TAR 3
#define PRTE_FILEM_TYPE_BZIP 4
#define PRTE_FILEM_TYPE_GZIP 5
#define PRTE_FILEM_TYPE_EXE 6
/**
* Type of movement
*/
#define PRTE_FILEM_MOVE_TYPE_PUT 0
#define PRTE_FILEM_MOVE_TYPE_GET 1
#define PRTE_FILEM_MOVE_TYPE_RM 2
#define PRTE_FILEM_MOVE_TYPE_UNKNOWN 3
/**
* Hints that describe the local or remote file target for
* optimization purposes.
*/
#define PRTE_FILEM_HINT_NONE 0
#define PRTE_FILEM_HINT_SHARED 1
/**
* Define a Process Set
*
* Source: A single source of the operation.
* Sink: Desitination of the operation.
*/
struct prte_filem_base_process_set_1_0_0_t {
/** This is an object, so must have a super */
pmix_list_item_t super;
/** Source Process */
pmix_proc_t source;
/** Sink Process */
pmix_proc_t sink;
};
typedef struct prte_filem_base_process_set_1_0_0_t prte_filem_base_process_set_1_0_0_t;
typedef struct prte_filem_base_process_set_1_0_0_t prte_filem_base_process_set_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_filem_base_process_set_t);
/**
* Define a File Pair
*
* Local: Local file reference
* Remove: Remote file reference
*
* Note: If multiple process sinks are used it is assumed that the
* file reference is the same for each of the sinks. If this is not
* true then more than one filem request needs to be created.
*/
struct prte_filem_base_file_set_1_0_0_t {
/** This is an object, so must have a super */
pmix_list_item_t super;
/* the app_index this pertains to, if applicable */
prte_app_idx_t app_idx;
/* Local file reference */
char *local_target;
/* Local file reference hints */
int local_hint;
/* Remove file reference */
char *remote_target;
/* Remote file reference hints */
int remote_hint;
/* Type of file to move */
int target_flag;
};
typedef struct prte_filem_base_file_set_1_0_0_t prte_filem_base_file_set_1_0_0_t;
typedef struct prte_filem_base_file_set_1_0_0_t prte_filem_base_file_set_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_filem_base_file_set_t);
/**
* Definition of a file movement request
* This will allow:
* - The movement of one or more files
* - to/from one or more processes
* in a single call of the API function. Allowing the implementation
* to optimize the sending/receiving of data.
* Used for the following:
*
*/
struct prte_filem_base_request_1_0_0_t {
/** This is an object, so must have a super */
pmix_list_item_t super;
/*
* A list of process sets - use WILDCARD to
* indicate all procs of a given vpid/jobid,
* INVALID to indicate not-applicable. For
* example, if you need to move a file at time
* of job start to each node that has a proc
* on it, then the process set would have a
* source proc with vpid=INVALID and a sink proc
* with vpid=WILDCARD, and a remote hint of "shared"
* in the file sets so we don't copy them over
* multiple times
*/
pmix_list_t process_sets;
/*
* A list of file pairings
*/
pmix_list_t file_sets;
/*
* Internal use:
* Number of movements
*/
int num_mv;
/*
* Internal use:
* Boolean to indianate if transfer is complete
*/
bool *is_done;
/*
* Internal use:
* Boolean to indianate if transfer is active
*/
bool *is_active;
/*
* Internal use:
* Exit status of the copy command
*/
int32_t *exit_status;
/*
* Internal use:
* Movement type
*/
int movement_type;
};
typedef struct prte_filem_base_request_1_0_0_t prte_filem_base_request_1_0_0_t;
typedef struct prte_filem_base_request_1_0_0_t prte_filem_base_request_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_filem_base_request_t);
/**
* Module initialization function.
* Returns PRTE_SUCCESS
*/
typedef int (*prte_filem_base_module_init_fn_t)(void);
/**
* Module finalization function.
* Returns PRTE_SUCCESS
*/
typedef int (*prte_filem_base_module_finalize_fn_t)(void);
/**
* Put a file or directory on the remote machine
*
* Note: By using a relative path for the remote file/directory, the filem
* component will negotiate the correct absolute path for that file/directory
* for the remote machine.
*
* @param request FileM request describing the files/directories to send,
* the remote files/directories to use, and the processes to see the change.
*
* @return PRTE_SUCCESS on successful file transer
* @return PRTE_ERROR on failed file transfer
*/
typedef int (*prte_filem_base_put_fn_t)(prte_filem_base_request_t *request);
/**
* Put a file or directory on the remote machine (Async)
*
* Note: By using a relative path for the remote file/directory, the filem
* component will negotiate the correct absolute path for that file/directory
* for the remote machine.
*
* @param request FileM request describing the files/directories to send,
* the remote files/directories to use, and the processes to see the change.
*
* @return PRTE_SUCCESS on successful file transer
* @return PRTE_ERROR on failed file transfer
*/
typedef int (*prte_filem_base_put_nb_fn_t)(prte_filem_base_request_t *request);
/**
* Get a file from the remote machine
*
* Note: By using a relative path for the remote file/directory, the filem
* component will negotiate the correct absolute path for that file/directory
* for the remote machine.
*
* @param request FileM request describing the files/directories to receive,
* the remote files/directories to use, and the processes to see the change.
*
* @return PRTE_SUCCESS on successful file transer
* @return PRTE_ERROR on failed file transfer
*/
typedef int (*prte_filem_base_get_fn_t)(prte_filem_base_request_t *request);
/**
* Get a file from the remote machine (Async)
*
* Note: By using a relative path for the remote file/directory, the filem
* component will negotiate the correct absolute path for that file/directory
* for the remote machine.
*
* @param request FileM request describing the files/directories to receive,
* the remote files/directories to use, and the processes to see the change.
*
* @return PRTE_SUCCESS on successful file transer
* @return PRTE_ERROR on failed file transfer
*/
typedef int (*prte_filem_base_get_nb_fn_t)(prte_filem_base_request_t *request);
/**
* Remove a file from the remote machine
*
* Note: By using a relative path for the remote file/directory, the filem
* component will negotiate the correct absolute path for that file/directory
* for the remote machine.
*
* @param request FileM request describing the remote files/directories to remove,
* the processes to see the change.
*
* @return PRTE_SUCCESS on success
* @return PRTE_ERROR on fail
*/
typedef int (*prte_filem_base_rm_fn_t)(prte_filem_base_request_t *request);
/**
* Remove a file from the remote machine (Async)
*
* Note: By using a relative path for the remote file/directory, the filem
* component will negotiate the correct absolute path for that file/directory
* for the remote machine.
*
* @param request FileM request describing the remote files/directories to remove,
* the processes to see the change.
*
* @return PRTE_SUCCESS on success
* @return PRTE_ERROR on fail
*/
typedef int (*prte_filem_base_rm_nb_fn_t)(prte_filem_base_request_t *request);
/**
* Wait for a single file movement request to finish
*
* @param request FileM request describing the remote files/directories.
*
* The request must have been passed through one of the non-blocking functions
* before calling wait or wait_all otherwise PRTE_ERROR will be returned.
*
* @return PRTE_SUCCESS on success
* @return PRTE_ERROR on fail
*/
typedef int (*prte_filem_base_wait_fn_t)(prte_filem_base_request_t *request);
/**
* Wait for a multiple file movement requests to finish
*
* @param request_list pmix_list_t of FileM requests describing the remote files/directories.
*
* The request must have been passed through one of the non-blocking functions
* before calling wait or wait_all otherwise PRTE_ERROR will be returned.
*
* @return PRTE_SUCCESS on success
* @return PRTE_ERROR on fail
*/
typedef int (*prte_filem_base_wait_all_fn_t)(pmix_list_t *request_list);
typedef void (*prte_filem_completion_cbfunc_t)(int status, void *cbdata);
/* Pre-position files
*/
typedef int (*prte_filem_base_preposition_files_fn_t)(prte_job_t *jdata,
prte_filem_completion_cbfunc_t cbfunc,
void *cbdata);
/* link local files */
typedef int (*prte_filem_base_link_local_files_fn_t)(prte_job_t *jdata, prte_app_context_t *app);
/**
* Structure for FILEM components.
*/
typedef pmix_mca_base_component_t prte_filem_base_component_t;
/**
* Structure for FILEM modules
*/
struct prte_filem_base_module_1_0_0_t {
/** Initialization Function */
prte_filem_base_module_init_fn_t filem_init;
/** Finalization Function */
prte_filem_base_module_finalize_fn_t filem_finalize;
/** Put a file on the remote machine */
prte_filem_base_put_fn_t put;
prte_filem_base_put_nb_fn_t put_nb;
/** Get a file from the remote machine */
prte_filem_base_get_fn_t get;
prte_filem_base_get_nb_fn_t get_nb;
/** Remove a file on the remote machine */
prte_filem_base_rm_fn_t rm;
prte_filem_base_rm_nb_fn_t rm_nb;
/** Test functions for the non-blocking versions */
prte_filem_base_wait_fn_t wait;
prte_filem_base_wait_all_fn_t wait_all;
/* pre-position files to every node */
prte_filem_base_preposition_files_fn_t preposition_files;
/* create local links for all shared files */
prte_filem_base_link_local_files_fn_t link_local_files;
};
typedef struct prte_filem_base_module_1_0_0_t prte_filem_base_module_1_0_0_t;
typedef struct prte_filem_base_module_1_0_0_t prte_filem_base_module_t;
PRTE_EXPORT extern prte_filem_base_module_t prte_filem;
/**
* Macro for use in components that are of type FILEM
*/
#define PRTE_FILEM_BASE_VERSION_2_0_0 PRTE_MCA_BASE_VERSION_3_0_0("filem", 2, 0, 0)
END_C_DECLS
#endif /* PRTE_FILEM_H */

View File

@@ -0,0 +1,94 @@
/*
* 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) 2011-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2017-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2021-2023 Nanook Consulting All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef MCA_GRPCOMM_BASE_H
#define MCA_GRPCOMM_BASE_H
/*
* includes
*/
#include "prte_config.h"
#include "src/class/pmix_hash_table.h"
#include "src/class/pmix_list.h"
#include "src/hwloc/hwloc-internal.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/mca/grpcomm/grpcomm.h"
#include "src/mca/mca.h"
#include "src/mca/odls/odls_types.h"
#include "src/rml/rml_types.h"
#include "src/pmix/pmix-internal.h"
/*
* Global functions for MCA overall collective open and close
*/
BEGIN_C_DECLS
/*
* MCA framework
*/
PRTE_EXPORT extern pmix_mca_base_framework_t prte_grpcomm_base_framework;
/*
* Select an available component.
*/
PRTE_EXPORT int prte_grpcomm_base_select(void);
/*
* globals that might be needed
*/
typedef struct {
pmix_list_item_t super;
int pri;
prte_grpcomm_base_module_t *module;
pmix_mca_base_component_t *component;
} prte_grpcomm_base_active_t;
PMIX_CLASS_DECLARATION(prte_grpcomm_base_active_t);
typedef struct {
pmix_list_t actives;
pmix_list_t ongoing;
pmix_hash_table_t sig_table;
char *transports;
uint32_t context_id;
} prte_grpcomm_base_t;
PRTE_EXPORT extern prte_grpcomm_base_t prte_grpcomm_base;
/* Public API stubs */
PRTE_EXPORT int prte_grpcomm_API_xcast(prte_grpcomm_signature_t *sig, prte_rml_tag_t tag,
pmix_data_buffer_t *buf);
PRTE_EXPORT int prte_grpcomm_API_allgather(prte_pmix_mdx_caddy_t *cd);
PRTE_EXPORT prte_grpcomm_coll_t *prte_grpcomm_base_get_tracker(prte_grpcomm_signature_t *sig,
bool create);
PRTE_EXPORT int prte_pack_ctrl_options(pmix_byte_object_t *bo,
const pmix_info_t *info, size_t ninfo);
END_C_DECLS
#endif

View File

@@ -0,0 +1,236 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2008 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) 2011-2016 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2023 Nanook Consulting All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
* The PRTE Group Communications
*
* The PRTE Group Comm framework provides communication services that
* span entire jobs or collections of processes. It is not intended to be
* used for point-to-point communications (the RML does that), nor should
* it be viewed as a high-performance communication channel for large-scale
* data transfers.
*/
#ifndef MCA_GRPCOMM_H
#define MCA_GRPCOMM_H
/*
* includes
*/
#include "prte_config.h"
#include "constants.h"
#include "types.h"
#include "src/class/pmix_bitmap.h"
#include "src/class/pmix_list.h"
#include "src/pmix/pmix-internal.h"
#include "src/mca/mca.h"
#include "src/rml/rml_types.h"
BEGIN_C_DECLS
/* define a callback function to be invoked upon
* collective completion */
typedef void (*prte_grpcomm_cbfunc_t)(int status, pmix_data_buffer_t *buf, void *cbdata);
typedef int (*prte_grpcomm_rbcast_cb_t)(pmix_data_buffer_t *buffer);
/* Define a collective signature so we don't need to
* track global collective id's */
typedef struct {
pmix_object_t super;
pmix_proc_t *signature;
size_t sz;
} prte_grpcomm_signature_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_grpcomm_signature_t);
/* Internal component object for tracking ongoing
* allgather operations */
typedef struct {
pmix_list_item_t super;
/* collective's signature */
prte_grpcomm_signature_t *sig;
pmix_status_t status;
/* collection bucket */
pmix_data_buffer_t bucket;
/* participating daemons */
pmix_rank_t *dmns;
/** number of participating daemons */
size_t ndmns;
/** my index in the dmns array */
unsigned long my_rank;
/* number of buckets expected */
size_t nexpected;
/* number reported in */
size_t nreported;
/* controls values */
bool assignID;
int timeout;
size_t memsize;
pmix_list_t addmembers;
/* distance masks for receive */
pmix_bitmap_t distance_mask_recv;
/* received buckets */
pmix_data_buffer_t **buffers;
/* callback function */
prte_grpcomm_cbfunc_t cbfunc;
/* user-provided callback data */
void *cbdata;
} prte_grpcomm_coll_t;
PMIX_CLASS_DECLARATION(prte_grpcomm_coll_t);
typedef struct {
pmix_object_t super;
prte_event_t ev;
prte_grpcomm_signature_t *sig;
pmix_group_operation_t op;
char *grpid;
pmix_data_buffer_t *buf;
pmix_byte_object_t ctrls;
pmix_proc_t *procs;
size_t nprocs;
pmix_info_t *info;
size_t ninfo;
prte_grpcomm_cbfunc_t grpcbfunc;
pmix_modex_cbfunc_t mdxcbfunc;
pmix_info_cbfunc_t infocbfunc;
pmix_op_cbfunc_t opcbfunc;
void *cbdata;
void *relcbdata;
} prte_pmix_mdx_caddy_t;
PMIX_CLASS_DECLARATION(prte_pmix_mdx_caddy_t);
/*
* Component functions - all MUST be provided!
*/
/* initialize the selected module */
typedef int (*prte_grpcomm_base_module_init_fn_t)(void);
/* finalize the selected module */
typedef void (*prte_grpcomm_base_module_finalize_fn_t)(void);
/* Scalably send a message. Caller will provide an array
* of daemon vpids that are to receive the message. A NULL
* pointer indicates that all daemons are participating. */
typedef int (*prte_grpcomm_base_module_xcast_fn_t)(pmix_rank_t *vpids, size_t nprocs,
pmix_data_buffer_t *msg);
/* allgather - gather data from all specified daemons. Barrier operations
* will provide a zero-byte buffer. Caller will provide an array
* of daemon vpids that are participating in the allgather via the
* prte_grpcomm_coll_t object. A NULL pointer indicates that all daemons
* are participating.
*
* NOTE: this is a non-blocking call. The callback function cached in
* the prte_grpcomm_coll_t will be invoked upon completion. */
typedef int (*prte_grpcomm_base_module_allgather_fn_t)(prte_grpcomm_coll_t *coll,
prte_pmix_mdx_caddy_t *cd);
/* Reliable broadcast a message thru BMG.
* only need to provide a message buffer, dont need create dmns
*/
typedef int (*prte_grpcomm_base_module_rbcast_fn_t)(pmix_data_buffer_t *msg);
typedef int (*prte_grpcomm_base_module_rbcast_register_cb_fn_t)(prte_grpcomm_rbcast_cb_t callback);
typedef int (*prte_grpcomm_base_module_rbcast_unregister_cb_fn_t)(int type);
/*
* Ver 3.0 - internal modules
*/
typedef struct {
prte_grpcomm_base_module_init_fn_t init;
prte_grpcomm_base_module_finalize_fn_t finalize;
/* collective operations */
prte_grpcomm_base_module_xcast_fn_t xcast;
prte_grpcomm_base_module_allgather_fn_t allgather;
prte_grpcomm_base_module_rbcast_fn_t rbcast;
prte_grpcomm_base_module_rbcast_register_cb_fn_t register_cb;
prte_grpcomm_base_module_rbcast_unregister_cb_fn_t unregister_cb;
} prte_grpcomm_base_module_t;
/* the Public APIs */
/* Scalably send a message. Caller will provide an array
* of process names that are to receive the message. A NULL
* pointer indicates that all known procs are to receive
* the message. A pointer to a name that includes PRTE_VPID_WILDCARD
* will send the message to all procs in the specified jobid.
* The message will be sent to the daemons hosting the specified
* procs for processing and relay. */
typedef int (*prte_grpcomm_base_API_xcast_fn_t)(prte_grpcomm_signature_t *sig, prte_rml_tag_t tag,
pmix_data_buffer_t *msg);
/* allgather - gather data from all specified procs. Barrier operations
* will provide a zero-byte buffer. Caller will provide an array
* of application proc vpids that are participating in the allgather. A NULL
* pointer indicates that all known procs are participating. A pointer
* to a name that includes PRTE_VPID_WILDCARD indicates that all procs
* in the specified jobid are contributing.
*
* NOTE: this is a non-blocking call. The provided callback function
* will be invoked upon completion. */
typedef int (*prte_grpcomm_base_API_allgather_fn_t)(prte_pmix_mdx_caddy_t *cd);
/* Reliable broadcast a message. Caller will provide an array
* of daemon. A NULL pointer indicates that all known daemons are in the BMG.
* A pointer to a name that includes ORTE_VPID_WILDCARD
* all daemons in the specified jobid.*/
typedef int (*prte_grpcomm_base_API_rbcast_fn_t)(prte_grpcomm_signature_t *sig, prte_rml_tag_t tag,
pmix_data_buffer_t *msg);
typedef int (*prte_grpcomm_base_API_rbcast_register_cb_fn_t)(prte_grpcomm_rbcast_cb_t callback);
typedef int (*prte_grpcomm_base_API_rbcast_unregister_cb_fn_t)(int type);
typedef struct {
/* collective operations */
prte_grpcomm_base_API_xcast_fn_t xcast;
prte_grpcomm_base_API_allgather_fn_t allgather;
prte_grpcomm_base_API_rbcast_fn_t rbcast;
prte_grpcomm_base_API_rbcast_register_cb_fn_t register_cb;
prte_grpcomm_base_API_rbcast_unregister_cb_fn_t unregister_cb;
} prte_grpcomm_API_module_t;
/*
* the standard component data structure
*/
typedef pmix_mca_base_component_t prte_grpcomm_base_component_t;
/*
* Macro for use in components that are of type grpcomm v3.0.0
*/
#define PRTE_GRPCOMM_BASE_VERSION_3_0_0 \
/* grpcomm v3.0 is chained to MCA v2.0 */ \
PRTE_MCA_BASE_VERSION_3_0_0("grpcomm", 3, 0, 0)
/* Global structure for accessing grpcomm functions */
PRTE_EXPORT extern prte_grpcomm_API_module_t prte_grpcomm;
END_C_DECLS
#endif

View File

@@ -0,0 +1,257 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 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) 2008-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2015-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2017 Mellanox Technologies. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* I/O Forwarding Service
*/
#ifndef MCA_IOF_BASE_H
#define MCA_IOF_BASE_H
#include "prte_config.h"
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#ifdef HAVE_NET_UIO_H
# include <net/uio.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <signal.h>
#include "src/class/pmix_bitmap.h"
#include "src/class/pmix_list.h"
#include "src/event/event-internal.h"
#include "src/mca/mca.h"
#include "src/pmix/pmix-internal.h"
#include "src/util/pmix_fd.h"
#include "src/mca/errmgr/errmgr.h"
#include "src/mca/iof/iof.h"
#include "src/rml/rml_types.h"
#include "src/runtime/prte_globals.h"
#include "src/threads/pmix_threads.h"
BEGIN_C_DECLS
/*
* MCA framework
*/
PRTE_EXPORT extern pmix_mca_base_framework_t prte_iof_base_framework;
/*
* Select an available component.
*/
PRTE_EXPORT int prte_iof_base_select(void);
/*
* Maximum size of single msg
*/
#define PRTE_IOF_BASE_MSG_MAX 4096
#define PRTE_IOF_BASE_TAG_MAX 1024
#define PRTE_IOF_BASE_TAGGED_OUT_MAX 8192
#define PRTE_IOF_MAX_INPUT_BUFFERS 50
typedef struct {
pmix_list_item_t super;
bool pending;
bool always_writable;
prte_event_t *ev;
struct timeval tv;
int fd;
pmix_list_t outputs;
} prte_iof_write_event_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_iof_write_event_t);
typedef struct {
pmix_list_item_t super;
pmix_proc_t name;
pmix_proc_t daemon;
prte_iof_tag_t tag;
prte_iof_write_event_t *wev;
bool xoff;
bool exclusive;
bool closed;
} prte_iof_sink_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_iof_sink_t);
struct prte_iof_proc_t;
typedef struct {
pmix_object_t super;
struct prte_iof_proc_t *proc;
prte_event_t *ev;
struct timeval tv;
int fd;
prte_iof_tag_t tag;
bool active;
bool activated;
bool always_readable;
prte_iof_sink_t *sink;
} prte_iof_read_event_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_iof_read_event_t);
typedef struct {
pmix_list_item_t super;
pmix_proc_t name;
prte_iof_sink_t *stdinev;
prte_iof_read_event_t *revstdout;
prte_iof_read_event_t *revstderr;
} prte_iof_proc_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_iof_proc_t);
typedef struct {
pmix_list_item_t super;
char data[PRTE_IOF_BASE_TAGGED_OUT_MAX];
int numbytes;
} prte_iof_write_output_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_iof_write_output_t);
typedef struct{
pmix_object_t super;
pmix_proc_t source;
pmix_byte_object_t bo;
} prte_iof_deliver_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_iof_deliver_t);
/* Write event macro's */
static inline bool prte_iof_base_fd_always_ready(int fd)
{
return pmix_fd_is_regular(fd) || (pmix_fd_is_chardev(fd) && !isatty(fd))
|| pmix_fd_is_blkdev(fd);
}
#define PRTE_IOF_SINK_BLOCKSIZE (1024)
#define PRTE_IOF_SINK_ACTIVATE(wev) \
do { \
struct timeval *tv = NULL; \
wev->pending = true; \
PMIX_POST_OBJECT(wev); \
if (wev->always_writable) { \
/* Regular is always write ready. Use timer to activate */ \
tv = &wev->tv; \
} \
if (prte_event_add(wev->ev, tv)) { \
PRTE_ERROR_LOG(PRTE_ERR_BAD_PARAM); \
} \
} while (0);
/* define an output "sink", adding it to the provided
* endpoint list for this proc */
#define PRTE_IOF_SINK_DEFINE(snk, nm, fid, tg, wrthndlr) \
do { \
prte_iof_sink_t *ep; \
PMIX_OUTPUT_VERBOSE((1, prte_iof_base_framework.framework_output, \
"defining endpt: file %s line %d fd %d", __FILE__, __LINE__, (fid))); \
ep = PMIX_NEW(prte_iof_sink_t); \
PMIX_LOAD_PROCID(&ep->name, (nm)->nspace, (nm)->rank); \
ep->tag = (tg); \
if (0 <= (fid)) { \
ep->wev->fd = (fid); \
ep->wev->always_writable = prte_iof_base_fd_always_ready(fid); \
if (ep->wev->always_writable) { \
prte_event_evtimer_set(prte_event_base, ep->wev->ev, wrthndlr, ep); \
} else { \
prte_event_set(prte_event_base, ep->wev->ev, ep->wev->fd, PRTE_EV_WRITE, wrthndlr, \
ep); \
} \
} \
*(snk) = ep; \
PMIX_POST_OBJECT(ep); \
} while (0);
/* Read event macro's */
#define PRTE_IOF_READ_ADDEV(rev) \
do { \
struct timeval *tv = NULL; \
if (rev->always_readable) { \
tv = &rev->tv; \
} \
if (prte_event_add(rev->ev, tv)) { \
PRTE_ERROR_LOG(PRTE_ERR_BAD_PARAM); \
} \
} while (0);
#define PRTE_IOF_READ_ACTIVATE(rev) \
do { \
rev->active = true; \
PMIX_POST_OBJECT(rev); \
PRTE_IOF_READ_ADDEV(rev); \
} while (0);
/* add list of structs that has name of proc + prte_iof_tag_t - when
* defining a read event, search list for proc, add flag to the tag.
* when closing a read fd, find proc on list and zero out that flag
* when all flags = 0, then iof is complete - set message event to
* daemon processor indicating proc iof is terminated
*/
#define PRTE_IOF_READ_EVENT(rv, p, fid, tg, cbfunc, actv) \
do { \
prte_iof_read_event_t *rev; \
PMIX_OUTPUT_VERBOSE((1, prte_iof_base_framework.framework_output, \
"%s defining read event for %s: %s %d", \
PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), PRTE_NAME_PRINT(&(p)->name), \
__FILE__, __LINE__)); \
rev = PMIX_NEW(prte_iof_read_event_t); \
PMIX_RETAIN((p)); \
rev->proc = (struct prte_iof_proc_t *) (p); \
rev->tag = (tg); \
rev->fd = (fid); \
rev->always_readable = prte_iof_base_fd_always_ready(fid); \
*(rv) = rev; \
if (rev->always_readable) { \
prte_event_evtimer_set(prte_event_base, rev->ev, (cbfunc), rev); \
} else { \
prte_event_set(prte_event_base, rev->ev, (fid), PRTE_EV_READ, (cbfunc), rev); \
} \
if ((actv)) { \
PRTE_IOF_READ_ACTIVATE(rev) \
} \
} while (0);
PRTE_EXPORT int prte_iof_base_flush(void);
PRTE_EXPORT extern int prte_iof_base_output_limit;
/* base functions */
PRTE_EXPORT int prte_iof_base_write_output(const pmix_proc_t *name, prte_iof_tag_t stream,
const unsigned char *data, int numbytes,
prte_iof_write_event_t *channel);
PRTE_EXPORT void prte_iof_base_write_handler(int fd, short event, void *cbdata);
PRTE_EXPORT void prte_iof_base_output(const pmix_proc_t *source,
pmix_iof_channel_t channel,
char *string);
END_C_DECLS
#endif /* MCA_IOF_BASE_H */

View File

@@ -0,0 +1,54 @@
/*
* 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) 2008-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#ifndef IOF_BASE_SETUP_H_
#define IOF_BASE_SETUP_H_
#include "prte_config.h"
#include "types.h"
#include "src/mca/iof/base/base.h"
struct prte_iof_base_io_conf_t {
int usepty;
bool connect_stdin;
/* private - callers should not modify these fields */
int p_stdin[2];
int p_stdout[2];
int p_stderr[2];
};
typedef struct prte_iof_base_io_conf_t prte_iof_base_io_conf_t;
/**
* Do pre-fork IOF setup tasks
*
* Do all stdio forwarding that must be done before fork() is called.
* This might include creating pipes or ptys or similar work.
*/
PRTE_EXPORT int prte_iof_base_setup_prefork(prte_iof_base_io_conf_t *opts);
PRTE_EXPORT int prte_iof_base_setup_child(prte_iof_base_io_conf_t *opts, char ***env);
PRTE_EXPORT int prte_iof_base_setup_parent(const pmix_proc_t *name, prte_iof_base_io_conf_t *opts);
#endif

View File

@@ -0,0 +1,194 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 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) 2007-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2021-2022 Nanook Consulting All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* I/O Forwarding Service
* The I/O forwarding service (IOF) is used to connect stdin, stdout, and
* stderr file descriptor streams from MPI processes to the user
*
* The design is fairly simple: when a proc is spawned, the IOF establishes
* connections between its stdin, stdout, and stderr to a
* corresponding IOF stream. In addition, the IOF designates a separate
* stream for passing OMPI/PRTE internal diagnostic/help output to mpirun.
* This is done specifically to separate such output from the user's
* stdout/err - basically, it allows us to present it to the user in
* a separate format for easier recognition. Data read from a source
* on any stream (e.g., printed to stdout by the proc) is relayed
* by the local daemon to the other end of the stream - i.e., stdin
* is relayed to the local proc, while stdout/err is relayed to mpirun.
* Thus, the eventual result is to connect ALL streams to/from
* the application process and mpirun.
*
* Note: By default, data read from stdin is forwarded -only- to rank=0.
* Stdin for all other procs is tied to "/dev/null".
*
* External tools can "pull" copies of stdout/err and
* the diagnostic stream from mpirun for any process. In this case,
* mpirun will send a copy of the output to the "pulling" process. Note that external tools
* cannot "push" something into stdin unless the user specifically directed
* that stdin remain open, nor under any conditions "pull" a copy of the
* stdin being sent to rank=0.
*
* Tools can exploit either of two mechanisms for this purpose:
*
* (a) call prte_init themselves and utilize the PRTE tool comm
* library to access the IOF. This also provides access to
* other tool library functions - e.g., to order that a job
* be spawned; or
*
* (b) fork/exec the "prte-iof" tool and let it serve as the interface
* to mpirun. This lets the tool avoid calling prte_init, and means
* the tool will not have to compile against the PRTE/OMPI libraries.
* However, the prte-iof tool is limited solely to interfacing
* stdio and cannot be used for other functions included in
* the tool comm library
*
* Thus, mpirun acts as a "switchyard" for IO, taking input from stdin
* and passing it to rank=0 of the job, and taking stdout/err/diag from all
* ranks and passing it to its own stdout/err/diag plus any "pull"
* requestors.
*
* Streams are identified by PRTE process name (to include wildcards,
* such as "all processes in PRTE job X") and tag. There are
* currently only 4 allowed predefined tags:
*
* - PRTE_IOF_STDIN (value 0)
* - PRTE_IOF_STDOUT (value 1)
* - PRTE_IOF_STDERR (value 2)
* - PRTE_IOF_INTERNAL (value 3): for "internal" messages
* from the infrastructure, just to differentiate them from user job
* stdout/stderr
*
* Note that since streams are identified by PRTE process name, the
* caller has no idea whether the stream is on the local node or a
* remote node -- it's just a stream.
*
* IOF components are selected on a "one of many" basis, meaning that
* only one IOF component will be selected for a given process.
* Details for the various components are given in their source code
* bases.
*
* Each IOF component must support the following API:
*
* push: Tie a local file descriptor (*not* a stream!) to the stdin
* of the specified process. If the user has not specified that stdin
* of the specified process is to remain open, this will return an error.
*
* pull: Tie a local file descriptor (*not* a stream!) to a stream.
* Subsequent input that appears via the stream will
* automatically be sent to the target file descriptor until the
* stream is "closed" or an EOF is received on the local file descriptor.
* Valid source values include PRTE_IOF_STDOUT, PRTE_IOF_STDERR, and
* PRTE_IOF_INTERNAL
*
* close: Closes a stream, flushing any pending data down it and
* terminating any "push/pull" connections against it. Unclear yet
* if this needs to be blocking, or can be done non-blocking.
*
* flush: Block until all pending data on all open streams has been
* written down local file descriptors and/or completed sending across
* the OOB to remote process targets.
*
*/
#ifndef PRTE_IOF_H
#define PRTE_IOF_H
#include "prte_config.h"
#include "types.h"
#include "src/mca/mca.h"
#include "src/pmix/pmix-internal.h"
#include "src/runtime/prte_globals.h"
#include "iof_types.h"
BEGIN_C_DECLS
/* Initialize the selected module */
typedef int (*prte_iof_base_init_fn_t)(void);
/**
* Explicitly push data from the specified input file descriptor to
* the stdin of the indicated peer(s). The provided peer name can
* include wildcard values.
*
* @param peer Name of target peer(s)
* @param fd Local file descriptor for input.
*/
typedef int (*prte_iof_base_push_fn_t)(const pmix_proc_t *peer, prte_iof_tag_t src_tag, int fd);
/**
* Explicitly pull data from the specified set of SOURCE peers and
* dump to the indicated output file descriptor. Any fragments that
* arrive on the stream will automatically be written down the fd.
*
* @param peer Name used to qualify set of origin peers.
* @param source_tag Indicates the output streams to be forwarded
* @param fd Local file descriptor for output.
*/
typedef int (*prte_iof_base_pull_fn_t)(const pmix_proc_t *peer, prte_iof_tag_t source_tag, int fd);
/**
* Close the specified iof stream(s) from the indicated peer(s)
*/
typedef int (*prte_iof_base_close_fn_t)(const pmix_proc_t *peer, prte_iof_tag_t source_tag);
typedef int (*prte_iof_base_push_stdin_fn_t)(const pmix_proc_t *dst_name, uint8_t *data, size_t sz);
/* Flag that a job is complete */
typedef void (*prte_iof_base_complete_fn_t)(const prte_job_t *jdata);
/* finalize the selected module */
typedef int (*prte_iof_base_finalize_fn_t)(void);
/**
* IOF module.
*/
struct prte_iof_base_module_2_0_0_t {
prte_iof_base_init_fn_t init;
prte_iof_base_push_fn_t push;
prte_iof_base_pull_fn_t pull;
prte_iof_base_close_fn_t close;
prte_iof_base_complete_fn_t complete;
prte_iof_base_finalize_fn_t finalize;
prte_iof_base_push_stdin_fn_t push_stdin;
};
typedef struct prte_iof_base_module_2_0_0_t prte_iof_base_module_2_0_0_t;
typedef prte_iof_base_module_2_0_0_t prte_iof_base_module_t;
PRTE_EXPORT extern prte_iof_base_module_t prte_iof;
typedef pmix_mca_base_component_t prte_iof_base_component_t;
END_C_DECLS
/*
* Macro for use in components that are of type iof
*/
#define PRTE_IOF_BASE_VERSION_2_0_0 PRTE_MCA_BASE_VERSION_3_0_0("iof", 2, 0, 0)
#endif /* PRTE_IOF_H */

View File

@@ -0,0 +1,55 @@
/*
* Copyright (c) 2004-2007 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) 2007-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*/
#ifndef PRTE_IOF_TYPES_H
#define PRTE_IOF_TYPES_H
#include "prte_config.h"
#include "types.h"
BEGIN_C_DECLS
/* Predefined tag values */
typedef uint16_t prte_iof_tag_t;
#define PRTE_IOF_TAG_T PRTE_UINT16
#define PRTE_IOF_STDIN 0x0001
#define PRTE_IOF_STDOUT 0x0002
#define PRTE_IOF_STDERR 0x0004
#define PRTE_IOF_STDMERGE 0x0006
#define PRTE_IOF_STDDIAG 0x0008
#define PRTE_IOF_STDOUTALL 0x000e
#define PRTE_IOF_STDALL 0x000f
#define PRTE_IOF_EXCLUSIVE 0x0100
/* flow control flags */
#define PRTE_IOF_XON 0x1000
#define PRTE_IOF_XOFF 0x2000
/* tool requests */
#define PRTE_IOF_PULL 0x4000
#define PRTE_IOF_CLOSE 0x8000
END_C_DECLS
#endif /* PRTE_IOF_TYPES_H */

View File

@@ -0,0 +1,179 @@
/*
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 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) 2011-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
* Copyright (c) 2017-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef MCA_ODLS_BASE_H
#define MCA_ODLS_BASE_H
/*
* includes
*/
#include "prte_config.h"
#include "src/mca/mca.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/mca/iof/base/iof_base_setup.h"
#include "src/mca/odls/odls.h"
BEGIN_C_DECLS
/*
* General ODLS types
*/
typedef struct {
/** Verbose/debug output stream */
int output;
/* list of ranks to be displayed on separate xterms */
pmix_list_t xterm_ranks;
/* the xterm cmd to be used */
char **xtermcmd;
/* thread pool */
int max_threads;
int num_threads;
int cutoff;
prte_event_base_t **ev_bases; // event base array for progress threads
char **ev_threads; // event progress thread names
int next_base; // counter to load-level thread use
bool signal_direct_children_only;
pmix_lock_t lock;
char *exec_agent;
} prte_odls_globals_t;
PRTE_EXPORT extern prte_odls_globals_t prte_odls_globals;
/*
* MCA framework
*/
PRTE_EXPORT extern pmix_mca_base_framework_t prte_odls_base_framework;
/*
* Select an available component.
*/
PRTE_EXPORT int prte_odls_base_select(void);
/*
* Default functions that are common to most environments - can
* be overridden by specific environments if they need something
* different (e.g., bproc)
*/
PRTE_EXPORT int prte_odls_base_default_get_add_procs_data(pmix_data_buffer_t *data,
pmix_nspace_t job);
PRTE_EXPORT int prte_odls_base_default_construct_child_list(pmix_data_buffer_t *data,
pmix_nspace_t *job);
PRTE_EXPORT void prte_odls_base_spawn_proc(int fd, short sd, void *cbdata);
/* define a function that will fork a local proc */
typedef int (*prte_odls_base_fork_local_proc_fn_t)(void *cd);
/* define an object for fork/exec the local proc */
typedef struct {
pmix_object_t super;
prte_event_t ev;
char *cmd;
char *wdir;
char **argv;
char **env;
prte_job_t *jdata;
prte_app_context_t *app;
prte_proc_t *child;
bool index_argv;
prte_iof_base_io_conf_t opts;
prte_odls_base_fork_local_proc_fn_t fork_local;
} prte_odls_spawn_caddy_t;
PMIX_CLASS_DECLARATION(prte_odls_spawn_caddy_t);
/* define an object for starting local launch */
typedef struct {
pmix_object_t object;
prte_event_t *ev;
pmix_nspace_t job;
prte_odls_base_fork_local_proc_fn_t fork_local;
int retries;
} prte_odls_launch_local_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_odls_launch_local_t);
#define PRTE_ACTIVATE_LOCAL_LAUNCH(j, f) \
do { \
prte_odls_launch_local_t *ll; \
ll = PMIX_NEW(prte_odls_launch_local_t); \
PMIX_LOAD_NSPACE(ll->job, (j)); \
ll->fork_local = (f); \
prte_event_set(prte_event_base, ll->ev, -1, PRTE_EV_WRITE, \
prte_odls_base_default_launch_local, ll); \
prte_event_active(ll->ev, PRTE_EV_WRITE, 1); \
} while (0);
PRTE_EXPORT void prte_odls_base_default_launch_local(int fd, short sd, void *cbdata);
PRTE_EXPORT void prte_odls_base_default_wait_local_proc(int fd, short sd, void *cbdata);
/* define a function type to signal a local proc */
typedef int (*prte_odls_base_signal_local_fn_t)(pid_t pid, int signum);
PRTE_EXPORT int
prte_odls_base_default_signal_local_procs(const pmix_proc_t *proc, int32_t signal,
prte_odls_base_signal_local_fn_t signal_local);
/* define a function type for killing a local proc */
typedef int (*prte_odls_base_kill_local_fn_t)(pid_t pid, int signum);
/* define a function type to detect that a child died */
typedef bool (*prte_odls_base_child_died_fn_t)(prte_proc_t *child);
PRTE_EXPORT int prte_odls_base_default_kill_local_procs(pmix_pointer_array_t *procs,
prte_odls_base_kill_local_fn_t kill_local);
PRTE_EXPORT int prte_odls_base_default_restart_proc(prte_proc_t *child,
prte_odls_base_fork_local_proc_fn_t fork_local);
/*
* Preload binary/files functions
*/
PRTE_EXPORT int prte_odls_base_preload_files_app_context(prte_app_context_t *context);
PRTE_EXPORT void prte_odls_base_start_threads(prte_job_t *jdata);
PRTE_EXPORT void prte_odls_base_harvest_threads(void);
#define PRTE_ODLS_SET_ERROR(ns, s, j) \
do { \
int _idx; \
prte_proc_t *_cld; \
unsigned int _j = (unsigned int)j; \
for (_idx = 0; _idx < prte_local_children->size; _idx++) { \
_cld = (prte_proc_t *) pmix_pointer_array_get_item(prte_local_children, _idx); \
if (NULL == _cld) { \
continue; \
} \
if (PMIX_CHECK_NSPACE(ns, _cld->name.nspace) && \
(UINT_MAX == _j || _j == _cld->app_idx)) { \
_cld->exit_code = s; \
PRTE_ACTIVATE_PROC_STATE(&_cld->name, PRTE_PROC_STATE_FAILED_TO_LAUNCH); \
} \
} \
} while(0)
END_C_DECLS
#endif

View File

@@ -0,0 +1,118 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2008 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) 2011-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* The PRTE Daemon's Local Launch Subsystem
*
*/
#ifndef PRTE_MCA_ODLS_H
#define PRTE_MCA_ODLS_H
#include "prte_config.h"
#include "types.h"
#include "src/class/pmix_pointer_array.h"
#include "src/mca/mca.h"
#include "src/pmix/pmix-internal.h"
#include "src/rml/rml_types.h"
#include "src/pmix/pmix-internal.h"
#include "src/runtime/prte_globals.h"
#include "src/mca/odls/odls_types.h"
BEGIN_C_DECLS
/*
* odls module functions
*/
/*
* Construct a buffer for use in adding local processes
* In order to reuse daemons, we need a way for the HNP to construct a buffer that
* contains the data needed by the active ODLS component to launch a local process. Since the
* only one that knows what a particular ODLS component needs is that component, we require an
* entry point that the HNP can call to get the required buffer. This is constructed
* for *all* nodes - the individual orteds then parse that data to find the specific launch info
* for procs on their node
*/
typedef int (*prte_odls_base_module_get_add_procs_data_fn_t)(pmix_data_buffer_t *data,
pmix_nspace_t job);
/**
* Locally launch the provided processes
*/
typedef int (*prte_odls_base_module_launch_local_processes_fn_t)(pmix_data_buffer_t *data);
/**
* Kill the local processes on this node
*/
typedef int (*prte_odls_base_module_kill_local_processes_fn_t)(pmix_pointer_array_t *procs);
/**
* Signal local processes
*/
typedef int (*prte_odls_base_module_signal_local_process_fn_t)(const pmix_proc_t *proc,
int32_t signal);
/**
* Restart a local process
*/
typedef int (*prte_odls_base_module_restart_proc_fn_t)(prte_proc_t *child);
/**
* pls module version
*/
struct prte_odls_base_module_1_3_0_t {
prte_odls_base_module_get_add_procs_data_fn_t get_add_procs_data;
prte_odls_base_module_launch_local_processes_fn_t launch_local_procs;
prte_odls_base_module_kill_local_processes_fn_t kill_local_procs;
prte_odls_base_module_signal_local_process_fn_t signal_local_procs;
prte_odls_base_module_restart_proc_fn_t restart_proc;
};
/** shprten prte_odls_base_module_1_3_0_t declaration */
typedef struct prte_odls_base_module_1_3_0_t prte_odls_base_module_1_3_0_t;
/** shprten prte_odls_base_module_t declaration */
typedef struct prte_odls_base_module_1_3_0_t prte_odls_base_module_t;
/**
* odls component
*/
typedef pmix_mca_base_component_t prte_odls_base_component_t;
/**
* Macro for use in modules that are of type odls
*/
#define PRTE_ODLS_BASE_VERSION_2_0_0 PRTE_MCA_BASE_VERSION_3_0_0("odls", 2, 0, 0)
/* Global structure for accessing ODLS functions
*/
PRTE_EXPORT extern prte_odls_base_module_t
prte_odls; /* holds selected module's function pointers */
END_C_DECLS
#endif /* MCA_ODLS_H */

View File

@@ -0,0 +1,119 @@
/* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 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) 2010-2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2011-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef PRTE_MCA_ODLS_TYPES_H
#define PRTE_MCA_ODLS_TYPES_H
#include "prte_config.h"
#include "types.h"
#include "src/pmix/pmix-internal.h"
BEGIN_C_DECLS
/* define the orted command flag type */
typedef uint8_t prte_daemon_cmd_flag_t;
#define PRTE_DAEMON_CMD PMIX_UINT8
/*
* Definitions needed for communication
*/
#define PRTE_DAEMON_CONTACT_QUERY_CMD (prte_daemon_cmd_flag_t) 1
#define PRTE_DAEMON_KILL_LOCAL_PROCS (prte_daemon_cmd_flag_t) 2
#define PRTE_DAEMON_SIGNAL_LOCAL_PROCS (prte_daemon_cmd_flag_t) 3
#define PRTE_DAEMON_ADD_LOCAL_PROCS (prte_daemon_cmd_flag_t) 4
#define PRTE_DAEMON_HEARTBEAT_CMD (prte_daemon_cmd_flag_t) 6
#define PRTE_DAEMON_EXIT_CMD (prte_daemon_cmd_flag_t) 7
#define PRTE_DAEMON_PROCESS_AND_RELAY_CMD (prte_daemon_cmd_flag_t) 9
#define PRTE_DAEMON_NULL_CMD (prte_daemon_cmd_flag_t) 11
/* commands for use by tools */
#define PRTE_DAEMON_REPORT_JOB_INFO_CMD (prte_daemon_cmd_flag_t) 14
#define PRTE_DAEMON_REPORT_NODE_INFO_CMD (prte_daemon_cmd_flag_t) 15
#define PRTE_DAEMON_REPORT_PROC_INFO_CMD (prte_daemon_cmd_flag_t) 16
#define PRTE_DAEMON_SPAWN_JOB_CMD (prte_daemon_cmd_flag_t) 17
#define PRTE_DAEMON_TERMINATE_JOB_CMD (prte_daemon_cmd_flag_t) 18
#define PRTE_DAEMON_HALT_VM_CMD (prte_daemon_cmd_flag_t) 19
#define PRTE_DAEMON_HALT_DVM_CMD (prte_daemon_cmd_flag_t) 20
#define PRTE_DAEMON_REPORT_JOB_COMPLETE (prte_daemon_cmd_flag_t) 21
#define PRTE_DAEMON_DEFINE_PSET (prte_daemon_cmd_flag_t) 50
/* request proc resource usage */
#define PRTE_DAEMON_TOP_CMD (prte_daemon_cmd_flag_t) 22
/* bootstrap */
#define PRTE_DAEMON_NAME_REQ_CMD (prte_daemon_cmd_flag_t) 23
#define PRTE_DAEMON_CHECKIN_CMD (prte_daemon_cmd_flag_t) 24
#define PRTE_TOOL_CHECKIN_CMD (prte_daemon_cmd_flag_t) 25
/* process msg command */
#define PRTE_DAEMON_PROCESS_CMD (prte_daemon_cmd_flag_t) 26
/* process called "errmgr.abort_procs" */
#define PRTE_DAEMON_ABORT_PROCS_CALLED (prte_daemon_cmd_flag_t) 28
/* add procs for the DVM */
#define PRTE_DAEMON_DVM_ADD_PROCS (prte_daemon_cmd_flag_t) 30
/* for debug purposes, get stack traces from all application procs */
#define PRTE_DAEMON_GET_STACK_TRACES (prte_daemon_cmd_flag_t) 31
/* for memory profiling */
#define PRTE_DAEMON_GET_MEMPROFILE (prte_daemon_cmd_flag_t) 32
/* request full topology string */
#define PRTE_DAEMON_REPORT_TOPOLOGY_CMD (prte_daemon_cmd_flag_t) 33
/* tell DVM daemons to cleanup resources from job */
#define PRTE_DAEMON_DVM_CLEANUP_JOB_CMD (prte_daemon_cmd_flag_t) 34
/*
* Struct written up the pipe from the child to the parent.
*/
typedef struct {
/* True if the child has died; false if this is just a warning to
be printed. */
bool fatal;
/* Relevant only if fatal==true */
int exit_status;
/* Length of the strings that are written up the pipe after this
struct */
int file_str_len;
int topic_str_len;
int msg_str_len;
} prte_odls_pipe_err_msg_t;
/*
* Max length of strings from the prte_odls_pipe_err_msg_t
*/
#define PRTE_ODLS_MAX_FILE_LEN 511
#define PRTE_ODLS_MAX_TOPIC_LEN PRTE_ODLS_MAX_FILE_LEN
END_C_DECLS
#endif

View File

@@ -0,0 +1,143 @@
/*
* 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-2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2017-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
* the oob framework
*/
#ifndef _MCA_OOB_BASE_H_
#define _MCA_OOB_BASE_H_
#include "prte_config.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#ifdef HAVE_NET_UIO_H
# include <net/uio.h>
#endif
#include "src/class/pmix_bitmap.h"
#include "src/class/pmix_hash_table.h"
#include "src/class/pmix_list.h"
#include "src/event/event-internal.h"
#include "src/util/pmix_printf.h"
#include "src/mca/mca.h"
#include "src/threads/pmix_threads.h"
#include "src/mca/oob/oob.h"
BEGIN_C_DECLS
/*
* Convenience Typedef
*/
typedef struct {
char *include;
char *exclude;
pmix_list_t components;
pmix_list_t actives;
int max_uri_length;
pmix_list_t peers;
} prte_oob_base_t;
PRTE_EXPORT extern prte_oob_base_t prte_oob_base;
typedef struct {
pmix_list_item_t super;
pmix_proc_t name;
prte_oob_base_component_t *component;
pmix_bitmap_t addressable;
} prte_oob_base_peer_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_oob_base_peer_t);
/* MCA framework */
PRTE_EXPORT extern pmix_mca_base_framework_t prte_oob_base_framework;
PRTE_EXPORT int prte_oob_base_select(void);
/* Access the OOB internal functions via set of event-based macros
* for inserting messages and other commands into the
* OOB event base. This ensures that all OOB operations occur
* asynchronously in a thread-safe environment.
* Note that this doesn't mean that messages will be *sent*
* in order as that depends on the specific transport being
* used, when that module's event base indicates the transport
* is available, etc.
*/
typedef struct {
pmix_object_t super;
prte_event_t ev;
prte_rml_send_t *msg;
} prte_oob_send_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_oob_send_t);
/* All OOB sends are based on iovec's and are async as the RML
* acts as the initial interface to prepare all communications.
* The send_nb function will enter the message into the OOB
* base, which will then check to see if a transport for the
* intended target has already been assigned. If so, the message
* is immediately placed into that module's event base for
* transmission. If not, the function will loop across all available
* components until one identifies that it has a module capable
* of reaching the target.
*/
typedef void (*mca_oob_send_callback_fn_t)(int status, struct iovec *iov, int count, void *cbdata);
PRTE_EXPORT void prte_oob_base_send_nb(int fd, short args, void *cbdata);
#define PRTE_OOB_SEND(m) \
do { \
prte_oob_send_t *prte_oob_send_cd; \
pmix_output_verbose(1, prte_oob_base_framework.framework_output, "%s OOB_SEND: %s:%d", \
PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), __FILE__, __LINE__); \
prte_oob_send_cd = PMIX_NEW(prte_oob_send_t); \
prte_oob_send_cd->msg = (m); \
PRTE_PMIX_THREADSHIFT(prte_oob_send_cd, prte_event_base, prte_oob_base_send_nb); \
} while (0)
PRTE_EXPORT prte_oob_base_peer_t *prte_oob_base_get_peer(const pmix_proc_t *pr);
/* During initial wireup, we can only transfer contact info on the daemon
* command line. This limits what we can send to a string representation of
* the actual contact info, which gets sent in a uri-like form. Not every
* oob module can support this transaction, so this function will loop
* across all oob components/modules, letting each add to the uri string if
* it supports bootstrap operations. An error will be returned in the cbfunc
* if NO component can successfully provide a contact.
*
* Note: since there is a limit to what an OS will allow on a cmd line, we
* impose a limit on the length of the resulting uri via an MCA param. The
* default value of -1 implies unlimited - however, users with large numbers
* of interfaces on their nodes may wish to restrict the size.
*
* Since all components define their address info at component start,
* it is unchanged and does not require acess via event
*/
PRTE_EXPORT void prte_oob_base_get_addr(char **uri);
END_C_DECLS
#endif

View File

@@ -0,0 +1,83 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* 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-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
* Contains the internal functions and typedefs for the use of the oob
*/
#ifndef MCA_OOB_H_
#define MCA_OOB_H_
#include "prte_config.h"
#include "types.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#ifdef HAVE_NET_UIO_H
# include <net/uio.h>
#endif
#include "src/class/pmix_list.h"
#include "src/class/pmix_pointer_array.h"
#include "src/mca/mca.h"
#include "src/pmix/pmix-internal.h"
#include "src/rml/rml_types.h"
BEGIN_C_DECLS
typedef int (*mca_oob_base_component_avail_fn_t)(void);
typedef int (*mca_oob_base_component_startup_fn_t)(void);
typedef void (*mca_oob_base_component_shutdown_fn_t)(void);
typedef int (*mca_oob_base_component_send_fn_t)(prte_rml_send_t *msg);
typedef char *(*mca_oob_base_component_get_addr_fn_t)(void);
typedef int (*mca_oob_base_component_set_addr_fn_t)(pmix_proc_t *peer, char **uris);
typedef bool (*mca_oob_base_component_is_reachable_fn_t)(pmix_proc_t *peer);
typedef void (*mca_oob_ping_callback_fn_t)(int status, void *cbdata);
typedef struct {
pmix_mca_base_component_t oob_base;
int idx;
int priority;
mca_oob_base_component_avail_fn_t available;
mca_oob_base_component_startup_fn_t startup;
mca_oob_base_component_shutdown_fn_t shutdown;
mca_oob_base_component_send_fn_t send_nb;
mca_oob_base_component_get_addr_fn_t get_addr;
mca_oob_base_component_set_addr_fn_t set_addr;
mca_oob_base_component_is_reachable_fn_t is_reachable;
} prte_oob_base_component_t;
/**
* Macro for use in components that are of type oob
*/
#define PRTE_OOB_BASE_VERSION_2_0_0 PRTE_MCA_BASE_VERSION_3_0_0("oob", 2, 0, 0)
END_C_DECLS
#endif

View File

@@ -0,0 +1,77 @@
/*
* Copyright (c) 2004-2006 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) 2013 Los Alamos National Security, LLC. All rights reserved.
* Copyright (c) 2015-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef MCA_PLM_BASE_H
#define MCA_PLM_BASE_H
/*
* includes
*/
#include "prte_config.h"
#include "src/class/pmix_list.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/mca/mca.h"
#include "src/util/pmix_printf.h"
#include "src/mca/plm/plm.h"
BEGIN_C_DECLS
/*
* MCA framework
*/
PRTE_EXPORT extern pmix_mca_base_framework_t prte_plm_base_framework;
/*
* Select an available component.
*/
PRTE_EXPORT int prte_plm_base_select(void);
/**
* Functions that other frameworks may need to call directly
* Specifically, the ODLS needs to access some of these
* to avoid recursive callbacks
*/
PRTE_EXPORT void prte_plm_base_app_report_launch(int fd, short event, void *data);
PRTE_EXPORT void prte_plm_base_receive_process_msg(int fd, short event, void *data);
PRTE_EXPORT void prte_plm_base_set_slots(prte_node_t *node);
PRTE_EXPORT void prte_plm_base_setup_job(int fd, short args, void *cbdata);
PRTE_EXPORT void prte_plm_base_setup_job_complete(int fd, short args, void *cbdata);
PRTE_EXPORT void prte_plm_base_complete_setup(int fd, short args, void *cbdata);
PRTE_EXPORT void prte_plm_base_daemons_reported(int fd, short args, void *cbdata);
PRTE_EXPORT void prte_plm_base_allocation_complete(int fd, short args, void *cbdata);
PRTE_EXPORT void prte_plm_base_daemons_launched(int fd, short args, void *cbdata);
PRTE_EXPORT void prte_plm_base_vm_ready(int fd, short args, void *cbdata);
PRTE_EXPORT void prte_plm_base_mapping_complete(int fd, short args, void *cbdata);
PRTE_EXPORT void prte_plm_base_launch_apps(int fd, short args, void *cbdata);
PRTE_EXPORT void prte_plm_base_send_launch_msg(int fd, short args, void *cbdata);
PRTE_EXPORT void prte_plm_base_post_launch(int fd, short args, void *cbdata);
PRTE_EXPORT void prte_plm_base_registered(int fd, short args, void *cbdata);
PRTE_EXPORT void prte_plm_base_wrap_args(char **args);
PRTE_EXPORT int prte_plm_base_spawn_response(int32_t status, prte_job_t *jdata);
END_C_DECLS
#endif

View File

@@ -0,0 +1,133 @@
/*
* Copyright (c) 2004-2006 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) 2011-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2017-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2017-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef MCA_PLM_PRIVATE_H
#define MCA_PLM_PRIVATE_H
/*
* includes
*/
#include "prte_config.h"
#include "types.h"
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif /* HAVE_SYS_TIME_H */
#include "src/class/pmix_list.h"
#include "src/class/pmix_pointer_array.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/mca/odls/odls_types.h"
#include "src/mca/plm/plm_types.h"
#include "src/rml/rml_types.h"
#include "src/runtime/prte_globals.h"
BEGIN_C_DECLS
PRTE_EXPORT extern pmix_mca_base_framework_t prte_plm_base_framework;
/* globals for use solely within PLM framework */
typedef struct {
/* base nspace for this DVM */
char *base_nspace;
/* next jobid */
uint32_t next_jobid;
/* time when daemons started launch */
struct timeval daemonlaunchstart;
/* tree spawn cmd */
pmix_data_buffer_t tree_spawn_cmd;
/* daemon nodes assigned at launch */
bool daemon_nodes_assigned_at_launch;
size_t node_regex_threshold;
pmix_list_t daemon_cache;
bool daemon1_has_reported;
char **cache;
} prte_plm_globals_t;
/**
* Global instance of PLM framework data
*/
PRTE_EXPORT extern prte_plm_globals_t prte_plm_globals;
/**
* Utility routine to set progress engine schedule
*/
PRTE_EXPORT int prte_plm_base_set_progress_sched(int sched);
/*
* Launch support
*/
PRTE_EXPORT void prte_plm_base_daemon_callback(int status, pmix_proc_t *sender,
pmix_data_buffer_t *buffer, prte_rml_tag_t tag,
void *cbdata);
PRTE_EXPORT void prte_plm_base_daemon_failed(int status, pmix_proc_t *sender,
pmix_data_buffer_t *buffer, prte_rml_tag_t tag,
void *cbdata);
PRTE_EXPORT void prte_plm_base_daemon_topology(int status, pmix_proc_t *sender,
pmix_data_buffer_t *buffer, prte_rml_tag_t tag,
void *cbdata);
PRTE_EXPORT int prte_plm_base_create_jobid(prte_job_t *jdata);
PRTE_EXPORT int prte_plm_base_set_hnp_name(void);
PRTE_EXPORT void prte_plm_base_reset_job(prte_job_t *jdata);
PRTE_EXPORT int prte_plm_base_setup_prted_cmd(int *argc, char ***argv);
PRTE_EXPORT void prte_plm_base_check_all_complete(int fd, short args, void *cbdata);
PRTE_EXPORT int prte_plm_base_setup_virtual_machine(prte_job_t *jdata);
/**
* Utilities for plm components that use proxy daemons
*/
PRTE_EXPORT int prte_plm_base_prted_exit(prte_daemon_cmd_flag_t command);
PRTE_EXPORT int prte_plm_base_prted_terminate_job(pmix_nspace_t jobid);
PRTE_EXPORT int prte_plm_base_prted_kill_local_procs(pmix_pointer_array_t *procs);
PRTE_EXPORT int prte_plm_base_prted_signal_local_procs(pmix_nspace_t job, int32_t signal);
/*
* communications utilities
*/
PRTE_EXPORT int prte_plm_base_comm_start(void);
PRTE_EXPORT int prte_plm_base_comm_stop(void);
PRTE_EXPORT void prte_plm_base_recv(int status, pmix_proc_t *sender, pmix_data_buffer_t *buffer,
prte_rml_tag_t tag, void *cbdata);
/**
* Construct basic PRTE Daemon command line arguments
*/
PRTE_EXPORT int prte_plm_base_prted_append_basic_args(int *argc, char ***argv, char *ess_module,
int *proc_vpid_index);
/*
* Proxy functions for use by daemons and application procs
* needing dynamic operations
*/
PRTE_EXPORT int prte_plm_proxy_init(void);
PRTE_EXPORT int prte_plm_proxy_spawn(prte_job_t *jdata);
PRTE_EXPORT int prte_plm_proxy_finalize(void);
END_C_DECLS
#endif /* MCA_PLS_PRIVATE_H */

View File

@@ -0,0 +1,140 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2008 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) 2011-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2018-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
* The Process Lifecycle Management (PLM) subsystem serves as the central
* switchyard for all process management activities, including
* resource allocation, process mapping, process launch, and process
* monitoring.
*/
#ifndef PRTE_PLM_H
#define PRTE_PLM_H
/*
* includes
*/
#include "prte_config.h"
#include "types.h"
#include "src/class/pmix_pointer_array.h"
#include "src/mca/mca.h"
#include "src/pmix/pmix-internal.h"
#include "src/runtime/prte_globals.h"
#include "plm_types.h"
BEGIN_C_DECLS
/*
* Component functions - all MUST be provided
*/
/*
* allow the selected module to initialize
*/
typedef int (*prte_plm_base_module_init_fn_t)(void);
/*
* Spawn a job - this is a non-blocking function!
*/
typedef int (*prte_plm_base_module_spawn_fn_t)(prte_job_t *jdata);
/*
* Remote spawn - spawn called by a daemon to launch a process on its own
*/
typedef int (*prte_plm_base_module_remote_spawn_fn_t)(void);
/*
* Entry point to set the HNP name
*/
typedef int (*prte_plm_base_module_set_hnp_name_fn_t)(void);
/**
* Cleanup resources held by module.
*/
typedef int (*prte_plm_base_module_finalize_fn_t)(void);
/**
* Terminate any processes launched for the respective jobid by
* this component.
*/
typedef int (*prte_plm_base_module_terminate_job_fn_t)(pmix_nspace_t);
/**
* Terminate the daemons
*/
typedef int (*prte_plm_base_module_terminate_orteds_fn_t)(void);
/**
* Terminate an array of specific procs
*/
typedef int (*prte_plm_base_module_terminate_procs_fn_t)(pmix_pointer_array_t *procs);
/**
* Signal any processes launched for the respective jobid by
* this component.
*/
typedef int (*prte_plm_base_module_signal_job_fn_t)(pmix_nspace_t, int32_t);
/**
* plm module version 1.0.0
*/
struct prte_plm_base_module_1_0_0_t {
prte_plm_base_module_init_fn_t init;
prte_plm_base_module_set_hnp_name_fn_t set_hnp_name;
prte_plm_base_module_spawn_fn_t spawn;
prte_plm_base_module_remote_spawn_fn_t remote_spawn;
prte_plm_base_module_terminate_job_fn_t terminate_job;
prte_plm_base_module_terminate_orteds_fn_t terminate_orteds;
prte_plm_base_module_terminate_procs_fn_t terminate_procs;
prte_plm_base_module_signal_job_fn_t signal_job;
prte_plm_base_module_finalize_fn_t finalize;
};
/** shprten prte_plm_base_module_1_0_0_t declaration */
typedef struct prte_plm_base_module_1_0_0_t prte_plm_base_module_1_0_0_t;
/** shprten prte_plm_base_module_t declaration */
typedef struct prte_plm_base_module_1_0_0_t prte_plm_base_module_t;
/**
* plm component
*/
typedef pmix_mca_base_component_t prte_plm_base_component_t;
/**
* Macro for use in modules that are of type plm
*/
#define PRTE_PLM_BASE_VERSION_2_0_0 PRTE_MCA_BASE_VERSION_3_0_0("plm", 2, 0, 0)
/* Global structure for accessing PLM functions */
PRTE_EXPORT extern prte_plm_base_module_t prte_plm; /* holds selected module's function pointers */
END_C_DECLS
#endif

View File

@@ -0,0 +1,234 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2008 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) 2011-2012 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PRTE_PLM_TYPES_H
#define PRTE_PLM_TYPES_H
#include "prte_config.h"
#include "types.h"
BEGIN_C_DECLS
/*
* Process exit codes
*/
typedef int32_t prte_exit_code_t;
/*
* Process state codes
*/
#define PRTE_PROC_STATE_ANY 0xffff
#define PRTE_PROC_STATE_UNDEF 0 /* undefined process state */
#define PRTE_PROC_STATE_INIT 1 /* process entry has been created by rmaps */
#define PRTE_PROC_STATE_RESTART 2 /* the proc is ready for restart */
#define PRTE_PROC_STATE_TERMINATE 3 /* process is marked for termination */
#define PRTE_PROC_STATE_RUNNING 4 /* daemon has locally fork'd process */
#define PRTE_PROC_STATE_REGISTERED 5 /* proc registered sync */
#define PRTE_PROC_STATE_IOF_COMPLETE 6 /* io forwarding pipes have closed */
#define PRTE_PROC_STATE_WAITPID_FIRED 7 /* waitpid fired on process */
#define PRTE_PROC_STATE_MODEX_READY 8 /* all modex info has been stored */
#define PRTE_PROC_STATE_READY_FOR_DEBUG 9 /* ready for debug */
/*
* Define a "boundary" so we can easily and quickly determine
* if a proc is still running or not - any value less than
* this one means that we are not terminated
*/
#define PRTE_PROC_STATE_UNTERMINATED 15
#define PRTE_PROC_STATE_TERMINATED 20 /* process has terminated and is no longer running */
/* Define a boundary so we can easily and quickly determine
* if a proc abnormally terminated - leave a little room
* for future expansion
*/
#define PRTE_PROC_STATE_ERROR 50
/* Define specific error code values */
#define PRTE_PROC_STATE_KILLED_BY_CMD (PRTE_PROC_STATE_ERROR + 1) /* process was killed by PRTE cmd */
#define PRTE_PROC_STATE_ABORTED (PRTE_PROC_STATE_ERROR + 2) /* process aborted */
#define PRTE_PROC_STATE_FAILED_TO_START (PRTE_PROC_STATE_ERROR + 3) /* process failed to start */
#define PRTE_PROC_STATE_ABORTED_BY_SIG (PRTE_PROC_STATE_ERROR + 4) /* process aborted by signal */
#define PRTE_PROC_STATE_TERM_WO_SYNC (PRTE_PROC_STATE_ERROR + 5) /* process exit'd w/o required sync */
#define PRTE_PROC_STATE_COMM_FAILED (PRTE_PROC_STATE_ERROR + 6) /* process communication has failed */
#define PRTE_PROC_STATE_SENSOR_BOUND_EXCEEDED (PRTE_PROC_STATE_ERROR + 7) /* process exceeded a sensor limit */
#define PRTE_PROC_STATE_CALLED_ABORT (PRTE_PROC_STATE_ERROR + 8) /* process called "errmgr.abort" \
*/
#define PRTE_PROC_STATE_HEARTBEAT_FAILED (PRTE_PROC_STATE_ERROR + 9) /* heartbeat failed to arrive */
#define PRTE_PROC_STATE_MIGRATING (PRTE_PROC_STATE_ERROR + 10) /* process failed and is waiting for resources before restarting \
*/
#define PRTE_PROC_STATE_CANNOT_RESTART (PRTE_PROC_STATE_ERROR + 11) /* process failed and cannot be restarted */
#define PRTE_PROC_STATE_TERM_NON_ZERO (PRTE_PROC_STATE_ERROR + 12) /* process exited with a non-zero status, indicating abnormal */
#define PRTE_PROC_STATE_FAILED_TO_LAUNCH (PRTE_PROC_STATE_ERROR + 13) /* unable to launch process \
*/
#define PRTE_PROC_STATE_UNABLE_TO_SEND_MSG (PRTE_PROC_STATE_ERROR + 14) /* unable to send a message */
#define PRTE_PROC_STATE_LIFELINE_LOST (PRTE_PROC_STATE_ERROR + 15) /* connection to lifeline lost \
*/
#define PRTE_PROC_STATE_NO_PATH_TO_TARGET (PRTE_PROC_STATE_ERROR + 16) /* no path for communicating to target peer */
#define PRTE_PROC_STATE_FAILED_TO_CONNECT (PRTE_PROC_STATE_ERROR + 17) /* unable to connect to target peer */
#define PRTE_PROC_STATE_PEER_UNKNOWN (PRTE_PROC_STATE_ERROR + 18) /* unknown peer */
/* Define a boundary so that external developers
* have a starting point for defining their own
* proc states
*/
#define PRTE_PROC_STATE_DYNAMIC 100
/*
* App_context state codes
*/
typedef int32_t prte_app_state_t;
#define PRTE_APP_STATE_UNDEF 0
#define PRTE_APP_STATE_INIT 1
#define PRTE_APP_STATE_ALL_MAPPED 2
#define PRTE_APP_STATE_RUNNING 3
#define PRTE_APP_STATE_COMPLETED 4
/*
* Job state codes
*/
typedef int32_t prte_job_state_t;
#define PRTE_JOB_STATE_ANY INT_MAX
#define PRTE_JOB_STATE_UNDEF 0
#define PRTE_JOB_STATE_INIT 1 /* ready to be assigned id */
#define PRTE_JOB_STATE_INIT_COMPLETE 2 /* jobid assigned and setup */
#define PRTE_JOB_STATE_ALLOCATE 3 /* ready to be allocated */
#define PRTE_JOB_STATE_ALLOCATION_COMPLETE 4 /* allocation completed */
#define PRTE_JOB_STATE_MAP 5 /* ready to be mapped */
#define PRTE_JOB_STATE_MAP_COMPLETE 6 /* mapping complete */
#define PRTE_JOB_STATE_SYSTEM_PREP 7 /* ready for final sanity check and system values updated */
#define PRTE_JOB_STATE_LAUNCH_DAEMONS 8 /* ready to launch daemons */
#define PRTE_JOB_STATE_DAEMONS_LAUNCHED 9 /* daemons for this job have been launched */
#define PRTE_JOB_STATE_DAEMONS_REPORTED 10 /* all launched daemons have reported */
#define PRTE_JOB_STATE_VM_READY 11 /* the VM is ready for operation */
#define PRTE_JOB_STATE_LAUNCH_APPS 12 /* ready to launch apps */
#define PRTE_JOB_STATE_SEND_LAUNCH_MSG 13 /* send launch msg to daemons */
#define PRTE_JOB_STATE_RUNNING 14 /* all procs have been fork'd */
#define PRTE_JOB_STATE_SUSPENDED 15 /* job has been suspended */
#define PRTE_JOB_STATE_REGISTERED 16 /* all procs registered for sync */
#define PRTE_JOB_STATE_LOCAL_LAUNCH_COMPLETE 18 /* all local procs have attempted launch */
#define PRTE_JOB_STATE_READY_FOR_DEBUG 19 /* all local procs report ready for debug */
#define PRTE_JOB_STATE_STARTED 20 /* first process has been started */
/*
* Define a "boundary" so we can easily and quickly determine
* if a job is still running or not - any value less than
* this one means that we are not terminated
*/
#define PRTE_JOB_STATE_UNTERMINATED 30
#define PRTE_JOB_STATE_TERMINATED 31 /* all processes have terminated and job is no longer running */
#define PRTE_JOB_STATE_ALL_JOBS_COMPLETE 32
#define PRTE_JOB_STATE_DAEMONS_TERMINATED 33
#define PRTE_JOB_STATE_NOTIFY_COMPLETED 34 /* callback to notify when job completes */
#define PRTE_JOB_STATE_NOTIFIED 35
/* Define a boundary so we can easily and quickly determine
* if a job abnormally terminated - leave a little room
* for future expansion
*/
#define PRTE_JOB_STATE_ERROR 50
/* Define specific error code values */
#define PRTE_JOB_STATE_KILLED_BY_CMD (PRTE_JOB_STATE_ERROR + 1) /* job was killed by PRTE cmd */
#define PRTE_JOB_STATE_ABORTED (PRTE_JOB_STATE_ERROR + 2) /* at least one process aborted, causing job to abort */
#define PRTE_JOB_STATE_FAILED_TO_START (PRTE_JOB_STATE_ERROR + 3) /* at least one process failed to start */
#define PRTE_JOB_STATE_ABORTED_BY_SIG (PRTE_JOB_STATE_ERROR + 4) /* job was killed by a signal */
#define PRTE_JOB_STATE_ABORTED_WO_SYNC (PRTE_JOB_STATE_ERROR + 5) /* job was aborted because proc exit'd w/o required sync */
#define PRTE_JOB_STATE_COMM_FAILED (PRTE_JOB_STATE_ERROR + 6) /* communication has failed */
#define PRTE_JOB_STATE_SENSOR_BOUND_EXCEEDED (PRTE_JOB_STATE_ERROR + 7) /* job had a process that exceeded a sensor limit */
#define PRTE_JOB_STATE_CALLED_ABORT (PRTE_JOB_STATE_ERROR + 8) /* at least one process called "errmgr.abort" */
#define PRTE_JOB_STATE_HEARTBEAT_FAILED (PRTE_JOB_STATE_ERROR + 9) /* heartbeat failed to arrive \
*/
#define PRTE_JOB_STATE_NEVER_LAUNCHED (PRTE_JOB_STATE_ERROR + 10) /* the job never even attempted to launch due to \
* an error earlier in the \
* launch procedure \
*/
#define PRTE_JOB_STATE_ABORT_ORDERED (PRTE_JOB_STATE_ERROR + 11) /* the processes in this job have been ordered to "die", \
* but may not have completed it yet. Don't order it again \
*/
#define PRTE_JOB_STATE_NON_ZERO_TERM (PRTE_JOB_STATE_ERROR + 12) /* at least one process exited with non-zero status */
#define PRTE_JOB_STATE_FAILED_TO_LAUNCH (PRTE_JOB_STATE_ERROR + 13)
#define PRTE_JOB_STATE_FORCED_EXIT (PRTE_JOB_STATE_ERROR + 14)
#define PRTE_JOB_STATE_SILENT_ABORT (PRTE_JOB_STATE_ERROR + 16) /* an error occurred and was reported elsewhere, so error out quietly */
#define PRTE_JOB_STATE_REPORT_PROGRESS (PRTE_JOB_STATE_ERROR + 17) /* report launch progress - not an error */
#define PRTE_JOB_STATE_ALLOC_FAILED (PRTE_JOB_STATE_ERROR + 18) /* job failed to obtain an allocation */
#define PRTE_JOB_STATE_MAP_FAILED (PRTE_JOB_STATE_ERROR + 19) /* job failed to map */
#define PRTE_JOB_STATE_CANNOT_LAUNCH (PRTE_JOB_STATE_ERROR + 20) /* resources were busy and so the job cannot be launched */
#define PRTE_JOB_STATE_FILES_POSN_FAILED (PRTE_JOB_STATE_ERROR + 21)
#define PRTE_JOB_STATE_FT (PRTE_JOB_STATE_ERROR + 200)
/* define an FT event */
#define PRTE_JOB_STATE_FT_CHECKPOINT (PRTE_JOB_STATE_FT + 1)
#define PRTE_JOB_STATE_FT_CONTINUE (PRTE_JOB_STATE_FT + 2)
#define PRTE_JOB_STATE_FT_RESTART (PRTE_JOB_STATE_FT + 3)
/* Define a boundary so that external developers
* have a starting point for defining their own
* job states
*/
#define PRTE_JOB_STATE_DYNAMIC (PRTE_JOB_STATE_ERROR + 2000)
/**
* Node State, corresponding to the PRTE_NODE_STATE_* #defines,
* below. These are #defines instead of an enum because the thought
* is that we may have lots and lots of entries of these in the
* registry and by making this an int8_t, it's only 1 byte, whereas an
* enum defaults to an int (probably 4 bytes). So it's a bit of a
* space savings.
*/
typedef int8_t prte_node_state_t;
#define PRTE_NODE_STATE_UNDEF 0 // Node is undefined
#define PRTE_NODE_STATE_UNKNOWN 1 // Node is defined but in an unknown state
#define PRTE_NODE_STATE_DOWN 2 // Node is down
#define PRTE_NODE_STATE_UP 3 // Node is up / available for use
#define PRTE_NODE_STATE_REBOOT 4 // Node is rebooting
#define PRTE_NODE_STATE_DO_NOT_USE 5 // Node is up, but not available for use for the next mapping
#define PRTE_NODE_STATE_NOT_INCLUDED 6 // Node is up, but not part of the node pool for jobs
#define PRTE_NODE_STATE_ADDED 7 // Node was dynamically added to pool
/* Define a boundary so that external developers
* have a starting point for defining their own
* node states
*/
#define PRTE_NODE_STATE_DYNAMIC 100
/*
* PLM commands
*/
typedef uint8_t prte_plm_cmd_flag_t;
#define PRTE_PLM_LAUNCH_JOB_CMD 1
#define PRTE_PLM_UPDATE_PROC_STATE 2
#define PRTE_PLM_REGISTERED_CMD 3
#define PRTE_PLM_ALLOC_JOBID_CMD 4
#define PRTE_PLM_READY_FOR_DEBUG_CMD 5
#define PRTE_PLM_LOCAL_LAUNCH_COMP_CMD 6
END_C_DECLS
#endif

View File

@@ -0,0 +1,41 @@
/*
* 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-2006 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2019-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#ifndef PRTE_BACKTRACE_BASE_H
#define PRTE_BACKTRACE_BASE_H
#include "prte_config.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/mca/prtebacktrace/prtebacktrace.h"
/*
* Global functions for MCA overall backtrace open and close
*/
BEGIN_C_DECLS
PRTE_EXPORT extern pmix_mca_base_framework_t prte_prtebacktrace_base_framework;
END_C_DECLS
#endif /* PRTE_BASE_BACKTRACE_H */

View File

@@ -0,0 +1,75 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* 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-2006 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2019-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PRTE_MCA_BACKTRACE_BACKTRACE_H
#define PRTE_MCA_BACKTRACE_BACKTRACE_H
#include "prte_config.h"
#include "src/pmix/pmix-internal.h"
#include "src/mca/base/pmix_base.h"
#include "src/mca/mca.h"
#include "src/util/stacktrace.h"
BEGIN_C_DECLS
/*
* Most of this file is just for ompi_info. There are two interface
* functions, both of which are called directly. The joy of link-time
* components.
*/
/*
* Print back trace to FILE file with a prefix for each line.
* First strip lines are not printed.
* If 'file' is NULL then the component should try to use the file descriptor
* saved in prte_stacktrace_output_fileno
*
* \note some attempts made to be signal safe.
*/
PRTE_EXPORT int prte_backtrace_print(FILE *file, char *prefix, int strip);
/*
* Return back trace in buffer. buffer will be allocated by the
* backtrace component, but should be free'ed by the caller.
*
* \note Probably bad to call this from a signal handler.
*
*/
PRTE_EXPORT int prte_backtrace_buffer(char ***messages, int *len);
/**
* Structure for backtrace components.
*/
typedef pmix_mca_base_component_t prte_backtrace_base_component_t;
/*
* Macro for use in components that are of type backtrace
*/
#define PRTE_BACKTRACE_BASE_VERSION_2_0_0 PRTE_MCA_BASE_VERSION_3_0_0("backtrace", 2, 0, 0)
END_C_DECLS
#endif /* PRTE_MCA_BACKTRACE_BACKTRACE_H */

View File

@@ -0,0 +1,102 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2015-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2017-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PRTE_DL_BASE_H
#define PRTE_DL_BASE_H
#include "prte_config.h"
#include "src/mca/prtedl/prtedl.h"
#include "src/util/pmix_environ.h"
#include "src/mca/base/pmix_base.h"
#include "src/mca/base/pmix_mca_base_framework.h"
BEGIN_C_DECLS
/**
* Globals
*/
PRTE_EXPORT extern pmix_mca_base_framework_t prte_prtedl_base_framework;
PRTE_EXPORT extern prte_prtedl_base_component_t *prte_prtedl_base_selected_component;
PRTE_EXPORT extern prte_prtedl_base_module_t *prte_prtedl;
/**
* Initialize the DL MCA framework
*
* @retval PRTE_SUCCESS Upon success
* @retval PRTE_ERROR Upon failures
*
* This function is invoked during prte_init();
*/
PRTE_EXPORT int prte_dl_base_open(pmix_mca_base_open_flag_t flags);
/**
* Select an available component.
*
* @retval PRTE_SUCCESS Upon Success
* @retval PRTE_NOT_FOUND If no component can be selected
* @retval PRTE_ERROR Upon other failure
*
*/
PRTE_EXPORT int prte_dl_base_select(void);
/**
* Finalize the DL MCA framework
*
* @retval PRTE_SUCCESS Upon success
* @retval PRTE_ERROR Upon failures
*
* This function is invoked during prte_finalize();
*/
PRTE_EXPORT int prte_dl_base_close(void);
/**
* Open a DSO
*
* (see prte_prtedl_base_module_open_ft_t in src/mca/prtedl/prtedl.h for
* documentation of this function)
*/
PRTE_EXPORT int prte_dl_open(const char *fname, bool use_ext, bool private_namespace,
prte_dl_handle_t **handle, char **err_msg);
/**
* Lookup a symbol in a DSO
*
* (see prte_prtedl_base_module_lookup_ft_t in src/mca/prtedl/prtedl.h for
* documentation of this function)
*/
PRTE_EXPORT int prte_dl_lookup(prte_dl_handle_t *handle, const char *symbol, void **ptr,
char **err_msg);
/**
* Close a DSO
*
* (see prte_prtedl_base_module_close_ft_t in src/mca/prtedl/prtedl.h for
* documentation of this function)
*/
PRTE_EXPORT int prte_dl_close(prte_dl_handle_t *handle);
/**
* Iterate over files in a path
*
* (see prte_prtedl_base_module_foreachfile_ft_t in src/mca/prtedl/prtedl.h for
* documentation of this function)
*/
PRTE_EXPORT int prte_dl_foreachfile(const char *search_path,
int (*cb_func)(const char *filename, void *context),
void *context);
END_C_DECLS
#endif /* PRTE_DL_BASE_H */

View File

@@ -0,0 +1,183 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2015-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2019-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* Dynamic library framework
*
* General Description:
*
* This framework provides portable access to dlopen- and prtedlsym-like
* functionality, very similar to Libtool's libltprtedl. Indeed, one of
* the components in this framework will use libltprtedl, if it is
* present/available. However, on some common types systems where
* libltprtedl headers and libraries are *not* available, we can support
* plugins via this simple framework.
*
* This is a compile-time framework: a single component will be
* selected by the priority that its configure.m4 provides. All other
* components will be ignored (i.e., not built/not part of the
* installation). Meaning: the static_components of the prtedl framework
* will always contain 0 or 1 components.
*
* SIDENOTE: PRTE used to embed libltprtedl. However, as of early
* 2015, this became problematic, for a variety of complex and
* uninteresting reasons (see the following if you care about the
* details: https://github.com/open-mpi/ompi/issues/311,
* http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19370,
* https://github.com/open-mpi/ompi/pull/366,
* https://github.com/open-mpi/ompi/pull/390). That being said, we,
* as a developer community, still wanted to be able to natively use
* DSOs by default. A small/simple framework for DL functionality,
* along with a simple component that supports dlopen/prtedlsym on POSIX
* platforms and another component that natively uses libltprtedl seemed
* like a good solution.
*/
#ifndef PRTE_MCA_DL_DL_H
#define PRTE_MCA_DL_DL_H
#include "prte_config.h"
#include "src/pmix/pmix-internal.h"
#include "src/mca/base/pmix_base.h"
#include "src/mca/mca.h"
BEGIN_C_DECLS
/**
* Handle for an opened file
*/
struct prte_dl_handle_t;
typedef struct prte_dl_handle_t prte_dl_handle_t;
/**
* Dynamically open the file specified.
*
* Arguments:
* fname = Base filename to open. If NULL, open this process.
* use_ext = If true, try various filename suffixes that are
* relevant on this platform (e.g., .so, .prtedll, .dylib). If
* false, just use exactly whatever was passed as fname.
* private = If true, open the file in a private namespace.
* Otherwise, open the file in a global namespace.
* handle = Upon successful open, a handle to the opened file will
* be returned.
* err_msg= if non-NULL and !=PRTE_SUCCESS is returned, will point to a
* string error message
*
* Returns:
* PRTE_SUCCESS on success, or PRTE_ERROR
*
* Space for the handle must be allocated by the module (it can be
* freed during the call to prte_prtedl_base_module_prtedlclose_fn_t).
*
* The err_msg points to an internal string and should not be altered
* or freed by the caller. The contents of the err_msg string may
* change after successive calls to prte_prtedl API calls.
*/
typedef int (*prte_prtedl_base_module_open_fn_t)(const char *fname, bool use_ext,
bool private_namespace, prte_dl_handle_t **handle,
char **err_msg);
/**
* Lookup a symbol in an opened file.
*
* Arguments:
* handle = handle of a previously dynamically opened file
* symbol = name of the symbol to lookup
* ptr = if found, a pointer to the symbol. Otherwise, NULL.
* err_msg= if non-NULL and !=PRTE_SUCCESS is returned, will point to a
* string error message
* Returns:
* PRTE_SUCCESS on success, or PRTE_ERROR
*
*
* The err_msg points to an internal string and should not be altered
* or freed by the caller. The contents of the err_msg string may
* change after successive calls to prte_prtedl API calls.
*/
typedef int (*prte_prtedl_base_module_lookup_fn_t)(prte_dl_handle_t *handle, const char *symbol,
void **ptr, char **err_msg);
/**
* Dynamically close a previously dynamically-opened file.
*
* Arguments:
* handle = handle of a previously dynamically opened file.
* Returns:
* PRTE_SUCCESS on success, or PRTE_ERROR
*
* This function should close the file and free and resources
* associated with it (e.g., whatever is cached on the handle).
*/
typedef int (*prte_prtedl_base_module_close_fn_t)(prte_dl_handle_t *handle);
/**
* Search through a path of directories, invoking a callback on each
* unique regular (non-Libtool) file basename found (e.g., will only
* be invoked once for the files "foo.la" and "foo.so", with the
* parameter "foo").
*
* Arguments:
* path = PRTE_ENV_SEP-delimited list of directories
* cb_func= function to invoke on each filename found
* data = context for callback function
* Returns:
* PRTE_SUCESS on success, PRTE_ERR* otherwise
*/
typedef int (*prte_prtedl_base_module_foreachfile_fn_t)(
const char *search_path, int (*cb_func)(const char *filename, void *context), void *context);
/**
* Structure for DL components.
*/
struct prte_prtedl_base_component_1_0_0_t {
/** MCA base component */
pmix_mca_base_component_t base_version;
/** Default priority */
int priority;
};
typedef struct prte_prtedl_base_component_1_0_0_t prte_prtedl_base_component_1_0_0_t;
typedef struct prte_prtedl_base_component_1_0_0_t prte_prtedl_base_component_t;
/**
* Structure for DL modules
*/
struct prte_prtedl_base_module_1_0_0_t {
pmix_mca_base_module_t super;
/** Open / close */
prte_prtedl_base_module_open_fn_t open;
prte_prtedl_base_module_close_fn_t close;
/** Lookup a symbol */
prte_prtedl_base_module_lookup_fn_t lookup;
/** Iterate looking for files */
prte_prtedl_base_module_foreachfile_fn_t foreachfile;
};
typedef struct prte_prtedl_base_module_1_0_0_t prte_prtedl_base_module_1_0_0_t;
typedef struct prte_prtedl_base_module_1_0_0_t prte_prtedl_base_module_t;
/**
* Macro for use in components that are of type DL
*/
#define PRTE_DL_BASE_VERSION_1_0_0 PRTE_MCA_BASE_VERSION_3_0_0("prtedl", 1, 0, 0)
END_C_DECLS
#endif /* PRTE_MCA_DL_DL_H */

View File

@@ -0,0 +1,41 @@
/*
* Copyright (c) 2006-2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2007-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2010 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2019-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#ifndef PRTE_INSTALLDIRS_BASE_H
#define PRTE_INSTALLDIRS_BASE_H
#include "prte_config.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/mca/prteinstalldirs/prteinstalldirs.h"
/*
* Global functions for MCA overall prteinstalldirs open and close
*/
BEGIN_C_DECLS
/**
* Framework structure declaration
*/
PRTE_EXPORT extern pmix_mca_base_framework_t prte_prteinstalldirs_base_framework;
/* Just like prte_install_dirs_expand() (see prteinstalldirs.h), but will
also insert the value of the environment variable $PRTE_DESTDIR, if
it exists/is set. This function should *only* be used during the
setup routines of prteinstalldirs. */
char *prte_install_dirs_expand_setup(const char *input);
END_C_DECLS
#endif /* PRTE_BASE_INSTALLDIRS_H */

View File

@@ -0,0 +1,80 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2019-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PRTE_MCA_INSTALLDIRS_INSTALLDIRS_H
#define PRTE_MCA_INSTALLDIRS_INSTALLDIRS_H
#include "prte_config.h"
#include "src/pmix/pmix-internal.h"
#include "src/mca/base/pmix_base.h"
#include "src/mca/mca.h"
BEGIN_C_DECLS
/*
* Most of this file is just for ompi_info. The only public interface
* once prte_init has been called is the prte_install_dirs structure
* and the prte_install_dirs_expand() call */
struct prte_install_dirs_t {
char *prefix;
char *exec_prefix;
char *bindir;
char *sbindir;
char *libexecdir;
char *datarootdir;
char *datadir;
char *sysconfdir;
char *sharedstatedir;
char *localstatedir;
char *libdir;
char *includedir;
char *infodir;
char *mandir;
char *prtedatadir;
char *prtelibdir;
char *prteincludedir;
};
typedef struct prte_install_dirs_t prte_install_dirs_t;
/* Install directories. Only available after prte_init() */
PRTE_EXPORT extern prte_install_dirs_t prte_install_dirs;
/**
* Expand out path variables (such as ${prefix}) in the input string
* using the current prte_install_dirs structure */
PRTE_EXPORT char *prte_install_dirs_expand(const char *input);
/**
* Structure for prteinstalldirs components.
*/
struct prte_prteinstalldirs_base_component_2_0_0_t {
/** MCA base component */
pmix_mca_base_component_t component;
/** install directories provided by the given component */
prte_install_dirs_t install_dirs_data;
};
/**
* Convenience typedef
*/
typedef struct prte_prteinstalldirs_base_component_2_0_0_t prte_prteinstalldirs_base_component_t;
/*
* Macro for use in components that are of type prteinstalldirs
*/
#define PRTE_INSTALLDIRS_BASE_VERSION_2_0_0 PRTE_MCA_BASE_VERSION_3_0_0("prteinstalldirs", 2, 0, 0)
END_C_DECLS
#endif /* PRTE_MCA_INSTALLDIRS_INSTALLDIRS_H */

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) 2014-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef PRTE_MCA_REACHABLE_BASE_H
#define PRTE_MCA_REACHABLE_BASE_H
#include "prte_config.h"
#include "src/include/types.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/mca/mca.h"
#include "src/mca/prtereachable/prtereachable.h"
BEGIN_C_DECLS
PRTE_EXPORT extern pmix_mca_base_framework_t prte_prtereachable_base_framework;
/**
* Select a prtereachable module
*/
PRTE_EXPORT int prte_reachable_base_select(void);
PRTE_EXPORT prte_reachable_t *prte_reachable_allocate(unsigned int num_local,
unsigned int num_remote);
END_C_DECLS
#endif

View File

@@ -0,0 +1,110 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2017-2019 Amazon.com, Inc. or its affiliates.
* All Rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PRTE_REACHABLE_H
#define PRTE_REACHABLE_H
#include "prte_config.h"
#include "src/pmix/pmix-internal.h"
#include "src/class/pmix_list.h"
#include "src/include/types.h"
#include "src/mca/mca.h"
BEGIN_C_DECLS
/**
* Reachability matrix between endpoints of a given pair of hosts
*
* The output of the reachable() call is a prte_reachable_t, which
* gives an matrix of the connectivity between local and remote
* ethernet endpoints. Any given value in weights is the connectivity
* between the local endpoint index (first index) and the remote
* endpoint index (second index), and is a value between 0 and INT_MAX
* representing a relative connectivity.
*/
struct prte_reachable_t {
pmix_object_t super;
/** number of local interfaces passed to reachable() */
int num_local;
/** number of remote interfaces passed to reachable() */
int num_remote;
/** matric of connectivity weights */
int **weights;
/** \internal */
void *memory;
};
typedef struct prte_reachable_t prte_reachable_t;
PMIX_CLASS_DECLARATION(prte_reachable_t);
/* Init */
typedef int (*prte_reachable_base_module_init_fn_t)(void);
/* Finalize */
typedef int (*prte_reachable_base_module_fini_fn_t)(void);
/* Build reachability matrix between local and remote ethernet
* interfaces
*
* @param local_ifs (IN) Local list of pmix_pif_t objects
* The pmix_pif_t objects must be fully populated
* @param remote_ifs (IN) Remote list of pmix_pif_t objects
* The pmix_pif_t objects must have the following fields populated:
* uint16_t af_family;
* struct sockaddr_storage if_addr;
* uint32_t if_mask;
* uint32_t if_bandwidth;
* @return prte_reachable_t The reachability matrix was successfully created
* @return NULL The reachability matrix could not be constructed
*
* Given a list of local interfaces and remote interfaces from a
* single peer, build a reachability matrix between the two peers.
* This function does not select the best pairing of local and remote
* interfaces, but only a (comparable) reachability between any pair
* of local/remote interfaces.
*
*
*/
typedef prte_reachable_t *(*prte_reachable_base_module_reachable_fn_t)(pmix_list_t *local_ifs,
pmix_list_t *remote_ifs);
/*
* the standard public API data structure
*/
typedef struct {
/* currently used APIs */
prte_reachable_base_module_init_fn_t init;
prte_reachable_base_module_fini_fn_t finalize;
prte_reachable_base_module_reachable_fn_t reachable;
} prte_reachable_base_module_t;
typedef struct {
pmix_mca_base_component_t base_version;
int priority;
} prte_reachable_base_component_t;
/*
* Macro for use in components that are of type reachable
*/
#define PRTE_REACHABLE_BASE_VERSION_2_0_0 PRTE_MCA_BASE_VERSION_3_0_0("prtereachable", 2, 0, 0)
/* Global structure for accessing reachability functions */
PRTE_EXPORT extern prte_reachable_base_module_t prte_reachable;
END_C_DECLS
#endif

View File

@@ -0,0 +1,77 @@
/*
* 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) 2011-2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef PRTE_MCA_RAS_BASE_H
#define PRTE_MCA_RAS_BASE_H
/*
* includes
*/
#include "prte_config.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/mca/ras/ras.h"
#include "src/runtime/prte_globals.h"
#include "src/util/pmix_printf.h"
/*
* Global functions for MCA overall collective open and close
*/
BEGIN_C_DECLS
/*
* MCA Framework
*/
PRTE_EXPORT extern pmix_mca_base_framework_t prte_ras_base_framework;
/* select a component */
PRTE_EXPORT int prte_ras_base_select(void);
/*
* globals that might be needed
*/
typedef struct prte_ras_base_t {
bool allocation_read;
prte_ras_base_module_t *active_module;
int total_slots_alloc;
int multiplier;
bool launch_orted_on_hn;
bool simulated;
} prte_ras_base_t;
PRTE_EXPORT extern prte_ras_base_t prte_ras_base;
PRTE_EXPORT void prte_ras_base_display_alloc(prte_job_t *jdata);
PRTE_EXPORT void prte_ras_base_display_cpus(prte_job_t *jdata, char *nodelist);
PRTE_EXPORT void prte_ras_base_allocate(int fd, short args, void *cbdata);
PRTE_EXPORT int prte_ras_base_add_hosts(prte_job_t *jdata);
PRTE_EXPORT char *prte_ras_base_flag_string(prte_node_t *node);
END_C_DECLS
#endif

View File

@@ -0,0 +1,53 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2008 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) 2008 UT-Battelle, LLC. All rights reserved.
* Copyright (c) 2011 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2019 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef PRTE_RAS_PRIVATE_H
#define PRTE_RAS_PRIVATE_H
/*
* includes
*/
#include "prte_config.h"
#include "constants.h"
#include "types.h"
#include "src/class/pmix_list.h"
#include "src/mca/ras/base/base.h"
#include "src/mca/ras/ras.h"
BEGIN_C_DECLS
/**
* Add the specified node definitions to the registry
*/
PRTE_EXPORT int prte_ras_base_node_insert(pmix_list_t *, prte_job_t *);
END_C_DECLS
#endif

View File

@@ -0,0 +1,128 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2008 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) 2011-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2018-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
* The PRTE Resource Allocation Subsystem (RAS)
*
* The resource allocation subsystem is responsible for determining
* what (if any) resources have been allocated to the specified job
* (via some prior action), and to obtain an allocation (if possible)
* if resources have NOT been previously allocated. It is anticipated
* that PRTE users will execute an "mpirun" or other command that
* invokes PRTE through one of two channels:
*
* 1. the user will login to the computing resource they intend
* to use, request a resource allocation from that system, and then
* execute the mpirun or other command. Thus, the allocation has
* already been obtained prior to PRTE's initialization. In most
* cases, systems pass allocation information via environmental
* parameters. Thus, the RAS components must know the correct
* environmental parameter to look for within the environment they
* seek to support (e.g., an LSF component should know that LSF passes
* allocation parameters as a specific LSF-named entity).
*
* 2. the user issues an mpirun command or an application that uses
* PRTE without obtaining an allocation in advance. Thus, the associated
* RAS component must know how to request an allocation from the
* designated resource. If it doesn't, or it cannot obtain the allocation,
* then it shall indicate this by setting the system to an appropriate
* state.
*/
#ifndef PRTE_MCA_RAS_H
#define PRTE_MCA_RAS_H
#include "prte_config.h"
#include "constants.h"
#include "types.h"
#include "src/class/pmix_list.h"
#include "src/event/event-internal.h"
#include "src/mca/mca.h"
#include "src/pmix/pmix-internal.h"
#include "src/runtime/prte_globals.h"
BEGIN_C_DECLS
/* allocation event - the event one activates to schedule resource
* allocation for pending jobs
*/
PRTE_EXPORT extern prte_event_t prte_allocate_event;
/*
* ras module functions - these are not accessible to the outside world,
* but are defined here by convention
*/
/* init the module */
typedef int (*prte_ras_base_module_init_fn_t)(void);
/**
* Allocate resources to a job.
*/
typedef int (*prte_ras_base_module_allocate_fn_t)(prte_job_t *jdata, pmix_list_t *nodes);
/* deallocate resources */
typedef void (*prte_ras_base_module_dealloc_fn_t)(prte_job_t *jdata, prte_app_context_t *app);
/**
* Cleanup module resources.
*/
typedef int (*prte_ras_base_module_finalize_fn_t)(void);
/**
* ras module
*/
struct prte_ras_base_module_2_0_0_t {
/** init */
prte_ras_base_module_init_fn_t init;
/** Allocation function pointer */
prte_ras_base_module_allocate_fn_t allocate;
prte_ras_base_module_dealloc_fn_t deallocate;
/** Finalization function pointer */
prte_ras_base_module_finalize_fn_t finalize;
};
/** Convenience typedef */
typedef struct prte_ras_base_module_2_0_0_t prte_ras_base_module_2_0_0_t;
/** Convenience typedef */
typedef prte_ras_base_module_2_0_0_t prte_ras_base_module_t;
/*
* ras component
*/
/** Convenience typedef */
typedef pmix_mca_base_component_t prte_ras_base_component_t;
/**
* Macro for use in components that are of type ras
*/
#define PRTE_RAS_BASE_VERSION_2_0_0 PRTE_MCA_BASE_VERSION_3_0_0("ras", 2, 0, 0)
END_C_DECLS
#endif

View File

@@ -0,0 +1,161 @@
/*
* 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) 2011-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
* 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:
* rmaps framework base functionality.
*/
#ifndef PRTE_MCA_RMAPS_BASE_H
#define PRTE_MCA_RMAPS_BASE_H
/*
* includes
*/
#include "prte_config.h"
#include "types.h"
#include "src/class/pmix_list.h"
#include "src/mca/mca.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/mca/schizo/schizo.h"
#include "src/util/pmix_printf.h"
#include "src/runtime/prte_globals.h"
#include "src/mca/rmaps/rmaps.h"
BEGIN_C_DECLS
/*
* MCA Framework
*/
PRTE_EXPORT extern pmix_mca_base_framework_t prte_rmaps_base_framework;
/* select a component */
PRTE_EXPORT int prte_rmaps_base_select(void);
/*
* Global functions for MCA overall collective open and close
*/
/**
* Struct to hold data global to the rmaps framework
*/
typedef struct {
/* list of selected modules */
pmix_list_t selected_modules;
/* default mapping/ranking directives */
prte_mapping_policy_t mapping;
prte_ranking_policy_t ranking;
/* default device for dist mapping */
char *device;
/* whether or not child jobs should inherit mapping/ranking/binding directives from their parent
* by default */
bool inherit;
/* whether or not we are using hwthreads as independent cpus by default */
bool hwthread_cpus;
/* default file for use in sequential and rankfile mapping
* when the directive comes thru MCA param */
char *file;
hwloc_cpuset_t available, baseset; // scratch for binding calculation
char *default_mapping_policy;
/* whether or not to require hwtcpus due to topology limitations */
bool require_hwtcpus;
} prte_rmaps_base_t;
/**
* Global instance of rmaps-wide framework data
*/
PRTE_EXPORT extern prte_rmaps_base_t prte_rmaps_base;
/**
* Select an rmaps component / module
*/
typedef struct {
pmix_list_item_t super;
int pri;
prte_rmaps_base_module_t *module;
pmix_mca_base_component_t *component;
} prte_rmaps_base_selected_module_t;
PMIX_CLASS_DECLARATION(prte_rmaps_base_selected_module_t);
/*
* Map a job
*/
PRTE_EXPORT void prte_rmaps_base_map_job(int sd, short args, void *cbdata);
/**
* Utility routines to get/set vpid mapping for the job
*/
PRTE_EXPORT int prte_rmaps_base_get_vpid_range(pmix_nspace_t jobid, pmix_rank_t *start,
pmix_rank_t *range);
PRTE_EXPORT int prte_rmaps_base_set_vpid_range(pmix_nspace_t jobid, pmix_rank_t start,
pmix_rank_t range);
/* pretty-print functions */
PRTE_EXPORT char *prte_rmaps_base_print_mapping(prte_mapping_policy_t mapping);
PRTE_EXPORT char *prte_rmaps_base_print_ranking(prte_ranking_policy_t ranking);
PRTE_EXPORT int prte_rmaps_base_prep_topology(hwloc_topology_t topo);
PRTE_EXPORT int prte_rmaps_base_filter_nodes(prte_app_context_t *app, pmix_list_t *nodes,
bool remove);
PRTE_EXPORT int prte_rmaps_base_set_default_mapping(prte_job_t *jdata,
prte_rmaps_options_t *options);
PRTE_EXPORT int prte_rmaps_base_set_mapping_policy(prte_job_t *jdata, char *spec);
PRTE_EXPORT int prte_rmaps_base_set_default_ranking(prte_job_t *jdata,
prte_rmaps_options_t *options);
PRTE_EXPORT int prte_rmaps_base_set_ranking_policy(prte_job_t *jdata, char *spec);
PRTE_EXPORT void prte_rmaps_base_display_map(prte_job_t *jdata);
PRTE_EXPORT void prte_rmaps_base_report_bindings(prte_job_t *jdata,
prte_rmaps_options_t *options);
PRTE_EXPORT int prte_rmaps_base_get_ncpus(prte_node_t *node,
hwloc_obj_t obj,
prte_rmaps_options_t *options);
PRTE_EXPORT bool prte_rmaps_base_check_avail(prte_job_t *jdata,
prte_app_context_t *app,
prte_node_t *node,
pmix_list_t *node_list,
hwloc_obj_t obj,
prte_rmaps_options_t *options);
PRTE_EXPORT int prte_rmaps_base_check_oversubscribed(prte_job_t *jdata,
prte_app_context_t *app,
prte_node_t *node,
prte_rmaps_options_t *options);
PRTE_EXPORT void prte_rmaps_base_get_cpuset(prte_job_t *jdata,
prte_node_t *node,
prte_rmaps_options_t *options);
PRTE_EXPORT int prte_rmaps_base_check_support(prte_job_t *jdata,
prte_node_t *node,
prte_rmaps_options_t *options);
END_C_DECLS
#endif

View File

@@ -0,0 +1,78 @@
/*
* 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) 2011-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2017-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef PRTE_MCA_RMAPS_PRIVATE_H
#define PRTE_MCA_RMAPS_PRIVATE_H
/*
* includes
*/
#include "prte_config.h"
#include "types.h"
#include "src/hwloc/hwloc-internal.h"
#include "src/runtime/prte_globals.h"
#include "src/mca/schizo/schizo.h"
#include "src/mca/rmaps/rmaps.h"
BEGIN_C_DECLS
/*
* Base API functions
*/
/* LOCAL FUNCTIONS for use by RMAPS components */
PRTE_EXPORT int prte_rmaps_base_get_target_nodes(pmix_list_t *node_list, int32_t *total_num_slots,
prte_job_t *jdata, prte_app_context_t *app,
prte_mapping_policy_t policy, bool initial_map,
bool silent, bool keepall);
PRTE_EXPORT prte_proc_t *prte_rmaps_base_setup_proc(prte_job_t *jdata,
prte_app_idx_t idx,
prte_node_t *node,
hwloc_obj_t obj,
prte_rmaps_options_t *options);
PRTE_EXPORT void prte_rmaps_base_get_starting_point(pmix_list_t *node_list,
prte_job_t *jdata);
PRTE_EXPORT int prte_rmaps_base_compute_vpids(prte_job_t *jdata,
prte_rmaps_options_t *options);
PRTE_EXPORT int prte_rmaps_base_bind_proc(prte_job_t *jdata,
prte_proc_t *proc,
prte_node_t *node,
hwloc_obj_t obj,
prte_rmaps_options_t *options);
PRTE_EXPORT void prte_rmaps_base_update_local_ranks(prte_job_t *jdata, prte_node_t *oldnode,
prte_node_t *newnode, prte_proc_t *newproc);
END_C_DECLS
#endif

View File

@@ -0,0 +1,99 @@
/*
* Copyright (c) 2004-2008 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) 2011-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2011 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2017-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
* The PRTE Resource MAPping Subsystem (RMAPS)
*
* The resource mapping subsystem is responsible for mapping processes
* to specific nodes/cpus within a given job. In many systems, this
* functionality will not be supported - the system will map processes
* wherever it chooses and does not allow the user to specify the
* mapping. RMAPS components, therefore, provide services for those
* systems that do permit such mappings.
*
* RMAPS checks the MCA parameters to see if a mapping algorithm has
* been specified. If the user selected a mapping algorithm, the
* indicated RMAPS component will take information from the registry
* to determine the number of applications/processes to be run, and
* the identified resources that have been allocated to this job. The
* selected RMAP component will then assign processes to resources
* according to its algorithm, with the results stored on the
* appropriate job segment - the assigned nodename for each process is
* stored in that respective process' container on the segment.
*
*/
#ifndef PRTE_MCA_RMAPS_H
#define PRTE_MCA_RMAPS_H
#include "prte_config.h"
#include "types.h"
#include "src/mca/mca.h"
#include "src/pmix/pmix-internal.h"
#include "src/runtime/prte_globals.h"
#include "src/mca/rmaps/rmaps_types.h"
BEGIN_C_DECLS
/*
* rmaps module functions
*/
/**
* RMAPS module functions - these are not accessible to the outside world,
* but are defined here by convention
*/
/* map a job - used by the HNP to compute the #procs on each node.
* This is passed to the backend daemons as a regex which they
* use to create an prte_job_map_t for the job */
typedef int (*prte_rmaps_base_module_map_fn_t)(prte_job_t *jdata,
prte_rmaps_options_t *options);
/*
* rmaps module version 4.0.0
*/
struct prte_rmaps_base_module_4_0_0_t {
/** Mapping function pointer */
prte_rmaps_base_module_map_fn_t map_job;
};
/** Convenience typedef */
typedef struct prte_rmaps_base_module_4_0_0_t prte_rmaps_base_module_4_0_0_t;
/** Convenience typedef */
typedef prte_rmaps_base_module_4_0_0_t prte_rmaps_base_module_t;
/*
* rmaps component
*/
/**
* rmaps component version 3.0.0
*/
typedef pmix_mca_base_component_t prte_rmaps_base_component_t;
END_C_DECLS
#endif

View File

@@ -0,0 +1,199 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2008 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) 2011-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef PRTE_MCA_RMAPS_TYPES_H
#define PRTE_MCA_RMAPS_TYPES_H
#include "prte_config.h"
#include "constants.h"
#include "src/class/pmix_pointer_array.h"
#include "src/hwloc/hwloc-internal.h"
#include "src/runtime/prte_globals.h"
/*
* General MAP types - instanced in runtime/prte_globals_class_instances.h
*/
BEGIN_C_DECLS
typedef uint16_t prte_mapping_policy_t;
#define PRTE_MAPPING_POLICY PRTE_UINT16
typedef uint16_t prte_ranking_policy_t;
#define PRTE_RANKING_POLICY PRTE_UINT16
/*
* Structure that represents the mapping of a job to an
* allocated set of resources.
*/
struct prte_job_map_t {
pmix_object_t super;
/* user-specified mapping params */
char *req_mapper; /* requested mapper */
char *last_mapper; /* last mapper used */
prte_mapping_policy_t mapping;
prte_ranking_policy_t ranking;
prte_binding_policy_t binding;
bool rtos_set;
/* *** */
/* number of new daemons required to be launched
* to support this job map
*/
int32_t num_new_daemons;
/* starting vpid of the new daemons - they will
* be sequential from that point
*/
pmix_rank_t daemon_vpid_start;
/* number of nodes participating in this job */
int32_t num_nodes;
/* array of pointers to nodes in this map for this job */
pmix_pointer_array_t *nodes;
};
typedef struct prte_job_map_t prte_job_map_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_job_map_t);
typedef struct {
/* input info */
uint16_t cpus_per_rank;
bool use_hwthreads;
int stream;
int verbosity;
char *cpuset;
hwloc_cpuset_t job_cpuset;
bool bindsupport;
bool donotlaunch;
bool membind_warned;
bool oversubscribe;
bool overload;
/* mapping values */
prte_mapping_policy_t map;
bool mapspan;
bool ordered;
prte_binding_policy_t mapdepth;
unsigned ncpus;
int nprocs;
hwloc_obj_type_t maptype;
unsigned cmaplvl;
/* #procs/resource as per PPR */
int pprn;
/* ranking values */
prte_ranking_policy_t rank;
bool userranked;
unsigned nnodes;
unsigned total_nobjs;
unsigned nobjs;
/* binding values */
prte_binding_policy_t bind;
bool dobind;
hwloc_obj_type_t hwb;
unsigned clvl;
/* usage tracking */
hwloc_cpuset_t target;
hwloc_obj_t obj;
} prte_rmaps_options_t;
/*
**
* Macro for use in components that are of type rmaps
*/
#define PRTE_RMAPS_BASE_VERSION_4_0_0 PRTE_MCA_BASE_VERSION_3_0_0("rmaps", 4, 0, 0)
/* define map-related directives */
#define PRTE_MAPPING_NO_USE_LOCAL 0x0100
#define PRTE_MAPPING_NO_OVERSUBSCRIBE 0x0200
#define PRTE_MAPPING_SUBSCRIBE_GIVEN 0x0400
#define PRTE_MAPPING_SPAN 0x0800
#define PRTE_MAPPING_ORDERED 0x1000
/* directives given */
#define PRTE_MAPPING_LOCAL_GIVEN 0x2000
#define PRTE_MAPPING_GIVEN 0x4000
/* macros to set/get/unset mapping directive */
#define PRTE_SET_MAPPING_DIRECTIVE(target, pol) (target) |= (pol)
#define PRTE_UNSET_MAPPING_DIRECTIVE(target, pol) (target) &= ~(pol)
#define PRTE_GET_MAPPING_DIRECTIVE(pol) ((pol) &0xff00)
/* round-robin policies */
/* start with hardware-based options
* so the values match the corresponding
* levels in src/hwloc/hwloc-internal.h
*/
#define PRTE_MAPPING_BYNODE 1
#define PRTE_MAPPING_BYNUMA 2
#define PRTE_MAPPING_BYPACKAGE 3
#define PRTE_MAPPING_BYL3CACHE 4
#define PRTE_MAPPING_BYL2CACHE 5
#define PRTE_MAPPING_BYL1CACHE 6
#define PRTE_MAPPING_BYCORE 7
#define PRTE_MAPPING_BYHWTHREAD 8
/* now take the other round-robin options */
#define PRTE_MAPPING_BYSLOT 9
#define PRTE_MAPPING_BYDIST 10
#define PRTE_MAPPING_PELIST 11
/* convenience - declare anything <= 15 to be round-robin*/
#define PRTE_MAPPING_RR 16
/* sequential policy */
#define PRTE_MAPPING_SEQ 20
#define PRTE_MAPPING_COLOCATE 21
/* rank file and other user-defined mapping */
#define PRTE_MAPPING_BYUSER 22
/* pattern-based mapping */
#define PRTE_MAPPING_PPR 23
/* macro to separate out the mapping policy
* from the directives
*/
#define PRTE_GET_MAPPING_POLICY(pol) ((pol) & 0x00ff)
/* macro to determine if mapping policy is set */
#define PRTE_MAPPING_POLICY_IS_SET(pol) ((pol) & 0x00ff)
#define PRTE_SET_MAPPING_POLICY(target, pol) (target) = (pol) | ((target) & 0xff00)
/* define ranking directives */
#define PRTE_RANKING_GIVEN 0x1000
#define PRTE_SET_RANKING_DIRECTIVE(target, pol) (target) |= (pol)
#define PRTE_UNSET_RANKING_DIRECTIVE(target, pol) (target) &= ~(pol)
#define PRTE_GET_RANKING_DIRECTIVE(pol) ((pol) & 0xf000)
/* define ranking policies */
#define PRTE_RANK_BY_NODE 1
#define PRTE_RANK_BY_SLOT 2
#define PRTE_RANK_BY_FILL 3
#define PRTE_RANK_BY_SPAN 4
#define PRTE_RANKING_BYUSER 5
#define PRTE_GET_RANKING_POLICY(pol) ((pol) &0x0fff)
/* macro to determine if ranking policy is set */
#define PRTE_RANKING_POLICY_IS_SET(pol) ((pol) & 0x0fff)
#define PRTE_SET_RANKING_POLICY(target, pol) (target) = (pol) | ((target) & 0xf000)
END_C_DECLS
#endif

View File

@@ -0,0 +1,83 @@
/*
* Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
* rtc framework base functionality.
*/
#ifndef PRTE_MCA_RTC_BASE_H
#define PRTE_MCA_RTC_BASE_H
/*
* includes
*/
#include "prte_config.h"
#include "types.h"
#include "src/class/pmix_list.h"
#include "src/mca/mca.h"
#include "src/mca/odls/base/base.h"
#include "src/util/pmix_printf.h"
#include "src/mca/rtc/rtc.h"
BEGIN_C_DECLS
/*
* MCA Framework
*/
PRTE_EXPORT extern pmix_mca_base_framework_t prte_rtc_base_framework;
/* select a component */
PRTE_EXPORT int prte_rtc_base_select(void);
/*
* Global functions for MCA overall collective open and close
*/
/**
* Struct to hold data global to the rtc framework
*/
typedef struct {
/* list of selected modules */
pmix_list_t actives;
} prte_rtc_base_t;
/**
* Global instance of rtc-wide framework data
*/
PRTE_EXPORT extern prte_rtc_base_t prte_rtc_base;
/**
* Select an rtc component / module
*/
typedef struct {
pmix_list_item_t super;
int pri;
prte_rtc_base_module_t *module;
pmix_mca_base_component_t *component;
} prte_rtc_base_selected_module_t;
PMIX_CLASS_DECLARATION(prte_rtc_base_selected_module_t);
PRTE_EXPORT void prte_rtc_base_assign(prte_job_t *jdata);
PRTE_EXPORT void prte_rtc_base_set(prte_odls_spawn_caddy_t *cd, int error_fd);
PRTE_EXPORT void prte_rtc_base_get_avail_vals(pmix_list_t *vals);
/* Called from the child to send a warning show_help message up the
pipe to the waiting parent. */
PRTE_EXPORT int prte_rtc_base_send_warn_show_help(int fd, const char *file, const char *topic, ...);
/* Called from the child to send an error message up the pipe to the
waiting parent. */
PRTE_EXPORT void prte_rtc_base_send_error_show_help(int fd, int exit_status, const char *file,
const char *topic, ...);
END_C_DECLS
#endif

View File

@@ -0,0 +1,108 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
* The PRTE Run-Time Control Framework (RTC)
*
*/
#ifndef PRTE_MCA_RTC_H
#define PRTE_MCA_RTC_H
#include "prte_config.h"
#include "types.h"
#include "src/class/pmix_list.h"
#include "src/mca/mca.h"
#include "src/mca/odls/base/base.h"
#include "src/pmix/pmix-internal.h"
#include "src/runtime/prte_globals.h"
BEGIN_C_DECLS
typedef struct {
pmix_list_item_t super;
char *component;
char *category;
prte_value_t control;
} prte_rtc_resource_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_rtc_resource_t);
/* Assign run-time controls for a given job. This provides each component with
* an opportunity to insert attributes into the prte_job_t and/or its
* associated proc structures that will be passed to backend daemons for
* controlling the job. For example, if the user specified a frequency
* setting for the job, then the freq component will have an opportunity
* to add an attribute to the job so the freq component on the remote daemons
* can "catch" it and perform the desired action
*/
typedef void (*prte_rtc_base_module_assign_fn_t)(prte_job_t *jdata);
/* Set run-time controls for a given job and/or process. This can include
* controls for power, binding, memory, and any other resource on the node.
* Each active plugin will be given a chance to operate on the request, setting
* whatever controls that lie within its purview.
*
* Each module is responsible for reporting errors via the state machine. Thus,
* no error code is returned. However, warnings and error messages for the user
* can be output via the provided error_fd */
typedef void (*prte_rtc_base_module_set_fn_t)(prte_odls_spawn_caddy_t *cd,
int error_fd);
/* Return a list of valid controls values for this component.
* Each module is responsible for adding its control values
* to a list of prte_value_t objects.
*/
typedef void (*prte_rtc_base_module_get_avail_vals_fn_t)(pmix_list_t *vals);
/* provide a way for the module to init during selection */
typedef int (*prte_rtc_base_module_init_fn_t)(void);
/* provide a chance for the module to finalize */
typedef void (*prte_rtc_base_module_fini_fn_t)(void);
/*
* rtc module version 1.0.0
*/
typedef struct {
prte_rtc_base_module_init_fn_t init;
prte_rtc_base_module_fini_fn_t finalize;
prte_rtc_base_module_assign_fn_t assign;
prte_rtc_base_module_set_fn_t set;
prte_rtc_base_module_get_avail_vals_fn_t get_available_values;
} prte_rtc_base_module_t;
/* provide a public API version */
typedef struct {
prte_rtc_base_module_assign_fn_t assign;
prte_rtc_base_module_set_fn_t set;
prte_rtc_base_module_get_avail_vals_fn_t get_available_values;
} prte_rtc_API_module_t;
/**
* rtc component version 1.0.0
*/
typedef pmix_mca_base_component_t prte_rtc_base_component_t;
/* declare the struct containing the public API */
PRTE_EXPORT extern prte_rtc_API_module_t prte_rtc;
/*
* Macro for use in components that are of type rtc
*/
#define PRTE_RTC_BASE_VERSION_1_0_0 PRTE_MCA_BASE_VERSION_3_0_0("rtc", 1, 0, 0)
END_C_DECLS
#endif

View File

@@ -0,0 +1,113 @@
/*
* Copyright (c) 2015-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2020 IBM Corporation. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
* schizo framework base functionality.
*/
#ifndef PRTE_MCA_SCHIZO_BASE_H
#define PRTE_MCA_SCHIZO_BASE_H
/*
* includes
*/
#include "prte_config.h"
#include "types.h"
#include "src/class/pmix_list.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/mca/mca.h"
#include "src/util/pmix_cmd_line.h"
#include "src/util/pmix_printf.h"
#include "src/runtime/prte_globals.h"
#include "src/mca/schizo/schizo.h"
BEGIN_C_DECLS
/*
* MCA Framework
*/
PRTE_EXPORT extern pmix_mca_base_framework_t prte_schizo_base_framework;
/* select all components */
PRTE_EXPORT int prte_schizo_base_select(void);
/**
* Struct to hold data global to the schizo framework
*/
typedef struct {
/* list of active modules */
pmix_list_t active_modules;
bool test_proxy_launch;
} prte_schizo_base_t;
/**
* Global instance of schizo-wide framework data
*/
PRTE_EXPORT extern prte_schizo_base_t prte_schizo_base;
/**
* Active schizo component / module
*/
typedef struct {
pmix_list_item_t super;
int pri;
prte_schizo_base_module_t *module;
pmix_mca_base_component_t *component;
} prte_schizo_base_active_module_t;
PMIX_CLASS_DECLARATION(prte_schizo_base_active_module_t);
typedef struct {
char *name;
char **conflicts;
} prte_schizo_conflicts_t;
/* base support functions */
PRTE_EXPORT int prte_schizo_base_convert(pmix_cli_result_t *results,
char *deprecated,
char *key, char *option,
prte_schizo_conflicts_t *conflicts,
bool report);
/* the base stub functions */
PRTE_EXPORT prte_schizo_base_module_t *prte_schizo_base_detect_proxy(char *cmdpath);
PRTE_EXPORT void prte_schizo_base_root_error_msg(void);
PRTE_EXPORT char *prte_schizo_base_getline(FILE *fp);
PRTE_EXPORT char *prte_schizo_base_strip_quotes(char *p);
PRTE_EXPORT int prte_schizo_base_parse_prte(int argc, int start, char **argv, char ***target);
PRTE_EXPORT int prte_schizo_base_parse_pmix(int argc, int start, char **argv, char ***target);
PRTE_EXPORT int prte_schizo_base_sanity(pmix_cli_result_t *cmd_line);
PRTE_EXPORT bool prte_schizo_base_check_directives(char *directive,
char **valid,
char **quals,
char *dir);
PRTE_EXPORT bool prte_schizo_base_check_qualifiers(char *directive,
char **valid,
char *qual);
PRTE_EXPORT void prte_schizo_base_expose(char *param, char *prefix);
PRTE_EXPORT int prte_schizo_base_add_directive(pmix_cli_result_t *results,
const char *deprecated, const char *target,
char *directive, bool report);
PRTE_EXPORT int prte_schizo_base_add_qualifier(pmix_cli_result_t *results,
char *deprecated, char *target,
char *qualifier, bool report);
PRTE_EXPORT int prte_schizo_base_parse_output(pmix_cli_item_t *opt, void *jinfo);
PRTE_EXPORT int prte_schizo_base_parse_display(pmix_cli_item_t *opt, void *jinfo);
PRTE_EXPORT int prte_schizo_base_setup_fork(prte_job_t *jdata, prte_app_context_t *app);
END_C_DECLS
#endif

View File

@@ -0,0 +1,157 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2015-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2020 IBM Corporation. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
* Copyright (c) 2022 Triad National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
* The PRTE Personality Framework (schizo)
*
* Multi-select framework so that multiple personalities can be
* simultaneously supported
*
*/
#ifndef PRTE_MCA_SCHIZO_H
#define PRTE_MCA_SCHIZO_H
#include "prte_config.h"
#include "types.h"
#include "src/class/pmix_list.h"
#include "src/hwloc/hwloc-internal.h"
#include "src/mca/rmaps/rmaps_types.h"
#include "src/pmix/pmix-internal.h"
#include "src/util/pmix_cmd_line.h"
#include "src/mca/mca.h"
#include "src/runtime/prte_globals.h"
BEGIN_C_DECLS
typedef int (*prte_schizo_convertor_fn_t)(char *option, char ***argv, int idx);
/*
* schizo module functions
*/
/**
* SCHIZO module functions - the modules are accessed via
* the base stub functions
*/
/* initialize the module - allow it to do whatever one-time
* things it requires */
typedef int (*prte_schizo_base_module_init_fn_t)(void);
/* parse a tool command line */
typedef int (*prte_schizo_base_module_parse_cli_fn_t)(char **argv,
pmix_cli_result_t *results,
bool silent);
/* detect if we are running as a proxy
* Check the environment to determine what, if any, host we are running
* under. Check the argv to see if we are running as a proxy for some
* other command and to see which environment we are proxying. Return
* a priority indicating the level of confidence this component has
* that it is the proxy, with 100 being a definitive "yes". Highest
* confidence wins.
*/
typedef int (*prte_schizo_base_detect_proxy_fn_t)(char *cmdpath);
/* parse the environment of the
* tool to extract any personality-specific envars that need to be
* forward to the app's environment upon execution */
typedef int (*prte_schizo_base_module_parse_env_fn_t)(char **srcenv,
char ***dstenv,
pmix_cli_result_t *cli);
/* check if running as root is allowed in this environment */
typedef void (*prte_schizo_base_module_allow_run_as_root_fn_t)(pmix_cli_result_t *results);
/* Set the default mapping policy for a job */
typedef int (*prte_schizo_base_module_set_default_mapping_fn_t)(prte_job_t *jdata,
prte_rmaps_options_t *options);
typedef int (*prte_schizo_base_module_set_default_ranking_fn_t)(prte_job_t *jdata,
prte_rmaps_options_t *options);
typedef int (*prte_schizo_base_module_set_default_binding_fn_t)(prte_job_t *jdata,
prte_rmaps_options_t *options);
typedef int (*prte_schizo_base_module_set_default_rto_fn_t)(prte_job_t *jdata,
prte_rmaps_options_t *options);
/* do whatever preparation work
* is required to setup the app for execution. This is intended to be
* used by prun and other launcher tools to, for example, change
* an executable's relative-path to an absolute-path, or add a command
* required for starting a particular kind of application (e.g., adding
* "java" to start a Java application) */
typedef int (*prte_schizo_base_module_setup_app_fn_t)(prte_pmix_app_t *app);
/* add any personality-specific envars required at the job level prior
* to beginning to execute local procs */
typedef int (*prte_schizo_base_module_setup_fork_fn_t)(prte_job_t *jdata,
prte_app_context_t *context);
/* give the component a chance to cleanup */
typedef void (*prte_schizo_base_module_finalize_fn_t)(void);
/* give the components a chance to add job info */
typedef void (*prte_schizo_base_module_job_info_fn_t)(pmix_cli_result_t *results,
void *jobinfo);
/* give the component a chance to validate directives and their values */
typedef int (*prte_schizo_base_module_check_sanity_fn_t)(pmix_cli_result_t *cmd_line);
/*
* schizo module version 1.3.0
*/
typedef struct {
char *name;
prte_schizo_base_module_init_fn_t init;
prte_schizo_base_module_parse_cli_fn_t parse_cli;
prte_schizo_base_module_parse_env_fn_t parse_env;
prte_schizo_base_detect_proxy_fn_t detect_proxy;
prte_schizo_base_module_allow_run_as_root_fn_t allow_run_as_root;
prte_schizo_base_module_set_default_mapping_fn_t set_default_mapping;
prte_schizo_base_module_set_default_ranking_fn_t set_default_ranking;
prte_schizo_base_module_set_default_binding_fn_t set_default_binding;
prte_schizo_base_module_set_default_rto_fn_t set_default_rto;
prte_schizo_base_module_setup_app_fn_t setup_app;
prte_schizo_base_module_setup_fork_fn_t setup_fork;
prte_schizo_base_module_job_info_fn_t job_info;
prte_schizo_base_module_check_sanity_fn_t check_sanity;
prte_schizo_base_module_finalize_fn_t finalize;
} prte_schizo_base_module_t;
/*
* schizo component
*/
/**
* schizo component version 1.3.0
*/
typedef pmix_mca_base_component_t prte_schizo_base_component_t;
/**
* Macro for use in components that are of type schizo
*/
#define PRTE_MCA_SCHIZO_BASE_VERSION_1_0_0 PRTE_MCA_BASE_VERSION_3_0_0("schizo", 1, 0, 0)
END_C_DECLS
#endif

View File

@@ -0,0 +1,102 @@
/*
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2018-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef PRTE_MCA_STATE_BASE_H
#define PRTE_MCA_STATE_BASE_H
/*
* includes
*/
#include "prte_config.h"
#include "constants.h"
#include "src/class/pmix_list.h"
#include "src/util/pmix_printf.h"
#include "src/mca/mca.h"
#include "src/mca/rmaps/rmaps_types.h"
#include "src/mca/state/state.h"
BEGIN_C_DECLS
/**
* Struct to hold data global to the state framework
*/
typedef struct {
int parent_fd;
bool ready_msg;
bool run_fdcheck;
bool recoverable;
int max_restarts;
bool continuous;
bool error_non_zero_exit;
bool show_launch_progress;
bool notifyerrors;
bool autorestart;
} prte_state_base_t;
PRTE_EXPORT extern prte_state_base_t prte_state_base;
/* select a component */
PRTE_EXPORT int prte_state_base_select(void);
/* debug tools */
PRTE_EXPORT void prte_state_base_print_job_state_machine(void);
PRTE_EXPORT void prte_state_base_print_proc_state_machine(void);
PRTE_EXPORT int prte_state_base_set_default_rto(prte_job_t *jdata,
prte_rmaps_options_t *options);
PRTE_EXPORT int prte_state_base_set_runtime_options(prte_job_t *jdata, char *spec);
/*
* Base functions
*/
PRTE_EXPORT void prte_state_base_activate_job_state(prte_job_t *jdata, prte_job_state_t state);
PRTE_EXPORT int prte_state_base_add_job_state(prte_job_state_t state, prte_state_cbfunc_t cbfunc);
PRTE_EXPORT int prte_state_base_set_job_state_callback(prte_job_state_t state,
prte_state_cbfunc_t cbfunc);
PRTE_EXPORT int prte_state_base_remove_job_state(prte_job_state_t state);
PRTE_EXPORT void prte_util_print_job_state_machine(void);
PRTE_EXPORT void prte_state_base_activate_proc_state(pmix_proc_t *proc, prte_proc_state_t state);
PRTE_EXPORT int prte_state_base_add_proc_state(prte_proc_state_t state, prte_state_cbfunc_t cbfunc);
PRTE_EXPORT int prte_state_base_set_proc_state_callback(prte_proc_state_t state,
prte_state_cbfunc_t cbfunc);
PRTE_EXPORT int prte_state_base_remove_proc_state(prte_proc_state_t state);
PRTE_EXPORT void prte_util_print_proc_state_machine(void);
/* common state processing functions */
PRTE_EXPORT void prte_state_base_local_launch_complete(int fd, short argc, void *cbdata);
PRTE_EXPORT void prte_state_base_cleanup_job(int fd, short argc, void *cbdata);
PRTE_EXPORT void prte_state_base_report_progress(int fd, short argc, void *cbdata);
PRTE_EXPORT void prte_state_base_track_procs(int fd, short argc, void *cbdata);
PRTE_EXPORT void prte_state_base_check_all_complete(int fd, short args, void *cbdata);
PRTE_EXPORT void prte_state_base_check_fds(prte_job_t *jdata);
PRTE_EXPORT void prte_state_base_notify_data_server(pmix_proc_t *target);
END_C_DECLS
#endif

View File

@@ -0,0 +1,292 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2017-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2024 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**** PRTE STATE MACHINE ****/
/* States are treated as events so that the event
* library can sequence them. Each state consists
* of an event, a job or process state, a pointer
* to the respective object, and a callback function
* to be executed for that state. Events can be defined
* at different priorities - e.g., SYS priority for
* events associated with launching jobs, and ERR priority
* for events associated with abnormal termination of
* a process.
*
* The state machine consists of a list of state objects,
* each defining a state-cbfunc pair. At startup, a default
* list is created by the base functions which is then
* potentially customized by selected components within
* the various PRTE frameworks. For example, a PLM component
* may need to insert states in the launch procedure, or may
* want to redirect a particular state callback to a custom
* function.
*
* For convenience, an ANY state can be defined along with a generic
* callback function, with the corresponding state object
* placed at the end of the state machine. Setting the
* machine to a state that has not been explicitly defined
* will cause this default action to be executed. Thus, you
* don't have to explicitly define a state-cbfunc pair
* for every job or process state.
*/
#ifndef _PRTE_STATE_H_
#define _PRTE_STATE_H_
#include "prte_config.h"
#include "src/class/pmix_list.h"
#include "src/event/event-internal.h"
#include "src/pmix/pmix-internal.h"
#include "src/mca/errmgr/errmgr.h"
#include "src/mca/plm/plm_types.h"
#include "src/mca/state/state_types.h"
#include "src/runtime/prte_globals.h"
#include "src/util/error_strings.h"
BEGIN_C_DECLS
/*
* MCA Framework - put here to access the pmix_output channel
* in the macros
*/
PRTE_EXPORT extern pmix_mca_base_framework_t prte_state_base_framework;
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
/* For ease in debugging the state machine, it is STRONGLY recommended
* that the functions be accessed using the following macros
*/
/* Timestamp for state printouts */
#define PRTE_STATE_GET_TIMESTAMP(t) \
do { \
struct timeval tv; \
gettimeofday(&tv, NULL); \
t = tv.tv_sec; \
t += (double) tv.tv_usec / 1000000.0; \
} while (0);
#define PRTE_ACTIVATE_JOB_STATE(j, s) \
do { \
prte_job_t *shadow = (j); \
if (prte_state_base_framework.framework_verbose > 0) { \
double timestamp = 0.0; \
PRTE_STATE_GET_TIMESTAMP(timestamp); \
pmix_output_verbose(1, prte_state_base_framework.framework_output, \
"%s [%f] ACTIVATE JOB %s STATE %s AT %s:%d", \
PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), timestamp, \
(NULL == shadow) ? "NULL" : PRTE_JOBID_PRINT(shadow->nspace), \
prte_job_state_to_str((s)), __FILE__, __LINE__); \
} \
prte_state.activate_job_state(shadow, (s)); \
} while (0);
#define PRTE_ACTIVATE_PROC_STATE(p, s) \
do { \
pmix_proc_t *shadow = (p); \
if (prte_state_base_framework.framework_verbose > 0) { \
double timestamp = 0.0; \
PRTE_STATE_GET_TIMESTAMP(timestamp); \
pmix_output_verbose(1, prte_state_base_framework.framework_output, \
"%s [%f] ACTIVATE PROC %s STATE %s AT %s:%d", \
PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), timestamp, \
(NULL == shadow) ? "NULL" : PRTE_NAME_PRINT(shadow), \
prte_proc_state_to_str((s)), __FILE__, __LINE__); \
} \
prte_state.activate_proc_state(shadow, (s)); \
} while (0);
/* Called when actually arriving (reaching) the state with priority k */
#define PRTE_REACHING_JOB_STATE(j, s) \
do { \
prte_job_t *shadow = (j); \
if (prte_state_base_framework.framework_verbose > 0) { \
double timestamp = 0.0; \
PRTE_STATE_GET_TIMESTAMP(timestamp); \
pmix_output_verbose(1, prte_state_base_framework.framework_output, \
"%s [%f] ACTIVATING JOB %s STATE %s", \
PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), timestamp, \
(NULL == shadow) ? "NULL" : PRTE_JOBID_PRINT(shadow->nspace), \
prte_job_state_to_str((s))); \
} \
} while (0);
#define PRTE_REACHING_PROC_STATE(p, s) \
do { \
pmix_proc_t *shadow = (p); \
if (prte_state_base_framework.framework_verbose > 0) { \
double timestamp = 0.0; \
PRTE_STATE_GET_TIMESTAMP(timestamp); \
pmix_output_verbose(1, prte_state_base_framework.framework_output, \
"%s [%f] ACTIVATING PROC %s STATE %s", \
PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), timestamp, \
(NULL == shadow) ? "NULL" : PRTE_NAME_PRINT(shadow), \
prte_proc_state_to_str((s))); \
} \
} while (0);
/**
* Module initialization function.
*
* @retval PRTE_SUCCESS The operation completed successfully
* @retval PRTE_ERROR An unspecifed error occurred
*/
typedef int (*prte_state_base_module_init_fn_t)(void);
/**
* Module finalization function.
*
* @retval PRTE_SUCCESS The operation completed successfully
* @retval PRTE_ERROR An unspecifed error occurred
*/
typedef int (*prte_state_base_module_finalize_fn_t)(void);
/**** JOB STATE APIs ****/
/* Job states are accessed via prte_job_t objects as they are only
* used in PRTE tools and not application processes. APIs are provided
* for assembling and editing the state machine, as well as activating
* a specific job state
*
* Note the inherent assumption in this design that any customization
* of the state machine will at least start with the base states - i.e.,
* that one would start with the default machine and edit it to add,
* remove, or modify callbacks as required. Alternatively, one could
* just clear the list entirely and assemble a fully custom state
* machine - both models are supported.
*/
/* Activate a state in the job state machine.
*
* Creates and activates an event with the callback corresponding to the
* specified job state. If the specified state is not found:
*
* 1. if a state machine entry for PRTE_JOB_STATE_ERROR was given, and
* the state is an error state (i.e., PRTE_JOB_STATE_ERROR <= state),
* then the callback for the ERROR state will be used
*
* 2. if a state machine entry for PRTE_JOB_STATE_ANY was given, and
* the state is not an error state (i.e., state < PRTE_JOB_STATE_ERROR),
* then the callback for the ANY state will be used
*
* 3. if neither of the above is true, then the call will be ignored.
*/
typedef void (*prte_state_base_module_activate_job_state_fn_t)(prte_job_t *jdata,
prte_job_state_t state);
/* Add a state to the job state machine.
*
*/
typedef int (*prte_state_base_module_add_job_state_fn_t)(prte_job_state_t state,
prte_state_cbfunc_t cbfunc);
/* Set the callback function for a state in the job state machine.
*
*/
typedef int (*prte_state_base_module_set_job_state_callback_fn_t)(prte_job_state_t state,
prte_state_cbfunc_t cbfunc);
/* Remove a state from the job state machine.
*
*/
typedef int (*prte_state_base_module_remove_job_state_fn_t)(prte_job_state_t state);
/**** Proc STATE APIs ****/
/* Proc states are accessed via pmix_proc_t as the state machine
* must be available to both application processes and PRTE tools. APIs are
* providedfor assembling and editing the state machine, as well as activating
* a specific proc state
*
* Note the inherent assumption in this design that any customization
* of the state machine will at least start with the base states - i.e.,
* that one would start with the default machine and edit it to add,
* remove, or modify callbacks as required. Alternatively, one could
* just clear the list entirely and assemble a fully custom state
* machine - both models are supported.
*/
/* Activate a proc state.
*
* Creates and activates an event with the callback corresponding to the
* specified proc state. If the specified state is not found:
*
* 1. if a state machine entry for PRTE_PROC_STATE_ERROR was given, and
* the state is an error state (i.e., PRTE_PROC_STATE_ERROR <= state),
* then the callback for the ERROR state will be used
*
* 2. if a state machine entry for PRTE_PROC_STATE_ANY was given, and
* the state is not an error state (i.e., state < PRTE_PROC_STATE_ERROR),
* then the callback for the ANY state will be used
*
* 3. if neither of the above is true, then the call will be ignored.
*/
typedef void (*prte_state_base_module_activate_proc_state_fn_t)(pmix_proc_t *proc,
prte_proc_state_t state);
/* Add a state to the proc state machine.
*
*/
typedef int (*prte_state_base_module_add_proc_state_fn_t)(prte_proc_state_t state,
prte_state_cbfunc_t cbfunc);
/* Set the callback function for a state in the proc state machine.
*
*/
typedef int (*prte_state_base_module_set_proc_state_callback_fn_t)(prte_proc_state_t state,
prte_state_cbfunc_t cbfunc);
/* Remove a state from the proc state machine.
*
*/
typedef int (*prte_state_base_module_remove_proc_state_fn_t)(prte_proc_state_t state);
/*
* Module Structure
*/
struct prte_state_base_module_1_0_0_t {
/** Initialization Function */
prte_state_base_module_init_fn_t init;
/** Finalization Function */
prte_state_base_module_finalize_fn_t finalize;
/* Job state APIs */
prte_state_base_module_activate_job_state_fn_t activate_job_state;
prte_state_base_module_add_job_state_fn_t add_job_state;
prte_state_base_module_set_job_state_callback_fn_t set_job_state_callback;
prte_state_base_module_remove_job_state_fn_t remove_job_state;
/* Proc state APIs */
prte_state_base_module_activate_proc_state_fn_t activate_proc_state;
prte_state_base_module_add_proc_state_fn_t add_proc_state;
prte_state_base_module_set_proc_state_callback_fn_t set_proc_state_callback;
prte_state_base_module_remove_proc_state_fn_t remove_proc_state;
};
typedef struct prte_state_base_module_1_0_0_t prte_state_base_module_1_0_0_t;
typedef prte_state_base_module_1_0_0_t prte_state_base_module_t;
PRTE_EXPORT extern prte_state_base_module_t prte_state;
/*
* State Component
*/
typedef pmix_mca_base_component_t prte_state_base_component_t;
/*
* Macro for use in components that are of type state
*/
#define PRTE_STATE_BASE_VERSION_1_0_0 PRTE_MCA_BASE_VERSION_3_0_0("state", 1, 0, 0)
END_C_DECLS
#endif

View File

@@ -0,0 +1,79 @@
/*
* Copyright (c) 2011 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2018-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**** PRTE STATE MACHINE ****/
/* States are treated as events so that the event
* library can sequence them. Each state consists
* of an event, a job or process state, a pointer
* to the respective object, and a callback function
* to be executed for that state. Events can be defined
* at different priorities - e.g., SYS priority for
* events associated with launching jobs, and ERR priority
* for events associated with abnormal termination of
* a process.
*
* The state machine consists of a list of state objects,
* each defining a state-cbfunc pair. At startup, a default
* list is created by the base functions which is then
* potentially customized by selected components within
* the various PRTE frameworks. For example, a PLM component
* may need to insert states in the launch procedure, or may
* want to redirect a particular state callback to a custom
* function.
*
* For convenience, an ANY state can be defined along with a generic
* callback function, with the corresponding state object
* placed at the end of the state machine. Setting the
* machine to a state that has not been explicitly defined
* will cause this default action to be executed. Thus, you
* don't have to explicitly define a state-cbfunc pair
* for every job or process state.
*/
#ifndef _PRTE_STATE_TYPES_H_
#define _PRTE_STATE_TYPES_H_
#include "prte_config.h"
#include "src/class/pmix_list.h"
#include "src/event/event-internal.h"
#include "src/mca/plm/plm_types.h"
#include "src/runtime/prte_globals.h"
BEGIN_C_DECLS
typedef void (*prte_state_cbfunc_t)(int fd, short args, void *cb);
typedef struct {
pmix_list_item_t super;
prte_job_state_t job_state;
prte_proc_state_t proc_state;
prte_state_cbfunc_t cbfunc;
} prte_state_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_state_t);
/* caddy for passing job and proc data to state event handlers */
typedef struct {
pmix_object_t super;
prte_event_t ev;
prte_job_t *jdata;
prte_job_state_t job_state;
pmix_proc_t name;
prte_proc_state_t proc_state;
} prte_state_caddy_t;
PRTE_EXPORT PMIX_CLASS_DECLARATION(prte_state_caddy_t);
END_C_DECLS
#endif