Enable the ability to constrain applications to hosts on the basis of resources.
This commit was SVN r24736.
Этот коммит содержится в:
родитель
37d5c7e2ca
Коммит
8f401a0563
@ -33,6 +33,7 @@ BEGIN_C_DECLS
|
||||
#define OPAL_SYSINFO_CPU_MODEL "CPU_MODEL"
|
||||
#define OPAL_SYSINFO_NUM_CPUS "NUM_CPUS"
|
||||
#define OPAL_SYSINFO_MEM_SIZE "MEMORY"
|
||||
#define OPAL_SYSINFO_HOST_TYPE "HOST_TYPE"
|
||||
|
||||
typedef struct {
|
||||
opal_list_item_t super;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "opal/mca/mca.h"
|
||||
#include "opal/mca/base/base.h"
|
||||
#include "opal/mca/base/mca_base_param.h"
|
||||
#include "opal/mca/sysinfo/sysinfo_types.h"
|
||||
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
@ -47,11 +48,13 @@
|
||||
int orte_rmaps_base_get_target_nodes(opal_list_t *allocated_nodes, orte_std_cntr_t *total_num_slots,
|
||||
orte_app_context_t *app, orte_mapping_policy_t policy)
|
||||
{
|
||||
opal_list_item_t *item, *next;
|
||||
opal_list_item_t *item, *item2, *item3, *next;
|
||||
orte_node_t *node;
|
||||
orte_std_cntr_t num_slots;
|
||||
orte_std_cntr_t i;
|
||||
int rc;
|
||||
bool found;
|
||||
opal_sysinfo_value_t *req_res, *ninfo;
|
||||
|
||||
/** set default answer */
|
||||
*total_num_slots = 0;
|
||||
@ -189,6 +192,46 @@ int orte_rmaps_base_get_target_nodes(opal_list_t *allocated_nodes, orte_std_cntr
|
||||
}
|
||||
}
|
||||
|
||||
/* finally, filter thru any resource constraints */
|
||||
for (item = opal_list_get_first(&app->resource_constraints);
|
||||
item != opal_list_get_end(&app->resource_constraints);
|
||||
item = opal_list_get_next(item)) {
|
||||
req_res = (opal_sysinfo_value_t*)item;
|
||||
|
||||
/* check against node values */
|
||||
item2 = opal_list_get_first(allocated_nodes);
|
||||
while (item2 != opal_list_get_end(allocated_nodes)) {
|
||||
next = opal_list_get_next(item2);
|
||||
node = (orte_node_t*)item2;
|
||||
found = false;
|
||||
for (item3 = opal_list_get_first(&node->resources);
|
||||
item3 != opal_list_get_end(&node->resources);
|
||||
item3 = opal_list_get_next(item3)) {
|
||||
ninfo = (opal_sysinfo_value_t*)item3;
|
||||
|
||||
if (0 == strcmp(req_res->key, ninfo->key)) {
|
||||
if (OPAL_STRING == req_res->type) {
|
||||
if (0 == strncasecmp(req_res->data.str,
|
||||
ninfo->data.str,
|
||||
strlen(req_res->data.str))) {
|
||||
found = true;
|
||||
}
|
||||
} else {
|
||||
if (req_res->data.i64 <= ninfo->data.i64) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
opal_list_remove_item(allocated_nodes, item2);
|
||||
OBJ_RELEASE(item2);
|
||||
}
|
||||
item2 = next;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the "no local" option was set, then remove the local node
|
||||
* from the list
|
||||
*/
|
||||
|
@ -554,6 +554,7 @@ static void orte_app_context_construct(orte_app_context_t* app_context)
|
||||
app_context->add_hostfile=NULL;
|
||||
app_context->add_host = NULL;
|
||||
app_context->dash_host = NULL;
|
||||
OBJ_CONSTRUCT(&app_context->resource_constraints, opal_list_t);
|
||||
app_context->prefix_dir = NULL;
|
||||
app_context->preload_binary = false;
|
||||
app_context->preload_files = NULL;
|
||||
@ -570,6 +571,8 @@ static void orte_app_context_construct(orte_app_context_t* app_context)
|
||||
|
||||
static void orte_app_context_destructor(orte_app_context_t* app_context)
|
||||
{
|
||||
opal_list_item_t *item;
|
||||
|
||||
if (NULL != app_context->app) {
|
||||
free (app_context->app);
|
||||
app_context->app = NULL;
|
||||
@ -611,6 +614,11 @@ static void orte_app_context_destructor(orte_app_context_t* app_context)
|
||||
app_context->dash_host = NULL;
|
||||
}
|
||||
|
||||
while (NULL != (item = opal_list_remove_first(&app_context->resource_constraints))) {
|
||||
OBJ_RELEASE(item);
|
||||
}
|
||||
OBJ_DESTRUCT(&app_context->resource_constraints);
|
||||
|
||||
if (NULL != app_context->prefix_dir) {
|
||||
free(app_context->prefix_dir);
|
||||
app_context->prefix_dir = NULL;
|
||||
|
@ -202,6 +202,10 @@ typedef struct {
|
||||
char **add_host;
|
||||
/** argv of hosts passed in to -host */
|
||||
char ** dash_host;
|
||||
/** list of resource constraints to be applied
|
||||
* when selecting hosts for this app
|
||||
*/
|
||||
opal_list_t resource_constraints;
|
||||
/** Prefix directory for this app (or NULL if no override necessary) */
|
||||
char *prefix_dir;
|
||||
/** Preload the binary on the remote machine (in PLM via FileM) */
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user