int orte_sds_slurm_set_name(void) { int rc; int id; int vpid_start; int num_procs; char* name_string = NULL; int slurm_nodeid; /* start by getting our cellid, jobid, and vpid (which is the starting vpid for the list of daemons) */ id = mca_base_param_register_string("ns", "nds", "name", NULL, NULL); mca_base_param_lookup_string(id, &name_string); if(name_string != NULL) { if (ORTE_SUCCESS != (rc = orte_ns.convert_string_to_process_name(&(orte_process_info.my_name), name_string))) { ORTE_ERROR_LOG(rc); free(name_string); return rc; } free(name_string); } else { orte_cellid_t cellid; orte_jobid_t jobid; orte_vpid_t vpid; char* cellid_string; char* jobid_string; char* vpid_string; id = mca_base_param_register_string("ns", "nds", "cellid", NULL, NULL); mca_base_param_lookup_string(id, &cellid_string); if (NULL == cellid_string) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return ORTE_ERR_NOT_FOUND; } if (ORTE_SUCCESS != (rc = orte_ns.convert_string_to_cellid(&cellid, cellid_string))) { ORTE_ERROR_LOG(rc); return(rc); } id = mca_base_param_register_string("ns", "nds", "jobid", NULL, NULL); mca_base_param_lookup_string(id, &jobid_string); if (NULL == jobid_string) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return ORTE_ERR_NOT_FOUND; } if (ORTE_SUCCESS != (rc = orte_ns.convert_string_to_jobid(&jobid, jobid_string))) { ORTE_ERROR_LOG(rc); return(rc); } id = mca_base_param_register_string("ns", "nds", "vpid", NULL, NULL); mca_base_param_lookup_string(id, &vpid_string); if (NULL == vpid_string) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return ORTE_ERR_NOT_FOUND; } if (ORTE_SUCCESS != (rc = orte_ns.convert_string_to_vpid(&vpid, vpid_string))) { ORTE_ERROR_LOG(rc); return(rc); } if (ORTE_SUCCESS != (rc = orte_ns.create_process_name(&(orte_process_info.my_name), cellid, jobid, vpid))) { ORTE_ERROR_LOG(rc); return rc; } } /* fix up the base name and make it the "real" name */ slurm_nodeid = atoi(getenv("SLURM_NODEID")); orte_process_info.my_name->vpid += slurm_nodeid; /* fix up the system info nodename to match exactly what slurm returned */ if (NULL != orte_system_info.nodename) { free(orte_system_info.nodename); } orte_system_info.nodename = get_slurm_nodename(slurm_nodeid); id = mca_base_param_register_int("ns", "nds", "vpid_start", NULL, -1); mca_base_param_lookup_int(id, &vpid_start); if (vpid_start < 0) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return ORTE_ERR_NOT_FOUND; } id = mca_base_param_register_int("ns", "nds", "num_procs", NULL, -1); mca_base_param_lookup_int(id, &num_procs); if (num_procs < 0) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return ORTE_ERR_NOT_FOUND; } orte_process_info.vpid_start = (orte_vpid_t)vpid_start; orte_process_info.num_procs = (size_t)num_procs; return ORTE_SUCCESS; }
static int slurm_set_name(void) { int slurm_nodeid; int rc; orte_jobid_t jobid; orte_vpid_t vpid; char* tmp; OPAL_OUTPUT_VERBOSE((1, orte_ess_base_output, "ess:slurm setting name")); mca_base_param_reg_string_name("orte", "ess_jobid", "Process jobid", true, false, NULL, &tmp); if (NULL == tmp) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return ORTE_ERR_NOT_FOUND; } if (ORTE_SUCCESS != (rc = orte_util_convert_string_to_jobid(&jobid, tmp))) { ORTE_ERROR_LOG(rc); return(rc); } free(tmp); mca_base_param_reg_string_name("orte", "ess_vpid", "Process vpid", true, false, NULL, &tmp); if (NULL == tmp) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return ORTE_ERR_NOT_FOUND; } if (ORTE_SUCCESS != (rc = orte_util_convert_string_to_vpid(&vpid, tmp))) { ORTE_ERROR_LOG(rc); return(rc); } free(tmp); ORTE_PROC_MY_NAME->jobid = jobid; /* fix up the vpid and make it the "real" vpid */ slurm_nodeid = atoi(getenv("SLURM_NODEID")); ORTE_PROC_MY_NAME->vpid = vpid + slurm_nodeid; OPAL_OUTPUT_VERBOSE((1, orte_ess_base_output, "ess:slurm set name to %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); /* get my node rank in case we are using static ports - this won't * be present for daemons, so don't error out if we don't have it */ mca_base_param_reg_string_name("orte", "ess_node_rank", "Process node rank", true, false, NULL, &tmp); if (NULL != tmp) { my_node_rank = strtol(tmp, NULL, 10); } /* fix up the system info nodename to match exactly what slurm returned */ if (NULL != orte_process_info.nodename) { free(orte_process_info.nodename); } orte_process_info.nodename = get_slurm_nodename(slurm_nodeid); OPAL_OUTPUT_VERBOSE((1, orte_ess_base_output, "ess:slurm set nodename to %s", orte_process_info.nodename)); /* get the non-name common environmental variables */ if (ORTE_SUCCESS != (rc = orte_ess_env_get())) { ORTE_ERROR_LOG(rc); return rc; } return ORTE_SUCCESS; }
static int slurm_set_name(void) { int slurm_nodeid; int rc; int id; orte_jobid_t jobid; orte_vpid_t vpid; char* jobid_string; char* vpid_string; char *nodeid; OPAL_OUTPUT_VERBOSE((1, orte_ess_base_output, "ess:slurm setting name")); id = mca_base_param_register_string("orte", "ess", "jobid", NULL, NULL); mca_base_param_lookup_string(id, &jobid_string); if (NULL == jobid_string) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return ORTE_ERR_NOT_FOUND; } if (ORTE_SUCCESS != (rc = orte_util_convert_string_to_jobid(&jobid, jobid_string))) { ORTE_ERROR_LOG(rc); return(rc); } id = mca_base_param_register_string("orte", "ess", "vpid", NULL, NULL); mca_base_param_lookup_string(id, &vpid_string); if (NULL == vpid_string) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return ORTE_ERR_NOT_FOUND; } if (ORTE_SUCCESS != (rc = orte_util_convert_string_to_vpid(&vpid, vpid_string))) { ORTE_ERROR_LOG(rc); return(rc); } ORTE_PROC_MY_NAME->jobid = jobid; /* fix up the vpid and make it the "real" vpid */ if (NULL == (nodeid = getenv("SLURM_NODEID"))) { opal_output(0, "SLURM_NODEID not found - cannot define name"); return ORTE_ERR_NOT_FOUND; } slurm_nodeid = atoi(nodeid); ORTE_PROC_MY_NAME->vpid = vpid + slurm_nodeid; OPAL_OUTPUT_VERBOSE((1, orte_ess_base_output, "ess:slurm set name to %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); /* fix up the system info nodename to match exactly what slurm returned */ if (NULL != orte_process_info.nodename) { free(orte_process_info.nodename); } orte_process_info.nodename = get_slurm_nodename(slurm_nodeid); OPAL_OUTPUT_VERBOSE((1, orte_ess_base_output, "ess:slurm set nodename to %s", orte_process_info.nodename)); /* get the non-name common environmental variables */ if (ORTE_SUCCESS != (rc = orte_ess_env_get())) { ORTE_ERROR_LOG(rc); return rc; } return ORTE_SUCCESS; }