Roll in the Voltaire core/socket/etc process mapping implementation. Only change I made was to cleanup some of the diagnostic output in the odls_default component so it uses the -mca odls_base_verbose parameter.
You will not see any impact from this change unless you use the syntax described in ticket #1023. I've tried as many of the RAS components as possible and saw no problem - there may be issues with other RAS components that would not compile on any of my systems. Anything that appears should be trivial to fix. This commit was SVN r15427.
Этот коммит содержится в:
родитель
c839694fb8
Коммит
d109e9a6f4
@ -135,7 +135,6 @@ int orte_dss_unpack_buffer(orte_buffer_t *buffer, void *dst, orte_std_cntr_t *nu
|
||||
}
|
||||
|
||||
rc = info->odti_unpack_fn(buffer, dst, num_vals, type);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -138,8 +138,6 @@ typedef void* orte_iov_base_ptr_t;
|
||||
/* Need a command separate from ORTE_DAEMON_CMD, so that we can receive on
|
||||
* them both at the same time */
|
||||
#define ORTE_CKPT_CMD (orte_data_type_t) 61 /**< command flag for communicating with HNP */
|
||||
|
||||
|
||||
/* define the starting point for dynamically assigning data types */
|
||||
#define ORTE_DSS_ID_DYNAMIC 70
|
||||
|
||||
|
@ -59,6 +59,8 @@ static void orte_odls_child_constructor(orte_odls_child_t *ptr)
|
||||
ptr->alive = false;
|
||||
ptr->state = ORTE_PROC_STATE_UNDEF;
|
||||
ptr->exit_code = 0;
|
||||
ptr->cpu_set = 0xffffffff;
|
||||
|
||||
}
|
||||
static void orte_odls_child_destructor(orte_odls_child_t *ptr)
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ extern "C" {
|
||||
/*
|
||||
* General ODLS types
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* List object to locally store the process names and pids of
|
||||
* our children. This can subsequently be used to order termination
|
||||
@ -58,6 +58,7 @@ typedef struct orte_odls_child_t {
|
||||
bool alive; /* is this proc alive? */
|
||||
orte_proc_state_t state; /* the state of the process */
|
||||
int exit_code; /* process exit code */
|
||||
unsigned long cpu_set;
|
||||
} orte_odls_child_t;
|
||||
ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_odls_child_t);
|
||||
|
||||
|
@ -246,7 +246,15 @@ int orte_odls_default_get_add_procs_data(orte_gpr_notify_data_t **data,
|
||||
OBJ_RELEASE(value);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[3]),
|
||||
ORTE_PROC_CPU_LIST_KEY,
|
||||
ORTE_STRING, proc->slot_list))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(ndat);
|
||||
OBJ_RELEASE(value);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[4]),
|
||||
ORTE_NODE_NUM_PROCS_KEY,
|
||||
ORTE_STD_CNTR, &node->num_procs))) {
|
||||
@ -270,6 +278,209 @@ int orte_odls_default_get_add_procs_data(orte_gpr_notify_data_t **data,
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function receives a slot string ant translate it to
|
||||
* cpu_set (long bitmap) using the PLPA module.
|
||||
* currently this function is doing nothig because PLPA is not
|
||||
* part of the oprn MPI project.
|
||||
*/
|
||||
|
||||
static int socket_to_cpu_set(char **socket_list, int socket_cnt, orte_odls_child_t *child)
|
||||
{
|
||||
int i, j;
|
||||
char **range;
|
||||
int range_cnt;
|
||||
int lower_range, upper_range, socket_num;
|
||||
|
||||
for (i=0; i < socket_cnt; i++) {
|
||||
if (0 == strcmp("*", socket_list[i])) {
|
||||
/* use PLPA to construct the child->cpu_set */
|
||||
opal_output(orte_odls_globals.output,"rank %d can run on any socket", child->name->vpid);
|
||||
continue;
|
||||
}
|
||||
range = opal_argv_split(socket_list[i], '-');
|
||||
range_cnt = opal_argv_count(range);
|
||||
switch (range_cnt) {
|
||||
case 1:
|
||||
socket_num = atoi(range[0]);
|
||||
/* use PLPA to construct the child->cpu_set */
|
||||
opal_output(orte_odls_globals.output,"rank %d runs on socket #%d", child->name->vpid, socket_num);
|
||||
break;
|
||||
case 2:
|
||||
lower_range = atoi(range[0]);
|
||||
upper_range = atoi(range[1]);
|
||||
for (j=lower_range; j<= upper_range; j++) {
|
||||
socket_num = j;
|
||||
/* use PLPA to construct the child->cpu_set */
|
||||
opal_output(orte_odls_globals.output,"rank %d runs on socket #%d", child->name->vpid, socket_num);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
opal_argv_free(range);
|
||||
ORTE_ERROR_LOG(ORTE_ERROR);
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
opal_argv_free(range);
|
||||
}
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
static int socket_core_to_cpu_set(char **socket_core_list, int socket_core_list_cnt, orte_odls_child_t *child)
|
||||
{
|
||||
int i, j;
|
||||
char **socket_core;
|
||||
int socket_core_cnt;
|
||||
char **range;
|
||||
int range_cnt;
|
||||
int lower_range, upper_range;
|
||||
int socket, core;
|
||||
|
||||
socket_core = opal_argv_split (socket_core_list[0], ':');
|
||||
socket_core_cnt = opal_argv_count(socket_core);
|
||||
|
||||
socket = atoi(socket_core[0]);
|
||||
if (0 == strcmp("*",socket_core[1])) {
|
||||
/* use PLPA to construct the child->cpu_set */
|
||||
opal_output(orte_odls_globals.output,"rank %d runs on socket #%d any core", child->name->vpid, socket);
|
||||
}
|
||||
else {
|
||||
range = opal_argv_split(socket_core[1], '-');
|
||||
range_cnt = opal_argv_count(range);
|
||||
switch (range_cnt) {
|
||||
case 1:
|
||||
core = atoi(range[0]);
|
||||
/* use PLPA to construct the child->cpu_set */
|
||||
opal_output(orte_odls_globals.output,"rank %d runs on socket #%d core #%d", child->name->vpid, socket, core);
|
||||
break;
|
||||
case 2:
|
||||
lower_range = atoi(range[0]);
|
||||
upper_range = atoi(range[1]);
|
||||
for (j=lower_range; j<= upper_range; j++) {
|
||||
core = j;
|
||||
/* use PLPA to construct the child->cpu_set */
|
||||
opal_output(orte_odls_globals.output,"rank %d runs on socket #%d core #%d", child->name->vpid, socket, core);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
opal_argv_free(range);
|
||||
opal_argv_free(socket_core);
|
||||
ORTE_ERROR_LOG(ORTE_ERROR);
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
opal_argv_free(range);
|
||||
opal_argv_free(socket_core);
|
||||
}
|
||||
for (i=1; i < socket_core_list_cnt; i++) {
|
||||
socket_core = opal_argv_split (socket_core_list[i], ':');
|
||||
socket_core_cnt = opal_argv_count(socket_core);
|
||||
switch (socket_core_cnt) {
|
||||
case 1:
|
||||
range = opal_argv_split(socket_core[0], '-');
|
||||
range_cnt = opal_argv_count(range);
|
||||
switch (range_cnt) {
|
||||
case 1:
|
||||
core = atoi(range[0]);
|
||||
/* use PLPA to construct the child->cpu_set */
|
||||
opal_output(orte_odls_globals.output,"and on core #%d", core);
|
||||
break;
|
||||
case 2:
|
||||
lower_range = atoi(range[0]);
|
||||
upper_range = atoi(range[1]);
|
||||
for (j=lower_range; j<= upper_range; j++) {
|
||||
core = j;
|
||||
/* use PLPA to construct the child->cpu_set */
|
||||
opal_output(orte_odls_globals.output,"and on core #%d", core);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
opal_argv_free(range);
|
||||
opal_argv_free(socket_core);
|
||||
ORTE_ERROR_LOG(ORTE_ERROR);
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
opal_argv_free(range);
|
||||
break;
|
||||
case 2:
|
||||
socket = atoi(socket_core[0]);
|
||||
if (0 == strcmp("*",socket_core[1])) {
|
||||
/* use PLPA to construct the child->cpu_set */
|
||||
opal_output(orte_odls_globals.output,"and on socket #%d any core", socket);
|
||||
}
|
||||
else {
|
||||
range = opal_argv_split(socket_core[1], '-');
|
||||
range_cnt = opal_argv_count(range);
|
||||
switch (range_cnt) {
|
||||
case 1:
|
||||
core = atoi(range[0]);
|
||||
/* use PLPA to construct the child->cpu_set */
|
||||
opal_output(orte_odls_globals.output,"and on socket #%d core #%d", socket, core);
|
||||
break;
|
||||
case 2:
|
||||
lower_range = atoi(range[0]);
|
||||
upper_range = atoi(range[1]);
|
||||
for (j=lower_range; j<= upper_range; j++) {
|
||||
core = j;
|
||||
/* use PLPA to construct the child->cpu_set */
|
||||
opal_output(orte_odls_globals.output,"and on socket #%d core #%d", socket, core);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
opal_argv_free(range);
|
||||
opal_argv_free(socket_core);
|
||||
ORTE_ERROR_LOG(ORTE_ERROR);
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
opal_argv_free(range);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
opal_argv_free(socket_core);
|
||||
ORTE_ERROR_LOG(ORTE_ERROR);
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
opal_argv_free(socket_core);
|
||||
}
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
static int slot_list_to_cpu_set(char *slot_str, orte_odls_child_t *child)
|
||||
{
|
||||
char **item;
|
||||
char **socket_core;
|
||||
int item_cnt, socket_core_cnt;
|
||||
int rc;
|
||||
|
||||
item = opal_argv_split (slot_str, ',');
|
||||
item_cnt = opal_argv_count (item);
|
||||
|
||||
socket_core = opal_argv_split (item[0], ':');
|
||||
socket_core_cnt = opal_argv_count(socket_core);
|
||||
opal_argv_free(socket_core);
|
||||
|
||||
switch (socket_core_cnt) {
|
||||
case 1:
|
||||
if (ORTE_SUCCESS != (rc = socket_to_cpu_set(item, item_cnt, child))) {
|
||||
opal_argv_free(item);
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (ORTE_SUCCESS != (rc = socket_core_to_cpu_set(item, item_cnt, child))) {
|
||||
opal_argv_free(item);
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
opal_argv_free(item);
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
opal_argv_free(item);
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
static bool odls_default_child_died(pid_t pid, unsigned int timeout,
|
||||
int *exit_status)
|
||||
{
|
||||
@ -951,7 +1162,7 @@ int orte_odls_default_launch_local_procs(orte_gpr_notify_data_t *data)
|
||||
bool quit_flag;
|
||||
bool node_included;
|
||||
orte_filem_base_request_t *filem_request;
|
||||
char *job_str, *uri_file, *my_uri, *session_dir=NULL;
|
||||
char *job_str, *uri_file, *my_uri, *session_dir=NULL, *slot_str;
|
||||
FILE *fp;
|
||||
|
||||
/* parse the returned data to create the required structures
|
||||
@ -1086,6 +1297,22 @@ int orte_odls_default_launch_local_procs(orte_gpr_notify_data_t *data)
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(kval->key, ORTE_PROC_CPU_LIST_KEY) == 0) {
|
||||
/* copy the name into the child object */
|
||||
if (ORTE_SUCCESS != (rc = orte_dss.copy((void**)&slot_str, kval->value->data, ORTE_STRING))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
if (NULL != slot_str) {
|
||||
if (ORTE_SUCCESS != (rc = slot_list_to_cpu_set(slot_str, child))){
|
||||
ORTE_ERROR_LOG(rc);
|
||||
free(slot_str);
|
||||
return rc;
|
||||
}
|
||||
free(slot_str);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(kval->key, ORTE_PROC_APP_CONTEXT_KEY) == 0) {
|
||||
if (ORTE_SUCCESS != (rc = orte_dss.get((void**)&sptr, kval->value, ORTE_STD_CNTR))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
|
@ -43,3 +43,4 @@ int orte_ras_base_compare_node(orte_ras_node_t *value1, orte_ras_node_t *value2,
|
||||
|
||||
return ORTE_VALUE1_GREATER;
|
||||
}
|
||||
|
||||
|
@ -58,4 +58,3 @@ int orte_ras_base_copy_node(orte_ras_node_t **dest, orte_ras_node_t *src, orte_d
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -124,3 +124,4 @@ int orte_ras_base_pack_node(orte_buffer_t *buffer, const void *src,
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -54,3 +54,4 @@ int orte_ras_base_size_node(size_t *size, orte_ras_node_t *src, orte_data_type_t
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ orte_ras_base_module_t orte_ras_base_proxy_module = {
|
||||
orte_ras_base_node_query,
|
||||
orte_ras_base_node_query_alloc,
|
||||
orte_ras_base_node_lookup,
|
||||
orte_ras_base_proc_query_alloc,
|
||||
orte_ras_base_proxy_deallocate,
|
||||
orte_ras_base_proxy_finalize
|
||||
};
|
||||
|
@ -46,6 +46,11 @@ int orte_ras_base_node_query_alloc_no_op(opal_list_t* list, orte_jobid_t job)
|
||||
return ORTE_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
int orte_ras_base_proc_query_alloc_no_op(opal_list_t* list)
|
||||
{
|
||||
return ORTE_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
orte_ras_node_t* orte_ras_base_node_lookup_no_op(orte_cellid_t cell, const char* nodename)
|
||||
{
|
||||
return NULL;
|
||||
|
@ -67,6 +67,30 @@ OBJ_CLASS_INSTANCE(
|
||||
orte_ras_base_node_construct,
|
||||
orte_ras_base_node_destruct);
|
||||
|
||||
static void orte_ras_base_proc_construct(orte_ras_proc_t* proc)
|
||||
{
|
||||
proc->node_name = NULL;
|
||||
proc->cpu_list = NULL;
|
||||
proc->rank = ORTE_VPID_MAX;
|
||||
}
|
||||
|
||||
static void orte_ras_base_proc_destruct(orte_ras_proc_t* proc)
|
||||
{
|
||||
if (NULL != proc->node_name) {
|
||||
free(proc->node_name);
|
||||
}
|
||||
if (NULL != proc->cpu_list) {
|
||||
free(proc->cpu_list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OBJ_CLASS_INSTANCE(
|
||||
orte_ras_proc_t,
|
||||
opal_list_item_t,
|
||||
orte_ras_base_proc_construct,
|
||||
orte_ras_base_proc_destruct);
|
||||
|
||||
|
||||
/*
|
||||
* Query the registry for all available nodes
|
||||
@ -211,6 +235,80 @@ int orte_ras_base_node_query(opal_list_t* nodes)
|
||||
}
|
||||
|
||||
|
||||
int orte_ras_base_proc_query_alloc(opal_list_t* procs)
|
||||
{
|
||||
char* keys[] = {
|
||||
ORTE_NODE_NAME_KEY,
|
||||
ORTE_PROC_RANK_KEY,
|
||||
ORTE_PROC_CPU_LIST_KEY,
|
||||
NULL
|
||||
};
|
||||
orte_std_cntr_t i, cnt;
|
||||
orte_gpr_value_t** values;
|
||||
orte_std_cntr_t *sptr;
|
||||
int rc;
|
||||
|
||||
/* query selected node entries */
|
||||
rc = orte_gpr.get(
|
||||
ORTE_GPR_KEYS_OR|ORTE_GPR_TOKENS_OR,
|
||||
ORTE_PROC_SEGMENT,
|
||||
NULL,
|
||||
keys,
|
||||
&cnt,
|
||||
&values);
|
||||
if(ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
/* parse the response */
|
||||
for(i=0; i<cnt; i++) {
|
||||
orte_gpr_value_t* value = values[i];
|
||||
orte_ras_proc_t* proc;
|
||||
orte_std_cntr_t k;
|
||||
|
||||
proc = OBJ_NEW(orte_ras_proc_t);
|
||||
|
||||
for(k=0; k < value->cnt; k++) {
|
||||
orte_gpr_keyval_t* keyval = value->keyvals[k];
|
||||
if(strcmp(keyval->key, ORTE_NODE_NAME_KEY) == 0) {
|
||||
/* we use the dss.copy function here instead of strdup because that function
|
||||
* automatically protects us against a NULL (or zero-length) string
|
||||
*/
|
||||
if (ORTE_SUCCESS != (rc = orte_dss.copy((void**)&(proc->node_name), keyval->value->data, ORTE_STRING))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(keyval->key, ORTE_PROC_CPU_LIST_KEY) == 0) {
|
||||
/* we use the dss.copy function here instead of strdup because that function
|
||||
* automatically protects us against a NULL (or zero-length) string
|
||||
*/
|
||||
if (ORTE_SUCCESS != (rc = orte_dss.copy((void**)&(proc->cpu_list), keyval->value->data, ORTE_STRING))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(keyval->key, ORTE_PROC_RANK_KEY) == 0) {
|
||||
if (ORTE_SUCCESS != (rc = orte_dss.get((void**)&sptr, keyval->value, ORTE_STD_CNTR))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
continue;
|
||||
}
|
||||
proc->rank = *sptr;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
opal_list_append(procs, &proc->super);
|
||||
OBJ_RELEASE(value);
|
||||
}
|
||||
|
||||
if (NULL != values) free(values);
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Query the registry for all nodes allocated to a specified job
|
||||
*/
|
||||
@ -691,6 +789,112 @@ cleanup:
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int orte_ras_base_proc_insert(opal_list_t* procs, orte_cellid_t cellid, orte_jobid_t jobid)
|
||||
{
|
||||
opal_list_item_t* item;
|
||||
orte_gpr_value_t **values;
|
||||
orte_process_name_t *proc_name;
|
||||
int rc;
|
||||
orte_std_cntr_t num_values, i, j;
|
||||
char *keys[] = {
|
||||
ORTE_NODE_NAME_KEY,
|
||||
ORTE_PROC_RANK_KEY,
|
||||
ORTE_PROC_CPU_LIST_KEY,
|
||||
|
||||
};
|
||||
orte_data_type_t types[] = {
|
||||
ORTE_STRING,
|
||||
ORTE_STD_CNTR,
|
||||
ORTE_STRING,
|
||||
};
|
||||
orte_ras_proc_t* proc;
|
||||
|
||||
num_values = (orte_std_cntr_t)opal_list_get_size(procs);
|
||||
if (0 >= num_values) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
}
|
||||
|
||||
values = (orte_gpr_value_t**)malloc(num_values * sizeof(orte_gpr_value_t*));
|
||||
if (NULL == values) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
/** preallocate the appropriate number of containers on the segment */
|
||||
rc = orte_gpr.preallocate_segment(ORTE_PROC_SEGMENT, num_values);
|
||||
if(ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
for (i=0; i < num_values; i++) {
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_value(&(values[i]),
|
||||
ORTE_GPR_OVERWRITE | ORTE_GPR_TOKENS_AND,
|
||||
ORTE_PROC_SEGMENT, 3, 0))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
for (j=0; j < i; j++) {
|
||||
OBJ_RELEASE(values[j]);
|
||||
}
|
||||
free(values);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
for(i=0, item = opal_list_get_first(procs);
|
||||
i < num_values && item != opal_list_get_end(procs);
|
||||
i++, item = opal_list_get_next(item)) {
|
||||
proc = (orte_ras_proc_t*)item;
|
||||
|
||||
j = 0;
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(values[i]->keyvals[j]), keys[j], types[j], proc->node_name))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
++j;
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(values[i]->keyvals[j]), keys[j], types[j], &(proc->rank)))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
++j;
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(values[i]->keyvals[j]), keys[j], types[j], proc->cpu_list))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
++j;
|
||||
rc = orte_ns.create_process_name(&proc_name, cellid, jobid, i);
|
||||
if (ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* setup index/keys for this node */
|
||||
rc = orte_schema.get_proc_tokens(&(values[i]->tokens), &(values[i]->num_tokens), proc_name);
|
||||
if (ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
/* try the insert */
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.put(num_values, values))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
for (j=0; j < num_values; j++) {
|
||||
OBJ_RELEASE(values[j]);
|
||||
}
|
||||
if (NULL != values) free(values);
|
||||
return rc;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Delete the specified nodes from the registry
|
||||
*/
|
||||
|
@ -51,6 +51,7 @@ orte_ras_base_module_t orte_ras = {
|
||||
orte_ras_base_node_query,
|
||||
orte_ras_base_node_query_alloc,
|
||||
orte_ras_base_node_lookup,
|
||||
orte_ras_base_proc_query_alloc,
|
||||
orte_ras_base_deallocate,
|
||||
orte_ras_base_finalize
|
||||
};
|
||||
@ -61,6 +62,7 @@ orte_ras_base_module_t orte_ras_no_op = {
|
||||
orte_ras_base_node_query_no_op,
|
||||
orte_ras_base_node_query_alloc_no_op,
|
||||
orte_ras_base_node_lookup_no_op,
|
||||
orte_ras_base_proc_query_alloc_no_op,
|
||||
orte_ras_base_deallocate_no_op,
|
||||
orte_ras_base_finalize
|
||||
};
|
||||
|
@ -69,6 +69,8 @@ int orte_ras_base_deallocate_no_op(orte_jobid_t job);
|
||||
|
||||
int orte_ras_base_node_query_alloc_no_op(opal_list_t*, orte_jobid_t);
|
||||
|
||||
int orte_ras_base_proc_query_alloc_no_op(opal_list_t* procs);
|
||||
|
||||
orte_ras_node_t* orte_ras_base_node_lookup_no_op(orte_cellid_t, const char* nodename);
|
||||
|
||||
/*
|
||||
@ -97,11 +99,15 @@ ORTE_DECLSPEC orte_ras_node_t* orte_ras_base_node_lookup(orte_cellid_t, const ch
|
||||
*/
|
||||
ORTE_DECLSPEC int orte_ras_base_node_query_alloc(opal_list_t*, orte_jobid_t);
|
||||
|
||||
ORTE_DECLSPEC int orte_ras_base_proc_query_alloc(opal_list_t* procs);
|
||||
|
||||
/**
|
||||
* Add the specified node definitions to the registry
|
||||
*/
|
||||
ORTE_DECLSPEC int orte_ras_base_node_insert(opal_list_t*);
|
||||
|
||||
ORTE_DECLSPEC int orte_ras_base_proc_insert(opal_list_t* procs, orte_cellid_t cellid, orte_jobid_t jobid);
|
||||
|
||||
/**
|
||||
* Delete the specified nodes from the registry
|
||||
*/
|
||||
@ -138,8 +144,6 @@ int orte_ras_base_size_node(size_t *size, orte_ras_node_t *src, orte_data_type_t
|
||||
int orte_ras_base_unpack_node(orte_buffer_t *buffer, void *dest,
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type);
|
||||
|
||||
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
@ -285,6 +285,7 @@ orte_ras_base_module_t orte_ras_bjs_module = {
|
||||
orte_ras_base_node_query,
|
||||
orte_ras_base_node_query_alloc,
|
||||
orte_ras_base_node_lookup,
|
||||
orte_ras_base_proc_query_alloc,
|
||||
orte_ras_bjs_deallocate,
|
||||
orte_ras_bjs_finalize
|
||||
};
|
||||
|
@ -49,6 +49,7 @@ orte_ras_base_module_t orte_ras_dash_host_module = {
|
||||
orte_ras_base_node_query,
|
||||
orte_ras_base_node_query_alloc,
|
||||
orte_ras_base_node_lookup,
|
||||
orte_ras_base_proc_query_alloc,
|
||||
orte_ras_dash_host_deallocate,
|
||||
orte_ras_dash_host_finalize
|
||||
};
|
||||
|
@ -63,6 +63,7 @@ orte_ras_base_module_t orte_ras_gridengine_module = {
|
||||
orte_ras_base_node_query,
|
||||
orte_ras_base_node_query_alloc,
|
||||
orte_ras_base_node_lookup,
|
||||
orte_ras_base_proc_query_alloc,
|
||||
orte_ras_gridengine_deallocate,
|
||||
orte_ras_gridengine_finalize
|
||||
};
|
||||
|
@ -71,6 +71,7 @@ orte_ras_base_module_t orte_ras_loadleveler_module = {
|
||||
orte_ras_base_node_query,
|
||||
orte_ras_base_node_query_alloc,
|
||||
orte_ras_base_node_lookup,
|
||||
orte_ras_base_proc_query_alloc,
|
||||
orte_ras_loadleveler_deallocate,
|
||||
orte_ras_loadleveler_finalize
|
||||
};
|
||||
|
@ -50,6 +50,7 @@ orte_ras_base_module_t orte_ras_localhost_module = {
|
||||
orte_ras_base_node_query,
|
||||
orte_ras_base_node_query_alloc,
|
||||
orte_ras_base_node_lookup,
|
||||
orte_ras_base_proc_query_alloc,
|
||||
orte_ras_localhost_deallocate,
|
||||
orte_ras_localhost_finalize
|
||||
};
|
||||
|
@ -202,6 +202,9 @@ typedef int (*orte_ras_base_module_node_insert_fn_t)(opal_list_t *);
|
||||
*/
|
||||
typedef int (*orte_ras_base_module_node_query_fn_t)(opal_list_t *);
|
||||
|
||||
|
||||
typedef int (*orte_ras_base_module_proc_query_fn_t)(opal_list_t*);
|
||||
|
||||
/**
|
||||
* Query the registry for all nodes allocated to a specific job
|
||||
*/
|
||||
@ -226,6 +229,8 @@ struct orte_ras_base_module_1_3_0_t {
|
||||
orte_ras_base_module_node_query_alloc_fn_t node_query_alloc;
|
||||
/* node lookup */
|
||||
orte_ras_base_module_node_lookup_fn_t node_lookup;
|
||||
/** proc Query function pointer */
|
||||
orte_ras_base_module_proc_query_fn_t proc_query;
|
||||
/** Deallocation function pointer */
|
||||
orte_ras_base_module_deallocate_fn_t deallocate_job;
|
||||
/** Finalization function pointer */
|
||||
|
@ -92,6 +92,25 @@ typedef struct orte_ras_node_t orte_ras_node_t;
|
||||
|
||||
ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_ras_node_t);
|
||||
|
||||
struct orte_ras_proc_t{
|
||||
/** Base object */
|
||||
opal_list_item_t super;
|
||||
/** String node name */
|
||||
char *node_name;
|
||||
/* the rank of this proc (default -1) */
|
||||
orte_std_cntr_t rank;
|
||||
/* cpu list as defined (if defined) in the hostfile */
|
||||
char *cpu_list;
|
||||
/* whther or not this process is allocated to a map */
|
||||
};
|
||||
|
||||
typedef struct orte_ras_proc_t orte_ras_proc_t;
|
||||
|
||||
ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_ras_proc_t);
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
@ -57,6 +57,7 @@ orte_ras_base_module_t orte_ras_slurm_module = {
|
||||
orte_ras_base_node_query,
|
||||
orte_ras_base_node_query_alloc,
|
||||
orte_ras_base_node_lookup,
|
||||
orte_ras_base_proc_query_alloc,
|
||||
orte_ras_slurm_deallocate,
|
||||
orte_ras_slurm_finalize
|
||||
};
|
||||
|
@ -60,6 +60,7 @@ orte_ras_base_module_t orte_ras_tm_module = {
|
||||
orte_ras_base_node_query,
|
||||
orte_ras_base_node_query_alloc,
|
||||
orte_ras_base_node_lookup,
|
||||
orte_ras_base_proc_query_alloc,
|
||||
deallocate,
|
||||
finalize
|
||||
};
|
||||
|
@ -56,6 +56,7 @@ orte_ras_base_module_t orte_ras_xgrid_module = {
|
||||
orte_ras_base_node_query,
|
||||
orte_ras_base_node_query_alloc,
|
||||
orte_ras_base_node_lookup,
|
||||
orte_ras_base_proc_query_alloc,
|
||||
deallocate,
|
||||
finalize
|
||||
};
|
||||
|
@ -98,14 +98,36 @@ static int orte_rds_hostfile_parse_int(void)
|
||||
static char * orte_rds_hostfile_parse_string(void)
|
||||
{
|
||||
int rc;
|
||||
if (ORTE_RDS_HOSTFILE_EQUAL != orte_rds_hostfile_lex())
|
||||
if (ORTE_RDS_HOSTFILE_EQUAL != orte_rds_hostfile_lex()){
|
||||
return NULL;
|
||||
}
|
||||
rc = orte_rds_hostfile_lex();
|
||||
if (ORTE_RDS_HOSTFILE_STRING != rc)
|
||||
if (ORTE_RDS_HOSTFILE_STRING != rc){
|
||||
return NULL;
|
||||
}
|
||||
return strdup(orte_rds_hostfile_value.sval);
|
||||
}
|
||||
|
||||
static char * orte_rds_hostfile_parse_string_or_int(void)
|
||||
{
|
||||
int rc;
|
||||
char tmp_str[64];
|
||||
|
||||
if (ORTE_RDS_HOSTFILE_EQUAL != orte_rds_hostfile_lex()){
|
||||
return NULL;
|
||||
}
|
||||
rc = orte_rds_hostfile_lex();
|
||||
switch (rc) {
|
||||
case ORTE_RDS_HOSTFILE_STRING:
|
||||
return strdup(orte_rds_hostfile_value.sval);
|
||||
case ORTE_RDS_HOSTFILE_INT:
|
||||
sprintf(tmp_str,"%d",orte_rds_hostfile_value.ival);
|
||||
return strdup(tmp_str);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static orte_ras_node_t* orte_rds_hostfile_lookup(opal_list_t* nodes, const char* name)
|
||||
{
|
||||
@ -122,25 +144,53 @@ static orte_ras_node_t* orte_rds_hostfile_lookup(opal_list_t* nodes, const char*
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int orte_rds_hostfile_parse_line(int token, opal_list_t* existing, opal_list_t* updates)
|
||||
static int validate_slot_list (char *cpu_list)
|
||||
{
|
||||
int i,list_len = strlen(cpu_list);
|
||||
|
||||
for(i=0; i < list_len; i++){
|
||||
if ('0' <= cpu_list[i] && '9' >= cpu_list[i]) {
|
||||
continue;
|
||||
}
|
||||
else if (':' == cpu_list[i]) {
|
||||
continue;
|
||||
}
|
||||
else if (',' == cpu_list[i]) {
|
||||
continue;
|
||||
}
|
||||
else if ('*' == cpu_list[i]) {
|
||||
continue;
|
||||
}
|
||||
else if ('-' == cpu_list[i]) {
|
||||
continue;
|
||||
}
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
static int orte_rds_hostfile_parse_line(int token, opal_list_t* existing, opal_list_t* updates, opal_list_t* procs)
|
||||
{
|
||||
char buff[64];
|
||||
char *tmp;
|
||||
int rc;
|
||||
orte_ras_node_t* node;
|
||||
orte_ras_proc_t* proc;
|
||||
bool update = false;
|
||||
bool got_count = false;
|
||||
bool got_max = false;
|
||||
char* value;
|
||||
char** argv;
|
||||
char* node_name = NULL;
|
||||
char* username = NULL;
|
||||
int cnt;
|
||||
int number_of_slots = 0;
|
||||
|
||||
if (ORTE_RDS_HOSTFILE_STRING == token ||
|
||||
ORTE_RDS_HOSTFILE_HOSTNAME == token ||
|
||||
ORTE_RDS_HOSTFILE_INT == token ||
|
||||
ORTE_RDS_HOSTFILE_IPV4 == token ||
|
||||
ORTE_RDS_HOSTFILE_IPV6 == token) {
|
||||
char* value;
|
||||
char** argv;
|
||||
char* node_name = NULL;
|
||||
char* username = NULL;
|
||||
int cnt;
|
||||
|
||||
if(ORTE_RDS_HOSTFILE_INT == token) {
|
||||
sprintf(buff,"%d", orte_rds_hostfile_value.ival);
|
||||
@ -256,6 +306,48 @@ static int orte_rds_hostfile_parse_line(int token, opal_list_t* existing, opal_l
|
||||
}
|
||||
break;
|
||||
|
||||
case ORTE_RDS_HOSTFILE_SLOT:
|
||||
tmp = orte_rds_hostfile_parse_string_or_int();
|
||||
proc = OBJ_NEW(orte_ras_proc_t);
|
||||
proc->node_name = strdup(node_name);
|
||||
argv = opal_argv_split (tmp, '@');
|
||||
cnt = opal_argv_count (argv);
|
||||
switch (cnt) {
|
||||
case 1:
|
||||
proc->cpu_list = strdup(argv[0]);
|
||||
if (ORTE_SUCCESS != (rc = validate_slot_list(proc->cpu_list))) {
|
||||
OBJ_RELEASE(proc);
|
||||
OBJ_RELEASE(node);
|
||||
opal_argv_free (argv);
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
||||
orte_rds_hostfile_parse_error(token);
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
proc->rank = strtol(argv[0],(char **)NULL,0);
|
||||
proc->cpu_list = strdup(argv[1]);
|
||||
if (ORTE_SUCCESS != (rc = validate_slot_list(proc->cpu_list))) {
|
||||
OBJ_RELEASE(proc);
|
||||
OBJ_RELEASE(node);
|
||||
opal_argv_free (argv);
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
||||
orte_rds_hostfile_parse_error(token);
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
OBJ_RELEASE(proc);
|
||||
OBJ_RELEASE(node);
|
||||
opal_argv_free (argv);
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
||||
orte_rds_hostfile_parse_error(token);
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
opal_argv_free (argv);
|
||||
opal_list_append(procs, &proc->super);
|
||||
number_of_slots++;
|
||||
break;
|
||||
case ORTE_RDS_HOSTFILE_SLOTS_MAX:
|
||||
rc = orte_rds_hostfile_parse_int();
|
||||
if (rc < 0) {
|
||||
@ -287,6 +379,11 @@ static int orte_rds_hostfile_parse_line(int token, opal_list_t* existing, opal_l
|
||||
OBJ_RELEASE(node);
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
if (number_of_slots > node->node_slots) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
||||
OBJ_RELEASE(node);
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
@ -310,7 +407,7 @@ done:
|
||||
* Parse the specified file into a node list.
|
||||
*/
|
||||
|
||||
static int orte_rds_hostfile_parse(const char *hostfile, opal_list_t* existing, opal_list_t* updates)
|
||||
static int orte_rds_hostfile_parse(const char *hostfile, opal_list_t* existing, opal_list_t* updates, opal_list_t* procs)
|
||||
{
|
||||
int token;
|
||||
int rc = ORTE_SUCCESS;
|
||||
@ -348,7 +445,7 @@ static int orte_rds_hostfile_parse(const char *hostfile, opal_list_t* existing,
|
||||
case ORTE_RDS_HOSTFILE_HOSTNAME:
|
||||
case ORTE_RDS_HOSTFILE_IPV4:
|
||||
case ORTE_RDS_HOSTFILE_IPV6:
|
||||
rc = orte_rds_hostfile_parse_line(token, existing, updates);
|
||||
rc = orte_rds_hostfile_parse_line(token, existing, updates, procs);
|
||||
if (ORTE_SUCCESS != rc) {
|
||||
goto unlock;
|
||||
}
|
||||
@ -380,7 +477,7 @@ unlock:
|
||||
static int orte_rds_hostfile_query(orte_jobid_t job)
|
||||
{
|
||||
opal_list_t existing;
|
||||
opal_list_t updates, rds_updates;
|
||||
opal_list_t updates, rds_updates, procs;
|
||||
opal_list_item_t *item;
|
||||
orte_rds_cell_desc_t *rds_item;
|
||||
orte_rds_cell_attr_t *new_attr;
|
||||
@ -403,6 +500,7 @@ static int orte_rds_hostfile_query(orte_jobid_t job)
|
||||
OBJ_CONSTRUCT(&existing, opal_list_t);
|
||||
OBJ_CONSTRUCT(&updates, opal_list_t);
|
||||
OBJ_CONSTRUCT(&rds_updates, opal_list_t);
|
||||
OBJ_CONSTRUCT(&procs, opal_list_t);
|
||||
rc = orte_ras_base_node_query(&existing);
|
||||
if(ORTE_SUCCESS != rc) {
|
||||
goto cleanup;
|
||||
@ -411,7 +509,7 @@ static int orte_rds_hostfile_query(orte_jobid_t job)
|
||||
rc = mca_base_param_find("rds", "hostfile", "path");
|
||||
mca_base_param_lookup_string(rc, &mca_rds_hostfile_component.path);
|
||||
|
||||
rc = orte_rds_hostfile_parse(mca_rds_hostfile_component.path, &existing, &updates);
|
||||
rc = orte_rds_hostfile_parse(mca_rds_hostfile_component.path, &existing, &updates, &procs);
|
||||
if (ORTE_ERR_NOT_FOUND == rc) {
|
||||
if(mca_rds_hostfile_component.default_hostfile) {
|
||||
rc = ORTE_SUCCESS;
|
||||
@ -519,6 +617,12 @@ static int orte_rds_hostfile_query(orte_jobid_t job)
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
if ( !opal_list_is_empty(&procs) ) {
|
||||
rc = orte_ras_base_proc_insert(&procs, local_cellid, job);
|
||||
if (ORTE_SUCCESS != rc) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (NULL != mca_rds_hostfile_component.path) {
|
||||
@ -533,6 +637,9 @@ cleanup:
|
||||
while(NULL != (item = opal_list_remove_first(&updates))) {
|
||||
OBJ_RELEASE(item);
|
||||
}
|
||||
while(NULL != (item = opal_list_remove_first(&procs))) {
|
||||
OBJ_RELEASE(item);
|
||||
}
|
||||
|
||||
while (NULL != (rds_item = (orte_rds_cell_desc_t*)opal_list_remove_first(&rds_updates))) {
|
||||
while (NULL != (new_attr = (orte_rds_cell_attr_t*)opal_list_remove_first(&(rds_item->attributes)))) {
|
||||
@ -543,6 +650,7 @@ cleanup:
|
||||
|
||||
OBJ_DESTRUCT(&existing);
|
||||
OBJ_DESTRUCT(&updates);
|
||||
OBJ_DESTRUCT(&procs);
|
||||
OBJ_DESTRUCT(&rds_updates);
|
||||
|
||||
return rc;
|
||||
|
@ -70,5 +70,6 @@ extern orte_rds_value_t orte_rds_hostfile_value;
|
||||
#define ORTE_RDS_HOSTFILE_HOSTNAME 12
|
||||
#define ORTE_RDS_HOSTFILE_NEWLINE 13
|
||||
#define ORTE_RDS_HOSTFILE_IPV6 14
|
||||
#define ORTE_RDS_HOSTFILE_SLOT 15
|
||||
|
||||
#endif
|
||||
|
@ -88,7 +88,8 @@ count { orte_rds_hostfile_value.sval = yytext;
|
||||
return ORTE_RDS_HOSTFILE_COUNT; }
|
||||
slots { orte_rds_hostfile_value.sval = yytext;
|
||||
return ORTE_RDS_HOSTFILE_SLOTS; }
|
||||
|
||||
slot { orte_rds_hostfile_value.sval = yytext;
|
||||
return ORTE_RDS_HOSTFILE_SLOT; }
|
||||
"slots-max" { orte_rds_hostfile_value.sval = yytext;
|
||||
return ORTE_RDS_HOSTFILE_SLOTS_MAX; }
|
||||
slots_max { orte_rds_hostfile_value.sval = yytext;
|
||||
@ -129,7 +130,7 @@ username { orte_rds_hostfile_value.sval = yytext;
|
||||
*/
|
||||
%}
|
||||
|
||||
[A-za-z0-9_\-]* { orte_rds_hostfile_value.sval = yytext;
|
||||
[A-za-z0-9_\-,:*@]* { orte_rds_hostfile_value.sval = yytext;
|
||||
return ORTE_RDS_HOSTFILE_STRING; }
|
||||
|
||||
([A-Za-z0-9][A-Za-z0-9_\-]*"@")?([0-9]{1,3}"."){3}[0-9]{1,3} {
|
||||
|
@ -117,10 +117,14 @@ int orte_rmaps_base_copy_mapped_proc(orte_mapped_proc_t **dest, orte_mapped_proc
|
||||
|
||||
(*dest)->rank = src->rank;
|
||||
(*dest)->local_rank = src->local_rank;
|
||||
(*dest)->maped_rank = src->maped_rank;
|
||||
|
||||
(*dest)->app_idx = src->app_idx;
|
||||
|
||||
(*dest)->pid = src->pid;
|
||||
if (NULL != src->slot_list) {
|
||||
(*dest)->slot_list = strdup(src->slot_list);
|
||||
}
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
@ -146,6 +146,12 @@ int orte_rmaps_base_pack_mapped_proc(orte_buffer_t *buffer, const void *src,
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* pack the rank */
|
||||
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer, &(procs[i]->maped_rank), 1, ORTE_INT32))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* pack the local rank */
|
||||
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer, &(procs[i]->local_rank), 1, ORTE_VPID))) {
|
||||
@ -164,6 +170,12 @@ int orte_rmaps_base_pack_mapped_proc(orte_buffer_t *buffer, const void *src,
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* pack the slot_list */
|
||||
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer, &(procs[i]->slot_list), 1, ORTE_STRING))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
|
@ -129,8 +129,13 @@ int orte_rmaps_base_print_mapped_proc(char **output, char *prefix, orte_mapped_p
|
||||
free(tmp3);
|
||||
return rc;
|
||||
}
|
||||
asprintf(&tmp, "%s\n%s\n%sProc Rank: %ld\tLocal Rank: %ld\tProc PID: %ld\tApp_context index: %ld\n", tmp3, tmp2, pfx,
|
||||
(long)src->rank, (long)src->local_rank, (long)src->pid, (long)src->app_idx);
|
||||
if(src->maped_rank){
|
||||
asprintf(&tmp, "%s\n%s\n%sProc Rank: %ld(Maped)\tLocal Rank: %ld\tProc PID: %ld\tApp_context index: %ld slot list: %s\n", tmp3, tmp2, pfx,
|
||||
(long)src->rank, (long)src->local_rank, (long)src->pid, (long)src->app_idx, src->slot_list);
|
||||
}else{
|
||||
asprintf(&tmp, "%s\n%s\n%sProc Rank: %ld\tLocal Rank: %ld\tProc PID: %ld\tApp_context index: %ld slot list: %s\n", tmp3, tmp2, pfx,
|
||||
(long)src->rank, (long)src->local_rank, (long)src->pid, (long)src->app_idx, src->slot_list);
|
||||
}
|
||||
free(tmp2);
|
||||
free(tmp3);
|
||||
|
||||
|
@ -50,6 +50,8 @@ int orte_rmaps_base_size_mapped_proc(size_t *size, orte_mapped_proc_t *src, orte
|
||||
{
|
||||
/* account for the object itself */
|
||||
*size = sizeof(orte_mapped_proc_t);
|
||||
|
||||
*size += strlen(src->slot_list);
|
||||
|
||||
/* if src is NULL, then that's all we wanted */
|
||||
if (NULL == src) return ORTE_SUCCESS;
|
||||
|
@ -179,6 +179,14 @@ int orte_rmaps_base_unpack_mapped_proc(orte_buffer_t *buffer, void *dest,
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* unpack the rank */
|
||||
n = 1;
|
||||
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer,
|
||||
&(procs[i]->maped_rank), &n, ORTE_INT32))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* unpack the local rank */
|
||||
n = 1;
|
||||
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer,
|
||||
@ -202,6 +210,14 @@ int orte_rmaps_base_unpack_mapped_proc(orte_buffer_t *buffer, void *dest,
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* unpack the slot_list */
|
||||
n = 1;
|
||||
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer,
|
||||
&(procs[i]->slot_list), &n, ORTE_STRING))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
|
@ -61,6 +61,7 @@ int orte_rmaps_base_get_job_map(orte_job_map_t **map, orte_jobid_t jobid)
|
||||
int rc;
|
||||
char* keys[] = {
|
||||
ORTE_PROC_RANK_KEY,
|
||||
ORTE_PROC_MAPED_RANK_KEY,
|
||||
ORTE_PROC_NAME_KEY,
|
||||
ORTE_PROC_APP_CONTEXT_KEY,
|
||||
ORTE_PROC_LOCAL_PID_KEY,
|
||||
@ -74,6 +75,7 @@ int orte_rmaps_base_get_job_map(orte_job_map_t **map, orte_jobid_t jobid)
|
||||
ORTE_JOB_MAPPING_MODE_KEY,
|
||||
ORTE_JOB_NUM_NEW_DAEMONS_KEY,
|
||||
ORTE_JOB_DAEMON_VPID_START_KEY,
|
||||
ORTE_PROC_CPU_LIST_KEY,
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
ORTE_PROC_CKPT_STATE_KEY,
|
||||
ORTE_PROC_CKPT_SNAPSHOT_REF_KEY,
|
||||
@ -203,6 +205,14 @@ int orte_rmaps_base_get_job_map(orte_job_map_t **map, orte_jobid_t jobid)
|
||||
proc->rank = *vptr;
|
||||
continue;
|
||||
}
|
||||
if(strcmp(keyval->key, ORTE_PROC_MAPED_RANK_KEY) == 0) {
|
||||
if (ORTE_SUCCESS != (rc = orte_dss.get((void**)&vptr, keyval->value, ORTE_INT32))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
proc->maped_rank = *vptr;
|
||||
continue;
|
||||
}
|
||||
if(strcmp(keyval->key, ORTE_PROC_NAME_KEY) == 0) {
|
||||
if (ORTE_SUCCESS != (rc = orte_dss.get((void**)&pptr, keyval->value, ORTE_NAME))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
@ -267,6 +277,13 @@ int orte_rmaps_base_get_job_map(orte_job_map_t **map, orte_jobid_t jobid)
|
||||
oversub = *bptr;
|
||||
continue;
|
||||
}
|
||||
if(strcmp(keyval->key, ORTE_PROC_CPU_LIST_KEY) == 0) {
|
||||
if (ORTE_SUCCESS != (rc = orte_dss.copy((void**)&(proc->slot_list), keyval->value->data, ORTE_STRING))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
/*
|
||||
* Three checkpoint tokens
|
||||
@ -443,7 +460,7 @@ int orte_rmaps_base_get_node_map(orte_mapped_node_t **node, orte_cellid_t cell,
|
||||
|
||||
int orte_rmaps_base_put_job_map(orte_job_map_t *map)
|
||||
{
|
||||
orte_std_cntr_t i;
|
||||
orte_std_cntr_t i,j;
|
||||
orte_std_cntr_t index;
|
||||
orte_std_cntr_t num_procs = 0, num_vals;
|
||||
int rc = ORTE_SUCCESS;
|
||||
@ -533,9 +550,9 @@ int orte_rmaps_base_put_job_map(orte_job_map_t *map)
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_value(&(values[i]),
|
||||
ORTE_GPR_OVERWRITE|ORTE_GPR_TOKENS_AND,
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
segment, 14,
|
||||
segment, 16,
|
||||
#else
|
||||
segment, 11,
|
||||
segment, 13,
|
||||
#endif
|
||||
0))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
@ -550,9 +567,9 @@ int orte_rmaps_base_put_job_map(orte_job_map_t *map)
|
||||
item = opal_list_get_next(item)) {
|
||||
node = (orte_mapped_node_t*)item;
|
||||
|
||||
for (item2 = opal_list_get_first(&node->procs);
|
||||
for (item2 = opal_list_get_first(&node->procs),j=0;
|
||||
item2 != opal_list_get_end(&node->procs);
|
||||
item2 = opal_list_get_next(item2)) {
|
||||
item2 = opal_list_get_next(item2),j++) {
|
||||
proc = (orte_mapped_proc_t*)item2;
|
||||
|
||||
value = values[index++];
|
||||
@ -608,7 +625,16 @@ int orte_rmaps_base_put_job_map(orte_job_map_t *map)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[10]), ORTE_NODE_NUM_PROCS_KEY, ORTE_STD_CNTR, &(node->num_procs)))) {
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[10]), ORTE_PROC_MAPED_RANK_KEY, ORTE_INT32, &(proc->maped_rank)))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[11]), ORTE_NODE_NUM_PROCS_KEY, ORTE_STD_CNTR, &(node->num_procs)))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[12]), ORTE_PROC_CPU_LIST_KEY, ORTE_STRING, proc->slot_list))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
@ -622,21 +648,21 @@ int orte_rmaps_base_put_job_map(orte_job_map_t *map)
|
||||
if( NULL == proc->ckpt_snapshot_loc)
|
||||
proc->ckpt_snapshot_loc = strdup("");
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[11]),
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[13]),
|
||||
ORTE_PROC_CKPT_STATE_KEY, ORTE_SIZE,
|
||||
&(proc->ckpt_state)))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[12]),
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[14]),
|
||||
ORTE_PROC_CKPT_SNAPSHOT_REF_KEY, ORTE_STRING,
|
||||
proc->ckpt_snapshot_ref))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[13]),
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[15]),
|
||||
ORTE_PROC_CKPT_SNAPSHOT_LOC_KEY, ORTE_STRING,
|
||||
proc->ckpt_snapshot_loc))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
|
@ -176,6 +176,33 @@ int orte_rmaps_base_get_target_nodes(opal_list_t *allocated_nodes, orte_jobid_t
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Query the registry for all nodes allocated to a specified job
|
||||
*/
|
||||
|
||||
static int compare(opal_list_item_t **a, opal_list_item_t **b)
|
||||
{
|
||||
orte_ras_proc_t *aa = *((orte_ras_proc_t **) a);
|
||||
orte_ras_proc_t *bb = *((orte_ras_proc_t **) b);
|
||||
|
||||
return (aa->rank - bb->rank);
|
||||
}
|
||||
|
||||
int orte_rmaps_base_get_target_procs(opal_list_t *procs)
|
||||
{
|
||||
int rc;
|
||||
|
||||
/* get the allocation for this job */
|
||||
if(ORTE_SUCCESS != (rc = orte_ras.proc_query(procs))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
opal_list_sort(procs, compare);
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Create a sub-list of nodes to be used for user-specified mappings
|
||||
*/
|
||||
@ -448,6 +475,99 @@ cleanup:
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static int orte_find_unallocated_proc_in_map(orte_ras_proc_t *proc, orte_job_map_t *map, orte_mapped_proc_t **mproc)
|
||||
{
|
||||
orte_mapped_node_t *mnode;
|
||||
opal_list_item_t *item, *item2;
|
||||
int i;
|
||||
|
||||
for (item = opal_list_get_first(&map->nodes);
|
||||
item != opal_list_get_end(&map->nodes);
|
||||
item = opal_list_get_next(item)) {
|
||||
mnode = (orte_mapped_node_t*)item;
|
||||
if (strcmp(proc->node_name, mnode->nodename)) {
|
||||
continue;
|
||||
}
|
||||
for (item2 = opal_list_get_first(&mnode->procs),i=1;
|
||||
item2 != opal_list_get_end(&mnode->procs);
|
||||
item2 = opal_list_get_next(item2),i++) {
|
||||
*mproc = (orte_mapped_proc_t*)item2;
|
||||
if (NULL == (*mproc)->slot_list) {
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
|
||||
int orte_rmaps_base_rearrange_map(orte_app_context_t *app, orte_job_map_t *map, opal_list_t *procs)
|
||||
{
|
||||
opal_list_item_t *proc_item, *map_node_item, *map_proc_item;
|
||||
orte_mapped_node_t *mnode;
|
||||
bool *used_ranks; /* an array for string used ranks */
|
||||
orte_std_cntr_t used_rank_index;
|
||||
orte_std_cntr_t assigned_procs = 0;
|
||||
orte_ras_proc_t *proc;
|
||||
orte_mapped_proc_t *mproc;
|
||||
int rc;
|
||||
|
||||
used_ranks = (bool *)calloc(map->vpid_range, sizeof(bool));
|
||||
|
||||
for (proc_item = opal_list_get_first(procs);
|
||||
proc_item != opal_list_get_end(procs) && assigned_procs < app->num_procs;
|
||||
proc_item = opal_list_get_next(proc_item)) {
|
||||
proc = (orte_ras_proc_t *)proc_item;
|
||||
if (proc->rank != ORTE_VPID_MAX) {
|
||||
/* Check if this proc belong to this map */
|
||||
if (proc->rank >= map->vpid_start && proc->rank < (map->vpid_start + map->vpid_range)) {
|
||||
if (ORTE_SUCCESS != (rc = orte_find_unallocated_proc_in_map(proc, map, &mproc))){
|
||||
free (used_ranks);
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
mproc->slot_list = strdup(proc->cpu_list);
|
||||
mproc->rank = proc->rank;
|
||||
mproc->name.vpid = proc->rank;
|
||||
mproc->maped_rank = true;
|
||||
used_rank_index = proc->rank - map->vpid_start;
|
||||
used_ranks[used_rank_index] = true;
|
||||
assigned_procs ++;
|
||||
}
|
||||
}else if (NULL != proc->cpu_list) {
|
||||
if (ORTE_SUCCESS != (rc = orte_find_unallocated_proc_in_map(proc, map, &mproc))){
|
||||
continue; /* since there is not a specifiv rank continue searching */
|
||||
}
|
||||
mproc->slot_list = strdup(proc->cpu_list);
|
||||
assigned_procs ++;
|
||||
}
|
||||
}
|
||||
if(assigned_procs > 0) {
|
||||
used_rank_index = 0;
|
||||
for (map_node_item = opal_list_get_first(&map->nodes);
|
||||
map_node_item != opal_list_get_end(&map->nodes);
|
||||
map_node_item = opal_list_get_next(map_node_item)) {
|
||||
mnode = (orte_mapped_node_t*)map_node_item;
|
||||
for (map_proc_item = opal_list_get_first(&mnode->procs);
|
||||
map_proc_item != opal_list_get_end(&mnode->procs);
|
||||
map_proc_item = opal_list_get_next(map_proc_item)) {
|
||||
mproc = (orte_mapped_proc_t*)map_proc_item;
|
||||
if (mproc->maped_rank) {
|
||||
continue;
|
||||
}
|
||||
while (used_ranks[used_rank_index]){
|
||||
used_rank_index++;
|
||||
}
|
||||
mproc->rank = map->vpid_start + used_rank_index;
|
||||
mproc->name.vpid = mproc->rank;
|
||||
used_rank_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
free (used_ranks);
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
int orte_rmaps_base_compute_usage(orte_job_map_t *map, orte_std_cntr_t num_procs)
|
||||
{
|
||||
opal_list_item_t *item, *item2;
|
||||
|
@ -54,9 +54,11 @@ static void orte_rmaps_mapped_proc_construct(orte_mapped_proc_t* proc)
|
||||
proc->name.jobid = ORTE_JOBID_INVALID;
|
||||
proc->name.vpid = ORTE_VPID_INVALID;
|
||||
proc->rank = ORTE_VPID_INVALID;
|
||||
proc->maped_rank = false;
|
||||
proc->local_rank = ORTE_VPID_INVALID;
|
||||
proc->app_idx = -1;
|
||||
proc->pid = 0;
|
||||
proc->slot_list = NULL;
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
proc->ckpt_state = ORTE_SNAPC_CKPT_STATE_NONE;
|
||||
proc->ckpt_snapshot_ref = NULL;
|
||||
@ -73,6 +75,10 @@ static void orte_rmaps_mapped_proc_destruct(orte_mapped_proc_t* proc)
|
||||
proc->local_rank = ORTE_VPID_INVALID;
|
||||
proc->app_idx = -1;
|
||||
proc->pid = 0;
|
||||
if(NULL != proc->slot_list){
|
||||
free(proc->slot_list);
|
||||
proc->slot_list = NULL;
|
||||
}
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
proc->ckpt_state = ORTE_SNAPC_CKPT_STATE_NONE;
|
||||
if( NULL != proc->ckpt_snapshot_ref) {
|
||||
|
@ -163,6 +163,8 @@ int orte_rmaps_base_add_proc_to_map(orte_job_map_t *map, orte_cellid_t cell, cha
|
||||
|
||||
ORTE_DECLSPEC int orte_rmaps_base_get_target_nodes(opal_list_t* node_list, orte_jobid_t jobid,
|
||||
orte_std_cntr_t *total_num_slots, bool no_use_local);
|
||||
ORTE_DECLSPEC int orte_rmaps_base_get_target_procs(opal_list_t *procs);
|
||||
|
||||
ORTE_DECLSPEC int orte_rmaps_base_update_node_usage(opal_list_t *nodes);
|
||||
ORTE_DECLSPEC int orte_rmaps_base_get_mapped_targets(opal_list_t *mapped_node_list,
|
||||
orte_app_context_t *app,
|
||||
@ -181,6 +183,8 @@ ORTE_DECLSPEC int orte_rmaps_base_proxy_map_job(orte_jobid_t job, opal_list_t *a
|
||||
|
||||
ORTE_DECLSPEC int orte_rmaps_base_compute_usage(orte_job_map_t *map, orte_std_cntr_t num_procs);
|
||||
|
||||
ORTE_DECLSPEC int orte_rmaps_base_rearrange_map(orte_app_context_t *app, orte_job_map_t *map, opal_list_t *procs);
|
||||
|
||||
ORTE_DECLSPEC int orte_rmaps_base_define_daemons(orte_job_map_t *map);
|
||||
|
||||
/** Local data type functions */
|
||||
|
@ -53,9 +53,11 @@ struct orte_mapped_proc_t {
|
||||
opal_list_item_t super;
|
||||
orte_process_name_t name; /* process name */
|
||||
orte_vpid_t rank; /* process rank */
|
||||
bool maped_rank; /* Wether or not this rank is maped according to hostfile */
|
||||
orte_vpid_t local_rank; /* local rank on the node */
|
||||
orte_std_cntr_t app_idx; /* index of app_context for this process */
|
||||
pid_t pid;
|
||||
char *slot_list;
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
size_t ckpt_state;
|
||||
char * ckpt_snapshot_ref;
|
||||
|
@ -54,6 +54,57 @@ static opal_list_t fully_used_nodes;
|
||||
static orte_std_cntr_t num_per_node;
|
||||
|
||||
|
||||
|
||||
|
||||
static int map_app_by_allocated_ranks(
|
||||
orte_app_context_t* app,
|
||||
orte_job_map_t* map,
|
||||
orte_jobid_t jobid,
|
||||
orte_vpid_t vpid_start,
|
||||
opal_list_t* nodes,
|
||||
opal_list_t* max_used_nodes,
|
||||
opal_list_t* procs,
|
||||
orte_std_cntr_t *num_alloc)
|
||||
{
|
||||
int rc = ORTE_SUCCESS;
|
||||
orte_ras_proc_t *proc;
|
||||
opal_list_item_t *proc_item, *node_item;
|
||||
orte_ras_node_t *node;
|
||||
|
||||
|
||||
for (proc_item = opal_list_get_first(procs);
|
||||
proc_item != opal_list_get_end(procs);
|
||||
proc_item = opal_list_get_next(proc_item)) {
|
||||
proc = (orte_ras_proc_t *)proc_item;
|
||||
if(proc->rank >= vpid_start && proc->rank < (vpid_start + app->num_procs)){
|
||||
for (node_item = opal_list_get_first(nodes);
|
||||
node_item != opal_list_get_end(nodes);
|
||||
node_item = opal_list_get_next(node_item)) {
|
||||
node = (orte_ras_node_t *)node_item;
|
||||
if(0 == strcmp(node->node_name, proc->node_name)){
|
||||
if (ORTE_SUCCESS != (rc = orte_rmaps_base_claim_slot(map, node, jobid, proc->rank, app->idx,
|
||||
nodes, max_used_nodes, false))) {
|
||||
/** if the code is ORTE_ERR_NODE_FULLY_USED, then we know this
|
||||
* really isn't an error - we just need to break from the loop
|
||||
* since the node is fully used up. For now, just don't report
|
||||
* an error
|
||||
*/
|
||||
if (ORTE_ERR_NODE_FULLY_USED != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
(*num_alloc)++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Create a default mapping for the application, scheduling round
|
||||
* robin by node.
|
||||
@ -64,10 +115,10 @@ static int map_app_by_node(
|
||||
orte_jobid_t jobid,
|
||||
orte_vpid_t vpid_start,
|
||||
opal_list_t* nodes,
|
||||
opal_list_t* max_used_nodes)
|
||||
opal_list_t* max_used_nodes,
|
||||
orte_std_cntr_t num_alloc)
|
||||
{
|
||||
int rc = ORTE_SUCCESS;
|
||||
orte_std_cntr_t num_alloc = 0;
|
||||
opal_list_item_t *next;
|
||||
orte_ras_node_t *node;
|
||||
|
||||
@ -148,11 +199,11 @@ static int map_app_by_slot(
|
||||
orte_jobid_t jobid,
|
||||
orte_vpid_t vpid_start,
|
||||
opal_list_t* nodes,
|
||||
opal_list_t* max_used_nodes)
|
||||
opal_list_t* max_used_nodes,
|
||||
orte_std_cntr_t num_alloc)
|
||||
{
|
||||
int rc = ORTE_SUCCESS;
|
||||
orte_std_cntr_t i, num_slots_to_take;
|
||||
orte_std_cntr_t num_alloc = 0;
|
||||
orte_ras_node_t *node;
|
||||
opal_list_item_t *next;
|
||||
|
||||
@ -165,7 +216,6 @@ static int map_app_by_slot(
|
||||
have reached their soft limit and the user directed us to "no oversubscribe".
|
||||
If we still have processes that haven't been mapped yet, then it's an
|
||||
"out of resources" error. */
|
||||
num_alloc = 0;
|
||||
|
||||
while ( num_alloc < app->num_procs) {
|
||||
|
||||
@ -354,7 +404,7 @@ static int orte_rmaps_rr_map(orte_jobid_t jobid, opal_list_t *attributes)
|
||||
orte_app_context_t *app;
|
||||
orte_job_map_t* map;
|
||||
orte_std_cntr_t i;
|
||||
opal_list_t master_node_list, mapped_node_list, max_used_nodes, *working_node_list;
|
||||
opal_list_t master_node_list, mapped_node_list, max_used_nodes, *working_node_list ,procs;
|
||||
opal_list_item_t *item, *item2;
|
||||
orte_ras_node_t *node, *node2;
|
||||
char *save_bookmark;
|
||||
@ -365,6 +415,7 @@ static int orte_rmaps_rr_map(orte_jobid_t jobid, opal_list_t *attributes)
|
||||
char *sptr;
|
||||
orte_attribute_t *attr;
|
||||
orte_std_cntr_t slots_per_node;
|
||||
orte_std_cntr_t num_alloc = 0;
|
||||
|
||||
OPAL_TRACE(1);
|
||||
|
||||
@ -395,6 +446,7 @@ static int orte_rmaps_rr_map(orte_jobid_t jobid, opal_list_t *attributes)
|
||||
* mappings from the user
|
||||
*/
|
||||
OBJ_CONSTRUCT(&master_node_list, opal_list_t);
|
||||
OBJ_CONSTRUCT(&procs, opal_list_t);
|
||||
if(ORTE_SUCCESS != (rc = orte_rmaps_base_get_target_nodes(&master_node_list, jobid,
|
||||
&total_num_slots,
|
||||
mca_rmaps_round_robin_component.no_use_local))) {
|
||||
@ -453,7 +505,11 @@ static int orte_rmaps_rr_map(orte_jobid_t jobid, opal_list_t *attributes)
|
||||
|
||||
/** construct a list to hold any nodes involved in a user-specified mapping */
|
||||
OBJ_CONSTRUCT(&mapped_node_list, opal_list_t);
|
||||
|
||||
|
||||
if(ORTE_SUCCESS != (rc = orte_rmaps_base_get_target_procs(&procs))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
for(i=0; i < map->num_apps; i++) {
|
||||
app = map->apps[i];
|
||||
|
||||
@ -569,13 +625,19 @@ static int orte_rmaps_rr_map(orte_jobid_t jobid, opal_list_t *attributes)
|
||||
/** track the total number of processes we mapped */
|
||||
num_procs += app->num_procs;
|
||||
|
||||
if(!opal_list_is_empty(&procs)){
|
||||
if (ORTE_SUCCESS != (rc = map_app_by_allocated_ranks(app, map, jobid, vpid_start, working_node_list, &max_used_nodes, &procs, &num_alloc))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
/* Make assignments */
|
||||
if (mca_rmaps_round_robin_component.bynode) {
|
||||
map->mapping_mode = strdup("bynode");
|
||||
rc = map_app_by_node(app, map, jobid, vpid_start, working_node_list, &max_used_nodes);
|
||||
rc = map_app_by_node(app, map, jobid, vpid_start, working_node_list, &max_used_nodes, num_alloc);
|
||||
} else {
|
||||
map->mapping_mode = strdup("byslot");
|
||||
rc = map_app_by_slot(app, map, jobid, vpid_start, working_node_list, &max_used_nodes);
|
||||
rc = map_app_by_slot(app, map, jobid, vpid_start, working_node_list, &max_used_nodes, num_alloc);
|
||||
}
|
||||
|
||||
|
||||
@ -707,7 +769,12 @@ static int orte_rmaps_rr_map(orte_jobid_t jobid, opal_list_t *attributes)
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if(!opal_list_is_empty(&procs)){
|
||||
if(ORTE_SUCCESS != (rc = orte_rmaps_base_rearrange_map(app, map, &procs))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
/* define the daemons that we will use for this job */
|
||||
if (ORTE_SUCCESS != (rc = orte_rmaps_base_define_daemons(map))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
@ -760,6 +827,7 @@ cleanup:
|
||||
OBJ_DESTRUCT(&max_used_nodes);
|
||||
OBJ_DESTRUCT(&fully_used_nodes);
|
||||
OBJ_DESTRUCT(&mapped_node_list);
|
||||
OBJ_DESTRUCT(&procs);
|
||||
OBJ_RELEASE(map);
|
||||
|
||||
|
||||
|
@ -46,6 +46,7 @@
|
||||
*/
|
||||
#define ORTE_JOB_SEGMENT "orte-job"
|
||||
#define ORTE_NODE_SEGMENT "orte-node"
|
||||
#define ORTE_PROC_SEGMENT "orte-proc"
|
||||
#define ORTE_JOBINFO_SEGMENT "orte-active-jobs"
|
||||
#define ORTE_RESOURCE_SEGMENT "orte-resources"
|
||||
|
||||
@ -96,6 +97,7 @@
|
||||
/* PROCESS specific keys */
|
||||
#define ORTE_PROC_NAME_KEY "orte-proc-name"
|
||||
#define ORTE_PROC_RANK_KEY "orte-proc-rank"
|
||||
#define ORTE_PROC_MAPED_RANK_KEY "orte-proc-maped-rank"
|
||||
#define ORTE_PROC_LOCAL_RANK_KEY "orte-proc-local-rank"
|
||||
#define ORTE_PROC_PID_KEY "orte-proc-pid"
|
||||
#define ORTE_PROC_LOCAL_PID_KEY "orte-proc-local-pid"
|
||||
@ -115,6 +117,7 @@
|
||||
#define ORTE_PROC_NUM_FINALIZED "orte-proc-num-finalized"
|
||||
#define ORTE_PROC_NUM_TERMINATED "orte-proc-num-terminated"
|
||||
#define ORTE_PROC_RML_IP_ADDRESS_KEY "orte-proc-rml-ip-addr"
|
||||
#define ORTE_PROC_CPU_LIST_KEY "orte-proc-cpu-list"
|
||||
|
||||
#define ORTE_JOB_CKPT_STATE_KEY "orte-job-ckpt-state"
|
||||
#define ORTE_JOB_CKPT_SNAPSHOT_REF_KEY "orte-job-ckpt-snapshot-ref"
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user