Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 10:12:57

0001 /*
0002  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
0003  *                         University Research and Technology
0004  *                         Corporation.  All rights reserved.
0005  * Copyright (c) 2004-2005 The University of Tennessee and The University
0006  *                         of Tennessee Research Foundation.  All rights
0007  *                         reserved.
0008  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
0009  *                         University of Stuttgart.  All rights reserved.
0010  * Copyright (c) 2004-2005 The Regents of the University of California.
0011  *                         All rights reserved.
0012  * Copyright (c) 2011-2020 Cisco Systems, Inc.  All rights reserved
0013  * Copyright (c) 2011-2013 Los Alamos National Security, LLC.
0014  *                         All rights reserved.
0015  * Copyright (c) 2014-2020 Intel, Inc.  All rights reserved.
0016  * Copyright (c) 2021-2023 Nanook Consulting.  All rights reserved.
0017  * $COPYRIGHT$
0018  *
0019  * Additional copyrights may follow
0020  *
0021  * $HEADER$
0022  */
0023 /** @file:
0024  * rmaps framework base functionality.
0025  */
0026 
0027 #ifndef PRTE_MCA_RMAPS_BASE_H
0028 #define PRTE_MCA_RMAPS_BASE_H
0029 
0030 /*
0031  * includes
0032  */
0033 #include "prte_config.h"
0034 #include "types.h"
0035 
0036 #include "src/class/pmix_list.h"
0037 #include "src/mca/mca.h"
0038 #include "src/mca/base/pmix_mca_base_framework.h"
0039 #include "src/mca/schizo/schizo.h"
0040 #include "src/util/pmix_printf.h"
0041 
0042 #include "src/runtime/prte_globals.h"
0043 
0044 #include "src/mca/rmaps/rmaps.h"
0045 
0046 BEGIN_C_DECLS
0047 
0048 /*
0049  * MCA Framework
0050  */
0051 PRTE_EXPORT extern pmix_mca_base_framework_t prte_rmaps_base_framework;
0052 /* select a component */
0053 PRTE_EXPORT int prte_rmaps_base_select(void);
0054 
0055 /*
0056  * Global functions for MCA overall collective open and close
0057  */
0058 
0059 /**
0060  * Struct to hold data global to the rmaps framework
0061  */
0062 typedef struct {
0063     /* list of selected modules */
0064     pmix_list_t selected_modules;
0065     /* default mapping/ranking directives */
0066     prte_mapping_policy_t mapping;
0067     prte_ranking_policy_t ranking;
0068     /* default device for dist mapping */
0069     char *device;
0070     /* whether or not child jobs should inherit mapping/ranking/binding directives from their parent
0071      * by default */
0072     bool inherit;
0073     /* whether or not we are using hwthreads as independent cpus by default */
0074     bool hwthread_cpus;
0075     /* default file for use in sequential and rankfile mapping
0076      * when the directive comes thru MCA param */
0077     char *file;
0078     hwloc_cpuset_t available, baseset;  // scratch for binding calculation
0079     char *default_mapping_policy;
0080     /* whether or not to require hwtcpus due to topology limitations */
0081     bool require_hwtcpus;
0082 } prte_rmaps_base_t;
0083 
0084 /**
0085  * Global instance of rmaps-wide framework data
0086  */
0087 PRTE_EXPORT extern prte_rmaps_base_t prte_rmaps_base;
0088 
0089 /**
0090  * Select an rmaps component / module
0091  */
0092 typedef struct {
0093     pmix_list_item_t super;
0094     int pri;
0095     prte_rmaps_base_module_t *module;
0096     pmix_mca_base_component_t *component;
0097 } prte_rmaps_base_selected_module_t;
0098 PMIX_CLASS_DECLARATION(prte_rmaps_base_selected_module_t);
0099 
0100 /*
0101  * Map a job
0102  */
0103 PRTE_EXPORT void prte_rmaps_base_map_job(int sd, short args, void *cbdata);
0104 
0105 /**
0106  * Utility routines to get/set vpid mapping for the job
0107  */
0108 
0109 PRTE_EXPORT int prte_rmaps_base_get_vpid_range(pmix_nspace_t jobid, pmix_rank_t *start,
0110                                                pmix_rank_t *range);
0111 PRTE_EXPORT int prte_rmaps_base_set_vpid_range(pmix_nspace_t jobid, pmix_rank_t start,
0112                                                pmix_rank_t range);
0113 
0114 /* pretty-print functions */
0115 PRTE_EXPORT char *prte_rmaps_base_print_mapping(prte_mapping_policy_t mapping);
0116 PRTE_EXPORT char *prte_rmaps_base_print_ranking(prte_ranking_policy_t ranking);
0117 
0118 PRTE_EXPORT int prte_rmaps_base_prep_topology(hwloc_topology_t topo);
0119 
0120 PRTE_EXPORT int prte_rmaps_base_filter_nodes(prte_app_context_t *app, pmix_list_t *nodes,
0121                                              bool remove);
0122 
0123 PRTE_EXPORT int prte_rmaps_base_set_default_mapping(prte_job_t *jdata,
0124                                                     prte_rmaps_options_t *options);
0125 PRTE_EXPORT int prte_rmaps_base_set_mapping_policy(prte_job_t *jdata, char *spec);
0126 
0127 PRTE_EXPORT int prte_rmaps_base_set_default_ranking(prte_job_t *jdata,
0128                                                     prte_rmaps_options_t *options);
0129 PRTE_EXPORT int prte_rmaps_base_set_ranking_policy(prte_job_t *jdata, char *spec);
0130 
0131 PRTE_EXPORT void prte_rmaps_base_display_map(prte_job_t *jdata);
0132 PRTE_EXPORT void prte_rmaps_base_report_bindings(prte_job_t *jdata,
0133                                                  prte_rmaps_options_t *options);
0134 
0135 PRTE_EXPORT int prte_rmaps_base_get_ncpus(prte_node_t *node,
0136                                           hwloc_obj_t obj,
0137                                           prte_rmaps_options_t *options);
0138 
0139 PRTE_EXPORT bool prte_rmaps_base_check_avail(prte_job_t *jdata,
0140                                              prte_app_context_t *app,
0141                                              prte_node_t *node,
0142                                              pmix_list_t *node_list,
0143                                              hwloc_obj_t obj,
0144                                              prte_rmaps_options_t *options);
0145 
0146 PRTE_EXPORT int prte_rmaps_base_check_oversubscribed(prte_job_t *jdata,
0147                                                      prte_app_context_t *app,
0148                                                      prte_node_t *node,
0149                                                      prte_rmaps_options_t *options);
0150 
0151 PRTE_EXPORT void prte_rmaps_base_get_cpuset(prte_job_t *jdata,
0152                                             prte_node_t *node,
0153                                             prte_rmaps_options_t *options);
0154 
0155 PRTE_EXPORT int prte_rmaps_base_check_support(prte_job_t *jdata,
0156                                               prte_node_t *node,
0157                                               prte_rmaps_options_t *options);
0158 
0159 END_C_DECLS
0160 
0161 #endif