1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ 2 /* 3 * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana 4 * University Research and Technology 5 * Corporation. All rights reserved. 6 * Copyright (c) 2004-2005 The University of Tennessee and The University 7 * of Tennessee Research Foundation. All rights 8 * reserved. 9 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 10 * University of Stuttgart. All rights reserved. 11 * Copyright (c) 2004-2005 The Regents of the University of California. 12 * All rights reserved. 13 * Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights 14 * reserved. 15 * Copyright (c) 2015 Research Organization for Information Science 16 * and Technology (RIST). All rights reserved. 17 * $COPYRIGHT$ 18 * 19 * Additional copyrights may follow 20 * 21 * $HEADER$ 22 */ 23 /** @file: 24 * 25 * The Open RTE Resource Allocation Subsystem (RAS) 26 * 27 * The resource allocation subsystem is responsible for determining 28 * what (if any) resources have been allocated to the specified job 29 * (via some prior action), and to obtain an allocation (if possible) 30 * if resources have NOT been previously allocated. It is anticipated 31 * that ORTE users will execute an "mpirun" or other command that 32 * invokes ORTE through one of two channels: 33 * 34 * 1. the user will login to the computing resource they intend 35 * to use, request a resource allocation from that system, and then 36 * execute the mpirun or other command. Thus, the allocation has 37 * already been obtained prior to ORTE's initialization. In most 38 * cases, systems pass allocation information via environmental 39 * parameters. Thus, the RAS components must know the correct 40 * environmental parameter to look for within the environment they 41 * seek to support (e.g., an LSF component should know that LSF passes 42 * allocation parameters as a specific LSF-named entity). 43 * 44 * 2. the user issues an mpirun command or an application that uses 45 * ORTE without obtaining an allocation in advance. Thus, the associated 46 * RAS component must know how to request an allocation from the 47 * designated resource. If it doesn't, or it cannot obtain the allocation, 48 * then it shall indicate this by setting the system to an appropriate 49 * state. 50 */ 51 52 #ifndef ORTE_MCA_RAS_H 53 #define ORTE_MCA_RAS_H 54 55 #include "orte_config.h" 56 #include "orte/constants.h" 57 #include "orte/types.h" 58 59 #include "orte/mca/mca.h" 60 #include "opal/mca/event/event.h" 61 #include "opal/class/opal_list.h" 62 63 #include "orte/runtime/orte_globals.h" 64 65 BEGIN_C_DECLS 66 67 /* allocation event - the event one activates to schedule resource 68 * allocation for pending jobs 69 */ 70 ORTE_DECLSPEC extern opal_event_t orte_allocate_event; 71 72 /* 73 * ras module functions - these are not accessible to the outside world, 74 * but are defined here by convention 75 */ 76 77 /* init the module */ 78 typedef int (*orte_ras_base_module_init_fn_t)(void); 79 80 /** 81 * Allocate resources to a job. 82 */ 83 typedef int (*orte_ras_base_module_allocate_fn_t)(orte_job_t *jdata, 84 opal_list_t *nodes); 85 86 /* deallocate resources */ 87 typedef void (*orte_ras_base_module_dealloc_fn_t)(orte_job_t *jdata, 88 orte_app_context_t *app); 89 90 /** 91 * Cleanup module resources. 92 */ 93 typedef int (*orte_ras_base_module_finalize_fn_t)(void); 94 95 /** 96 * ras module 97 */ 98 struct orte_ras_base_module_2_0_0_t { 99 /** init */ 100 orte_ras_base_module_init_fn_t init; 101 /** Allocation function pointer */ 102 orte_ras_base_module_allocate_fn_t allocate; 103 orte_ras_base_module_dealloc_fn_t deallocate; 104 /** Finalization function pointer */ 105 orte_ras_base_module_finalize_fn_t finalize; 106 }; 107 /** Convenience typedef */ 108 typedef struct orte_ras_base_module_2_0_0_t orte_ras_base_module_2_0_0_t; 109 /** Convenience typedef */ 110 typedef orte_ras_base_module_2_0_0_t orte_ras_base_module_t; 111 112 /* 113 * ras component 114 */ 115 116 /** 117 * Component init / selection 118 * ras component 119 */ 120 struct orte_ras_base_component_2_0_0_t { 121 /** Base MCA structure */ 122 mca_base_component_t base_version; 123 /** Base MCA data */ 124 mca_base_component_data_t base_data; 125 }; 126 /** Convenience typedef */ 127 typedef struct orte_ras_base_component_2_0_0_t orte_ras_base_component_2_0_0_t; 128 /** Convenience typedef */ 129 typedef orte_ras_base_component_2_0_0_t orte_ras_base_component_t; 130 131 132 /** 133 * Macro for use in components that are of type ras 134 */ 135 #define ORTE_RAS_BASE_VERSION_2_0_0 \ 136 ORTE_MCA_BASE_VERSION_2_1_0("ras", 2, 0, 0) 137 138 139 END_C_DECLS 140 141 #endif 142