Make it so we do not mangle the options the user passes to their executeable. Fixes trac:1124
The change also: - cleans up and simplifies the command line processing code - adds an error output if more than one hostfile passed for a single app context - gets rid of the superfluous orte_app_context_map_t type, and instead use a simple argv of -host options This commit was SVN r17750. The following Trac tickets were found above: Ticket 1124 --> https://svn.open-mpi.org/trac/ompi/ticket/1124
Этот коммит содержится в:
родитель
ef8f807c1c
Коммит
f9916811ae
@ -591,11 +591,7 @@ static int spawn(int count, char **array_of_commands,
|
|||||||
/* check for 'host' */
|
/* check for 'host' */
|
||||||
ompi_info_get (array_of_info[i], "host", sizeof(host), host, &flag);
|
ompi_info_get (array_of_info[i], "host", sizeof(host), host, &flag);
|
||||||
if ( flag ) {
|
if ( flag ) {
|
||||||
app->num_map = 1;
|
opal_argv_append_nosize(&app->dash_host, host);
|
||||||
app->map_data = (orte_app_context_map_t **) malloc(sizeof(orte_app_context_map_t *));
|
|
||||||
app->map_data[0] = OBJ_NEW(orte_app_context_map_t);
|
|
||||||
app->map_data[0]->map_type = ORTE_APP_CONTEXT_MAP_HOSTNAME;
|
|
||||||
app->map_data[0]->map_data = strdup(host);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for 'hostfile' */
|
/* check for 'hostfile' */
|
||||||
@ -604,23 +600,13 @@ static int spawn(int count, char **array_of_commands,
|
|||||||
app->hostfile = strdup(host);
|
app->hostfile = strdup(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for 'add-host' */
|
|
||||||
ompi_info_get (array_of_info[i], "add-host", sizeof(host), host, &flag);
|
|
||||||
if ( flag ) {
|
|
||||||
app->num_map = 1;
|
|
||||||
app->map_data = (orte_app_context_map_t **) malloc(sizeof(orte_app_context_map_t *));
|
|
||||||
app->map_data[0] = OBJ_NEW(orte_app_context_map_t);
|
|
||||||
app->map_data[0]->map_type = ORTE_APP_CONTEXT_MAP_ADD_HOSTNAME;
|
|
||||||
app->map_data[0]->map_data = strdup(host);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check for 'add-hostfile' */
|
/* check for 'add-hostfile' */
|
||||||
ompi_info_get (array_of_info[i], "add-hostfile", sizeof(host), host, &flag);
|
ompi_info_get (array_of_info[i], "add-hostfile", sizeof(host), host, &flag);
|
||||||
if ( flag ) {
|
if ( flag ) {
|
||||||
app->add_hostfile = strdup(host);
|
app->add_hostfile = strdup(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 'path', 'arch', 'file', 'soft' -- to be implemented */
|
/* 'path', 'arch', 'file', 'soft', 'add-host' -- to be implemented */
|
||||||
|
|
||||||
/* check for 'ompi_prefix' (OMPI-specific -- to effect the same
|
/* check for 'ompi_prefix' (OMPI-specific -- to effect the same
|
||||||
* behavior as --prefix option to orterun)
|
* behavior as --prefix option to orterun)
|
||||||
|
@ -135,21 +135,20 @@ typedef void* orte_iov_base_ptr_t;
|
|||||||
#define ORTE_VALUE (OPAL_DSS_ID_DYNAMIC + 9) /**< registry return value */
|
#define ORTE_VALUE (OPAL_DSS_ID_DYNAMIC + 9) /**< registry return value */
|
||||||
/* Resource types */
|
/* Resource types */
|
||||||
#define ORTE_APP_CONTEXT (OPAL_DSS_ID_DYNAMIC + 10) /**< argv and enviro arrays */
|
#define ORTE_APP_CONTEXT (OPAL_DSS_ID_DYNAMIC + 10) /**< argv and enviro arrays */
|
||||||
#define ORTE_APP_CONTEXT_MAP (OPAL_DSS_ID_DYNAMIC + 11) /**< application context mapping array */
|
#define ORTE_NODE_DESC (OPAL_DSS_ID_DYNAMIC + 11) /**< describes capabilities of nodes */
|
||||||
#define ORTE_NODE_DESC (OPAL_DSS_ID_DYNAMIC + 12) /**< describes capabilities of nodes */
|
#define ORTE_SLOT_DESC (OPAL_DSS_ID_DYNAMIC + 12) /**< describes slot allocations/reservations */
|
||||||
#define ORTE_SLOT_DESC (OPAL_DSS_ID_DYNAMIC + 13) /**< describes slot allocations/reservations */
|
#define ORTE_JOB (OPAL_DSS_ID_DYNAMIC + 13) /**< job information */
|
||||||
#define ORTE_JOB (OPAL_DSS_ID_DYNAMIC + 14) /**< job information */
|
#define ORTE_NODE (OPAL_DSS_ID_DYNAMIC + 14) /**< node information */
|
||||||
#define ORTE_NODE (OPAL_DSS_ID_DYNAMIC + 15) /**< node information */
|
#define ORTE_PROC (OPAL_DSS_ID_DYNAMIC + 15) /**< process information */
|
||||||
#define ORTE_PROC (OPAL_DSS_ID_DYNAMIC + 16) /**< process information */
|
#define ORTE_JOB_MAP (OPAL_DSS_ID_DYNAMIC + 16) /**< map of process locations */
|
||||||
#define ORTE_JOB_MAP (OPAL_DSS_ID_DYNAMIC + 17) /**< map of process locations */
|
|
||||||
|
|
||||||
/* RML types */
|
/* RML types */
|
||||||
#define ORTE_RML_TAG (OPAL_DSS_ID_DYNAMIC + 18) /**< tag for sending/receiving messages */
|
#define ORTE_RML_TAG (OPAL_DSS_ID_DYNAMIC + 17) /**< tag for sending/receiving messages */
|
||||||
|
|
||||||
/* DAEMON command type */
|
/* DAEMON command type */
|
||||||
#define ORTE_DAEMON_CMD (OPAL_DSS_ID_DYNAMIC + 19) /**< command flag for communicating with the daemon */
|
#define ORTE_DAEMON_CMD (OPAL_DSS_ID_DYNAMIC + 18) /**< command flag for communicating with the daemon */
|
||||||
|
|
||||||
/* GRPCOMM types */
|
/* GRPCOMM types */
|
||||||
#define ORTE_GRPCOMM_MODE (OPAL_DSS_ID_DYNAMIC + 20)
|
#define ORTE_GRPCOMM_MODE (OPAL_DSS_ID_DYNAMIC + 19)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -220,8 +220,7 @@ int orte_ras_base_allocate(orte_job_t *jdata)
|
|||||||
if (0 < apps[i]->num_map) {
|
if (0 < apps[i]->num_map) {
|
||||||
if (ORTE_SUCCESS != (rc = orte_util_add_dash_host_nodes(&nodes,
|
if (ORTE_SUCCESS != (rc = orte_util_add_dash_host_nodes(&nodes,
|
||||||
&override_oversubscribed,
|
&override_oversubscribed,
|
||||||
apps[i]->num_map,
|
apps[i]->dash_host))) {
|
||||||
apps[i]->map_data))) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
ORTE_ERROR_LOG(rc);
|
||||||
OBJ_DESTRUCT(&nodes);
|
OBJ_DESTRUCT(&nodes);
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -116,7 +116,7 @@ int orte_rmaps_base_get_target_nodes(opal_list_t *allocated_nodes, orte_std_cntr
|
|||||||
|
|
||||||
/* now filter the list through any -host specification */
|
/* now filter the list through any -host specification */
|
||||||
if (ORTE_SUCCESS != (rc = orte_util_filter_dash_host_nodes(allocated_nodes,
|
if (ORTE_SUCCESS != (rc = orte_util_filter_dash_host_nodes(allocated_nodes,
|
||||||
app->num_map, app->map_data))) {
|
app->dash_host))) {
|
||||||
ORTE_ERROR_LOG(rc);
|
ORTE_ERROR_LOG(rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ int orte_rmaps_base_get_target_nodes(opal_list_t *allocated_nodes, orte_std_cntr
|
|||||||
/** check that anything is left! */
|
/** check that anything is left! */
|
||||||
if (0 == opal_list_get_size(allocated_nodes)) {
|
if (0 == opal_list_get_size(allocated_nodes)) {
|
||||||
opal_show_help("help-orte-rmaps-base.txt", "orte-rmaps-base:no-mapped-node",
|
opal_show_help("help-orte-rmaps-base.txt", "orte-rmaps-base:no-mapped-node",
|
||||||
true, app->app, app->map_data);
|
true, app->app, "");
|
||||||
return ORTE_ERR_SILENT;
|
return ORTE_ERR_SILENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,18 +157,6 @@ int orte_dt_compare_app_context(orte_app_context_t *value1, orte_app_context_t *
|
|||||||
return OPAL_EQUAL;
|
return OPAL_EQUAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* APP CONTEXT MAP
|
|
||||||
*/
|
|
||||||
int orte_dt_compare_app_context_map(orte_app_context_map_t *value1, orte_app_context_map_t *value2, opal_data_type_t type)
|
|
||||||
{
|
|
||||||
if (value1->map_type > value2->map_type) return OPAL_VALUE1_GREATER;
|
|
||||||
if (value2->map_type > value1->map_type) return OPAL_VALUE2_GREATER;
|
|
||||||
|
|
||||||
return OPAL_EQUAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* EXIT CODE
|
* EXIT CODE
|
||||||
*/
|
*/
|
||||||
|
@ -270,9 +270,6 @@ int orte_dt_copy_proc(orte_proc_t **dest, orte_proc_t *src, opal_data_type_t typ
|
|||||||
*/
|
*/
|
||||||
int orte_dt_copy_app_context(orte_app_context_t **dest, orte_app_context_t *src, opal_data_type_t type)
|
int orte_dt_copy_app_context(orte_app_context_t **dest, orte_app_context_t *src, opal_data_type_t type)
|
||||||
{
|
{
|
||||||
int rc;
|
|
||||||
orte_std_cntr_t i;
|
|
||||||
|
|
||||||
/* create the new object */
|
/* create the new object */
|
||||||
*dest = OBJ_NEW(orte_app_context_t);
|
*dest = OBJ_NEW(orte_app_context_t);
|
||||||
if (NULL == *dest) {
|
if (NULL == *dest) {
|
||||||
@ -313,21 +310,8 @@ int orte_dt_copy_app_context(orte_app_context_t **dest, orte_app_context_t *src,
|
|||||||
(*dest)->preload_files_dest_dir = strdup(src->preload_files_dest_dir);
|
(*dest)->preload_files_dest_dir = strdup(src->preload_files_dest_dir);
|
||||||
else
|
else
|
||||||
(*dest)->preload_files_dest_dir = NULL;
|
(*dest)->preload_files_dest_dir = NULL;
|
||||||
|
|
||||||
if (0 < src->num_map) {
|
(*dest)->dash_host = opal_argv_copy(src->dash_host);
|
||||||
(*dest)->map_data = (orte_app_context_map_t**)malloc(src->num_map * sizeof(orte_app_context_map_t*));
|
|
||||||
if (NULL == (*dest)->map_data) {
|
|
||||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
|
||||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
|
||||||
}
|
|
||||||
for (i=0; i < src->num_map; i++) {
|
|
||||||
if (ORTE_SUCCESS != (rc = orte_dt_copy_app_context_map(&((*dest)->map_data[i]), src->map_data[i],
|
|
||||||
ORTE_APP_CONTEXT_MAP))) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (NULL != src->prefix_dir) {
|
if (NULL != src->prefix_dir) {
|
||||||
(*dest)->prefix_dir = strdup(src->prefix_dir);
|
(*dest)->prefix_dir = strdup(src->prefix_dir);
|
||||||
}
|
}
|
||||||
@ -335,27 +319,6 @@ int orte_dt_copy_app_context(orte_app_context_t **dest, orte_app_context_t *src,
|
|||||||
return ORTE_SUCCESS;
|
return ORTE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* APP CONTEXT MAP
|
|
||||||
*/
|
|
||||||
int orte_dt_copy_app_context_map(orte_app_context_map_t **dest, orte_app_context_map_t *src, opal_data_type_t type)
|
|
||||||
{
|
|
||||||
/* create the new object */
|
|
||||||
*dest = OBJ_NEW(orte_app_context_map_t);
|
|
||||||
if (NULL == *dest) {
|
|
||||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
|
||||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* copy data into it */
|
|
||||||
(*dest)->map_type = src->map_type;
|
|
||||||
if (NULL != src->map_data) {
|
|
||||||
(*dest)->map_data = strdup(src->map_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ORTE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int orte_dt_copy_proc_state(orte_proc_state_t **dest, orte_proc_state_t *src, opal_data_type_t type)
|
int orte_dt_copy_proc_state(orte_proc_state_t **dest, orte_proc_state_t *src, opal_data_type_t type)
|
||||||
{
|
{
|
||||||
orte_proc_state_t *ps;
|
orte_proc_state_t *ps;
|
||||||
|
@ -559,19 +559,20 @@ int orte_dt_pack_app_context(opal_buffer_t *buffer, const void *src,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pack the map data */
|
/* pack the dash host argv array */
|
||||||
if (ORTE_SUCCESS != (rc = opal_dss.pack_buffer(buffer,
|
count = opal_argv_count(app_context[i]->dash_host);
|
||||||
(void*)(&(app_context[i]->num_map)), 1, ORTE_STD_CNTR))) {
|
if (ORTE_SUCCESS != (rc = opal_dss.pack_buffer(buffer, (void*)(&count), 1, ORTE_STD_CNTR))) {
|
||||||
ORTE_ERROR_LOG(rc);
|
ORTE_ERROR_LOG(rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app_context[i]->num_map > 0) {
|
/* if there are entries, pack the argv entries */
|
||||||
|
if (0 < count) {
|
||||||
if (ORTE_SUCCESS != (rc = opal_dss.pack_buffer(buffer,
|
if (ORTE_SUCCESS != (rc = opal_dss.pack_buffer(buffer,
|
||||||
(void*)(app_context[i]->map_data), app_context[i]->num_map, ORTE_APP_CONTEXT_MAP))) {
|
(void*)(app_context[i]->dash_host), count, OPAL_STRING))) {
|
||||||
ORTE_ERROR_LOG(rc);
|
ORTE_ERROR_LOG(rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pack the prefix dir if we have one */
|
/* pack the prefix dir if we have one */
|
||||||
@ -651,34 +652,6 @@ int orte_dt_pack_app_context(opal_buffer_t *buffer, const void *src,
|
|||||||
return ORTE_SUCCESS;
|
return ORTE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* APP CONTEXT MAP
|
|
||||||
*/
|
|
||||||
int orte_dt_pack_app_context_map(opal_buffer_t *buffer, const void *src,
|
|
||||||
int32_t num_vals, opal_data_type_t type)
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
orte_app_context_map_t **app_context_map;
|
|
||||||
int32_t i;
|
|
||||||
|
|
||||||
app_context_map = (orte_app_context_map_t**) src;
|
|
||||||
for (i=0; i < num_vals; i++) {
|
|
||||||
if (ORTE_SUCCESS != (rc = opal_dss.pack_buffer(buffer,
|
|
||||||
(void*)(&(app_context_map[i]->map_type)), 1, OPAL_UINT8))) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ORTE_SUCCESS != (rc = opal_dss.pack_buffer(buffer,
|
|
||||||
(void*)(&(app_context_map[i]->map_data)), 1, OPAL_STRING))) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ORTE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* EXIT CODE
|
* EXIT CODE
|
||||||
*/
|
*/
|
||||||
|
@ -382,9 +382,8 @@ int orte_dt_print_proc(char **output, char *prefix, orte_proc_t *src, opal_data_
|
|||||||
*/
|
*/
|
||||||
int orte_dt_print_app_context(char **output, char *prefix, orte_app_context_t *src, opal_data_type_t type)
|
int orte_dt_print_app_context(char **output, char *prefix, orte_app_context_t *src, opal_data_type_t type)
|
||||||
{
|
{
|
||||||
char *tmp, *tmp2, *tmp3, *pfx, *pfx2;
|
char *tmp, *tmp2, *pfx2;
|
||||||
int32_t j;
|
int i, count;
|
||||||
int i, rc, count;
|
|
||||||
|
|
||||||
/* set default result */
|
/* set default result */
|
||||||
*output = NULL;
|
*output = NULL;
|
||||||
@ -414,24 +413,17 @@ int orte_dt_print_app_context(char **output, char *prefix, orte_app_context_t *s
|
|||||||
tmp = tmp2;
|
tmp = tmp2;
|
||||||
}
|
}
|
||||||
|
|
||||||
asprintf(&tmp2, "%s\n%s\tWorking dir: %s (user: %d)\n%s\tHostfile: %s\tAdd-Hostfile: %s\tNum maps: %lu", tmp, pfx2, src->cwd, (int) src->user_specified_cwd,
|
asprintf(&tmp2, "%s\n%s\tWorking dir: %s (user: %d)\n%s\tHostfile: %s\tAdd-Hostfile: %s", tmp, pfx2, src->cwd, (int) src->user_specified_cwd,
|
||||||
pfx2, (NULL == src->hostfile) ? "NULL" : src->hostfile,
|
pfx2, (NULL == src->hostfile) ? "NULL" : src->hostfile,
|
||||||
(NULL == src->add_hostfile) ? "NULL" : src->add_hostfile,
|
(NULL == src->add_hostfile) ? "NULL" : src->add_hostfile);
|
||||||
(unsigned long)src->num_map);
|
|
||||||
free(tmp);
|
free(tmp);
|
||||||
tmp = tmp2;
|
tmp = tmp2;
|
||||||
|
|
||||||
asprintf(&pfx, "%s\t", pfx2);
|
count = opal_argv_count(src->dash_host);
|
||||||
|
for (i=0; i < count; i++) {
|
||||||
for (j = 0; j < src->num_map; ++j) {
|
asprintf(&tmp2, "%s\n%s\tDash_host[%lu]: %s", tmp, pfx2, (unsigned long)i, src->dash_host[i]);
|
||||||
if (ORTE_SUCCESS != (rc = orte_dt_print_app_context_map(&tmp2, pfx, src->map_data[j], ORTE_APP_CONTEXT_MAP))) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
asprintf(&tmp3, "%s\n%s", tmp, tmp2);
|
|
||||||
free(tmp);
|
free(tmp);
|
||||||
free(tmp2);
|
tmp = tmp2;
|
||||||
tmp = tmp3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set the return */
|
/* set the return */
|
||||||
@ -441,17 +433,6 @@ int orte_dt_print_app_context(char **output, char *prefix, orte_app_context_t *s
|
|||||||
return ORTE_SUCCESS;
|
return ORTE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* APP CONTEXT MAP
|
|
||||||
*/
|
|
||||||
int orte_dt_print_app_context_map(char **output, char *prefix, orte_app_context_map_t *src, opal_data_type_t type)
|
|
||||||
{
|
|
||||||
asprintf(output, "%sData for app_context_map: Type: %lu\tData: %s",
|
|
||||||
prefix, (unsigned long)src->map_type, src->map_data);
|
|
||||||
|
|
||||||
return ORTE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* JOB_MAP
|
* JOB_MAP
|
||||||
*/
|
*/
|
||||||
|
@ -194,10 +194,6 @@ int orte_dt_size_proc(size_t *size, orte_proc_t *src, opal_data_type_t type)
|
|||||||
*/
|
*/
|
||||||
int orte_dt_size_app_context(size_t *size, orte_app_context_t *src, opal_data_type_t type)
|
int orte_dt_size_app_context(size_t *size, orte_app_context_t *src, opal_data_type_t type)
|
||||||
{
|
{
|
||||||
int j, rc, count;
|
|
||||||
int32_t i;
|
|
||||||
size_t map_size;
|
|
||||||
|
|
||||||
/* account for the object itself */
|
/* account for the object itself */
|
||||||
*size = sizeof(orte_app_context_t);
|
*size = sizeof(orte_app_context_t);
|
||||||
|
|
||||||
@ -208,25 +204,9 @@ int orte_dt_size_app_context(size_t *size, orte_app_context_t *src, opal_data_ty
|
|||||||
*size += strlen(src->app);
|
*size += strlen(src->app);
|
||||||
}
|
}
|
||||||
|
|
||||||
count = opal_argv_count(src->argv);
|
*size += opal_argv_len(src->argv);
|
||||||
if (0 < count) {
|
|
||||||
/* account for array of char* */
|
*size += opal_argv_len(src->env);
|
||||||
*size += count * sizeof(char*);
|
|
||||||
for (j=0; j < count; j++) {
|
|
||||||
*size += strlen(src->argv[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*size += sizeof(char**); /* account for size of the argv pointer itself */
|
|
||||||
|
|
||||||
count = opal_argv_count(src->env);
|
|
||||||
if (0 < count) {
|
|
||||||
/* account for array of char* */
|
|
||||||
*size += count * sizeof(char*);
|
|
||||||
for (i=0; i < count; i++) {
|
|
||||||
*size += strlen(src->env[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*size += sizeof(char**); /* account for size of the env pointer itself */
|
|
||||||
|
|
||||||
if (NULL != src->cwd) {
|
if (NULL != src->cwd) {
|
||||||
*size += strlen(src->cwd); /* working directory */
|
*size += strlen(src->cwd); /* working directory */
|
||||||
@ -240,15 +220,7 @@ int orte_dt_size_app_context(size_t *size, orte_app_context_t *src, opal_data_ty
|
|||||||
*size += strlen(src->add_hostfile); /* add_hostfile name */
|
*size += strlen(src->add_hostfile); /* add_hostfile name */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < src->num_map) {
|
*size += opal_argv_len(src->dash_host);
|
||||||
for (i=0; i < src->num_map; i++) {
|
|
||||||
if (ORTE_SUCCESS != (rc = orte_dt_size_app_context_map(&map_size, src->map_data[i], ORTE_APP_CONTEXT_MAP))) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
*size = 0;
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NULL != src->prefix_dir) {
|
if (NULL != src->prefix_dir) {
|
||||||
*size += strlen(src->prefix_dir);
|
*size += strlen(src->prefix_dir);
|
||||||
@ -257,22 +229,6 @@ int orte_dt_size_app_context(size_t *size, orte_app_context_t *src, opal_data_ty
|
|||||||
return ORTE_SUCCESS;
|
return ORTE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* APP CONTEXT MAP
|
|
||||||
*/
|
|
||||||
int orte_dt_size_app_context_map(size_t *size, orte_app_context_map_t *src, opal_data_type_t type)
|
|
||||||
{
|
|
||||||
/* account for the object itself */
|
|
||||||
*size = sizeof(orte_app_context_map_t);
|
|
||||||
|
|
||||||
/* if src is NULL, then that's all we wanted */
|
|
||||||
if (NULL == src) return ORTE_SUCCESS;
|
|
||||||
|
|
||||||
*size += strlen(src->map_data);
|
|
||||||
|
|
||||||
return ORTE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* JOB_MAP
|
* JOB_MAP
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +55,6 @@ int orte_dt_compare_job(orte_job_t *value1, orte_job_t *value2, opal_data_type_t
|
|||||||
int orte_dt_compare_node(orte_node_t *value1, orte_node_t *value2, opal_data_type_t type);
|
int orte_dt_compare_node(orte_node_t *value1, orte_node_t *value2, opal_data_type_t type);
|
||||||
int orte_dt_compare_proc(orte_proc_t *value1, orte_proc_t *value2, opal_data_type_t type);
|
int orte_dt_compare_proc(orte_proc_t *value1, orte_proc_t *value2, opal_data_type_t type);
|
||||||
int orte_dt_compare_app_context(orte_app_context_t *value1, orte_app_context_t *value2, opal_data_type_t type);
|
int orte_dt_compare_app_context(orte_app_context_t *value1, orte_app_context_t *value2, opal_data_type_t type);
|
||||||
int orte_dt_compare_app_context_map(orte_app_context_map_t *value1, orte_app_context_map_t *value2, opal_data_type_t type);
|
|
||||||
int orte_dt_compare_exit_code(orte_exit_code_t *value1,
|
int orte_dt_compare_exit_code(orte_exit_code_t *value1,
|
||||||
orte_exit_code_t *value2,
|
orte_exit_code_t *value2,
|
||||||
opal_data_type_t type);
|
opal_data_type_t type);
|
||||||
@ -85,7 +84,6 @@ int orte_dt_copy_job(orte_job_t **dest, orte_job_t *src, opal_data_type_t type);
|
|||||||
int orte_dt_copy_node(orte_node_t **dest, orte_node_t *src, opal_data_type_t type);
|
int orte_dt_copy_node(orte_node_t **dest, orte_node_t *src, opal_data_type_t type);
|
||||||
int orte_dt_copy_proc(orte_proc_t **dest, orte_proc_t *src, opal_data_type_t type);
|
int orte_dt_copy_proc(orte_proc_t **dest, orte_proc_t *src, opal_data_type_t type);
|
||||||
int orte_dt_copy_app_context(orte_app_context_t **dest, orte_app_context_t *src, opal_data_type_t type);
|
int orte_dt_copy_app_context(orte_app_context_t **dest, orte_app_context_t *src, opal_data_type_t type);
|
||||||
int orte_dt_copy_app_context_map(orte_app_context_map_t **dest, orte_app_context_map_t *src, opal_data_type_t type);
|
|
||||||
int orte_dt_copy_proc_state(orte_proc_state_t **dest, orte_proc_state_t *src, opal_data_type_t type);
|
int orte_dt_copy_proc_state(orte_proc_state_t **dest, orte_proc_state_t *src, opal_data_type_t type);
|
||||||
int orte_dt_copy_job_state(orte_job_state_t **dest, orte_job_state_t *src, opal_data_type_t type);
|
int orte_dt_copy_job_state(orte_job_state_t **dest, orte_job_state_t *src, opal_data_type_t type);
|
||||||
int orte_dt_copy_node_state(orte_node_state_t **dest, orte_node_state_t *src, opal_data_type_t type);
|
int orte_dt_copy_node_state(orte_node_state_t **dest, orte_node_state_t *src, opal_data_type_t type);
|
||||||
@ -116,8 +114,6 @@ int orte_dt_pack_proc(opal_buffer_t *buffer, const void *src,
|
|||||||
int32_t num_vals, opal_data_type_t type);
|
int32_t num_vals, opal_data_type_t type);
|
||||||
int orte_dt_pack_app_context(opal_buffer_t *buffer, const void *src,
|
int orte_dt_pack_app_context(opal_buffer_t *buffer, const void *src,
|
||||||
int32_t num_vals, opal_data_type_t type);
|
int32_t num_vals, opal_data_type_t type);
|
||||||
int orte_dt_pack_app_context_map(opal_buffer_t *buffer, const void *src,
|
|
||||||
int32_t num_vals, opal_data_type_t type);
|
|
||||||
int orte_dt_pack_exit_code(opal_buffer_t *buffer, const void *src,
|
int orte_dt_pack_exit_code(opal_buffer_t *buffer, const void *src,
|
||||||
int32_t num_vals, opal_data_type_t type);
|
int32_t num_vals, opal_data_type_t type);
|
||||||
int orte_dt_pack_node_state(opal_buffer_t *buffer, const void *src,
|
int orte_dt_pack_node_state(opal_buffer_t *buffer, const void *src,
|
||||||
@ -144,7 +140,6 @@ int orte_dt_print_job(char **output, char *prefix, orte_job_t *src, opal_data_ty
|
|||||||
int orte_dt_print_node(char **output, char *prefix, orte_node_t *src, opal_data_type_t type);
|
int orte_dt_print_node(char **output, char *prefix, orte_node_t *src, opal_data_type_t type);
|
||||||
int orte_dt_print_proc(char **output, char *prefix, orte_proc_t *src, opal_data_type_t type);
|
int orte_dt_print_proc(char **output, char *prefix, orte_proc_t *src, opal_data_type_t type);
|
||||||
int orte_dt_print_app_context(char **output, char *prefix, orte_app_context_t *src, opal_data_type_t type);
|
int orte_dt_print_app_context(char **output, char *prefix, orte_app_context_t *src, opal_data_type_t type);
|
||||||
int orte_dt_print_app_context_map(char **output, char *prefix, orte_app_context_map_t *src, opal_data_type_t type);
|
|
||||||
int orte_dt_print_map(char **output, char *prefix, orte_job_map_t *src, opal_data_type_t type);
|
int orte_dt_print_map(char **output, char *prefix, orte_job_map_t *src, opal_data_type_t type);
|
||||||
|
|
||||||
/** Data type release functions */
|
/** Data type release functions */
|
||||||
@ -157,7 +152,6 @@ int orte_dt_size_job(size_t *size, orte_job_t *src, opal_data_type_t type);
|
|||||||
int orte_dt_size_node(size_t *size, orte_node_t *src, opal_data_type_t type);
|
int orte_dt_size_node(size_t *size, orte_node_t *src, opal_data_type_t type);
|
||||||
int orte_dt_size_proc(size_t *size, orte_proc_t *src, opal_data_type_t type);
|
int orte_dt_size_proc(size_t *size, orte_proc_t *src, opal_data_type_t type);
|
||||||
int orte_dt_size_app_context(size_t *size, orte_app_context_t *src, opal_data_type_t type);
|
int orte_dt_size_app_context(size_t *size, orte_app_context_t *src, opal_data_type_t type);
|
||||||
int orte_dt_size_app_context_map(size_t *size, orte_app_context_map_t *src, opal_data_type_t type);
|
|
||||||
int orte_dt_size_map(size_t *size, orte_job_map_t *src, opal_data_type_t type);
|
int orte_dt_size_map(size_t *size, orte_job_map_t *src, opal_data_type_t type);
|
||||||
|
|
||||||
/** Data type unpack functions */
|
/** Data type unpack functions */
|
||||||
@ -177,8 +171,6 @@ int orte_dt_unpack_proc(opal_buffer_t *buffer, void *dest,
|
|||||||
int32_t *num_vals, opal_data_type_t type);
|
int32_t *num_vals, opal_data_type_t type);
|
||||||
int orte_dt_unpack_app_context(opal_buffer_t *buffer, void *dest,
|
int orte_dt_unpack_app_context(opal_buffer_t *buffer, void *dest,
|
||||||
int32_t *num_vals, opal_data_type_t type);
|
int32_t *num_vals, opal_data_type_t type);
|
||||||
int orte_dt_unpack_app_context_map(opal_buffer_t *buffer, void *dest,
|
|
||||||
int32_t *num_vals, opal_data_type_t type);
|
|
||||||
int orte_dt_unpack_exit_code(opal_buffer_t *buffer, void *dest,
|
int orte_dt_unpack_exit_code(opal_buffer_t *buffer, void *dest,
|
||||||
int32_t *num_vals, opal_data_type_t type);
|
int32_t *num_vals, opal_data_type_t type);
|
||||||
int orte_dt_unpack_node_state(opal_buffer_t *buffer, void *dest,
|
int orte_dt_unpack_node_state(opal_buffer_t *buffer, void *dest,
|
||||||
|
@ -626,22 +626,25 @@ int orte_dt_unpack_app_context(opal_buffer_t *buffer, void *dest,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* unpack the map data */
|
/* get the number of dash_host strings that were packed */
|
||||||
max_n=1;
|
max_n = 1;
|
||||||
if (ORTE_SUCCESS != (rc = opal_dss.unpack_buffer(buffer, &(app_context[i]->num_map),
|
if (ORTE_SUCCESS != (rc = opal_dss.unpack_buffer(buffer, &count, &max_n, ORTE_STD_CNTR))) {
|
||||||
&max_n, ORTE_STD_CNTR))) {
|
ORTE_ERROR_LOG(rc);
|
||||||
ORTE_ERROR_LOG(rc);
|
return rc;
|
||||||
return rc;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (app_context[i]->num_map > 0) {
|
/* if there are dash_host strings, allocate the required space for the char * pointers */
|
||||||
app_context[i]->map_data = (orte_app_context_map_t**)malloc(sizeof(orte_app_context_map_t*) * app_context[i]->num_map);
|
if (0 < count) {
|
||||||
if (NULL == app_context[i]->map_data) {
|
app_context[i]->dash_host = (char **)malloc((count+1) * sizeof(char*));
|
||||||
|
if (NULL == app_context[i]->dash_host) {
|
||||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||||
}
|
}
|
||||||
if (ORTE_SUCCESS != (rc = opal_dss.unpack_buffer(buffer, app_context[i]->map_data,
|
app_context[i]->dash_host[count] = NULL;
|
||||||
&(app_context[i]->num_map), ORTE_APP_CONTEXT_MAP))) {
|
|
||||||
|
/* and unpack them */
|
||||||
|
max_n = count;
|
||||||
|
if (ORTE_SUCCESS != (rc = opal_dss.unpack_buffer(buffer, app_context[i]->dash_host, &max_n, OPAL_STRING))) {
|
||||||
ORTE_ERROR_LOG(rc);
|
ORTE_ERROR_LOG(rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -711,45 +714,6 @@ int orte_dt_unpack_app_context(opal_buffer_t *buffer, void *dest,
|
|||||||
return ORTE_SUCCESS;
|
return ORTE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* APP_CONTEXT_MAP
|
|
||||||
*/
|
|
||||||
int orte_dt_unpack_app_context_map(opal_buffer_t *buffer, void *dest,
|
|
||||||
int32_t *num_vals, opal_data_type_t type)
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
orte_app_context_map_t **app_context_map;
|
|
||||||
int32_t i, max_n=1;
|
|
||||||
|
|
||||||
/* unpack into array of app_context_map objects */
|
|
||||||
app_context_map = (orte_app_context_map_t**) dest;
|
|
||||||
for (i=0; i < *num_vals; i++) {
|
|
||||||
|
|
||||||
/* create the app_context object */
|
|
||||||
app_context_map[i] = OBJ_NEW(orte_app_context_map_t);
|
|
||||||
if (NULL == app_context_map[i]) {
|
|
||||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
|
||||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* map type */
|
|
||||||
if (ORTE_SUCCESS != (rc = opal_dss.unpack_buffer(buffer, &(app_context_map[i]->map_type),
|
|
||||||
&max_n, OPAL_UINT8))) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* map data */
|
|
||||||
if (ORTE_SUCCESS != (rc = opal_dss.unpack_buffer(buffer, &(app_context_map[i]->map_data),
|
|
||||||
&max_n, OPAL_STRING))) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ORTE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* EXIT CODE
|
* EXIT CODE
|
||||||
*/
|
*/
|
||||||
|
@ -277,20 +277,6 @@ int orte_dt_init(void)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = ORTE_APP_CONTEXT_MAP;
|
|
||||||
if (ORTE_SUCCESS != (rc = opal_dss.register_type(orte_dt_pack_app_context_map,
|
|
||||||
orte_dt_unpack_app_context_map,
|
|
||||||
(opal_dss_copy_fn_t)orte_dt_copy_app_context_map,
|
|
||||||
(opal_dss_compare_fn_t)orte_dt_compare_app_context_map,
|
|
||||||
(opal_dss_size_fn_t)orte_dt_size_app_context_map,
|
|
||||||
(opal_dss_print_fn_t)orte_dt_print_app_context_map,
|
|
||||||
(opal_dss_release_fn_t)orte_dt_std_obj_release,
|
|
||||||
OPAL_DSS_STRUCTURED,
|
|
||||||
"ORTE_APP_CONTEXT_MAP", &tmp))) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp = ORTE_NODE_STATE;
|
tmp = ORTE_NODE_STATE;
|
||||||
if (ORTE_SUCCESS != (rc = opal_dss.register_type(orte_dt_pack_node_state,
|
if (ORTE_SUCCESS != (rc = opal_dss.register_type(orte_dt_pack_node_state,
|
||||||
orte_dt_unpack_node_state,
|
orte_dt_unpack_node_state,
|
||||||
|
@ -60,36 +60,6 @@ BEGIN_C_DECLS
|
|||||||
struct orte_proc_t;
|
struct orte_proc_t;
|
||||||
/************/
|
/************/
|
||||||
|
|
||||||
/** Value for orte_app_context_map_t: the data is uninitialized (!) */
|
|
||||||
#define ORTE_APP_CONTEXT_MAP_INVALID 0
|
|
||||||
/** Value for orte_app_context_map_t: the data is a comma-delimited
|
|
||||||
string of hostnames */
|
|
||||||
#define ORTE_APP_CONTEXT_MAP_HOSTNAME 1
|
|
||||||
/** Value for orte_app_context_map_t: the data is a comma-delimited
|
|
||||||
list of architecture names */
|
|
||||||
#define ORTE_APP_CONTEXT_MAP_ARCH 2
|
|
||||||
/** Value for orte_app_context_map_t: the data is a comma-delimited
|
|
||||||
list of C, cX, N, nX mappsing */
|
|
||||||
#define ORTE_APP_CONTEXT_MAP_CN 3
|
|
||||||
/** Value for orte_app_context_map_t: the data is a comma-delimited
|
|
||||||
string of hostnames that are to be added and used */
|
|
||||||
#define ORTE_APP_CONTEXT_MAP_ADD_HOSTNAME 4
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Information about mapping requested by the user
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
/** Parent object */
|
|
||||||
opal_object_t super;
|
|
||||||
/** One of the ORTE_APP_CONTEXT_MAP_* values */
|
|
||||||
uint8_t map_type;
|
|
||||||
/** String data */
|
|
||||||
char *map_data;
|
|
||||||
} orte_app_context_map_t;
|
|
||||||
|
|
||||||
ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_app_context_map_t);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information about a specific application to be launched in the RTE.
|
* Information about a specific application to be launched in the RTE.
|
||||||
*/
|
*/
|
||||||
@ -116,11 +86,9 @@ typedef struct {
|
|||||||
char *add_hostfile;
|
char *add_hostfile;
|
||||||
/** Length of the map_data array, not including the final NULL entry */
|
/** Length of the map_data array, not including the final NULL entry */
|
||||||
orte_std_cntr_t num_map;
|
orte_std_cntr_t num_map;
|
||||||
/** Mapping data about how this app should be laid out across CPUs
|
/** argv of hosts passed in to -host */
|
||||||
/ nodes */
|
char ** dash_host;
|
||||||
orte_app_context_map_t **map_data;
|
/** Prefix directory for this app (or NULL if no override necessary) */
|
||||||
/** Prefix directory for this app (or NULL if no override
|
|
||||||
necessary) */
|
|
||||||
char *prefix_dir;
|
char *prefix_dir;
|
||||||
/** Preload the binary on the remote machine (in PLS via FileM) */
|
/** Preload the binary on the remote machine (in PLS via FileM) */
|
||||||
bool preload_binary;
|
bool preload_binary;
|
||||||
|
@ -49,8 +49,7 @@ static void orte_app_context_construct(orte_app_context_t* app_context)
|
|||||||
app_context->cwd=NULL;
|
app_context->cwd=NULL;
|
||||||
app_context->hostfile=NULL;
|
app_context->hostfile=NULL;
|
||||||
app_context->add_hostfile=NULL;
|
app_context->add_hostfile=NULL;
|
||||||
app_context->num_map = 0;
|
app_context->dash_host = NULL;
|
||||||
app_context->map_data = NULL;
|
|
||||||
app_context->prefix_dir = NULL;
|
app_context->prefix_dir = NULL;
|
||||||
app_context->preload_binary = false;
|
app_context->preload_binary = false;
|
||||||
app_context->preload_files = NULL;
|
app_context->preload_files = NULL;
|
||||||
@ -59,8 +58,6 @@ static void orte_app_context_construct(orte_app_context_t* app_context)
|
|||||||
|
|
||||||
static void orte_app_context_destructor(orte_app_context_t* app_context)
|
static void orte_app_context_destructor(orte_app_context_t* app_context)
|
||||||
{
|
{
|
||||||
orte_std_cntr_t i;
|
|
||||||
|
|
||||||
if (NULL != app_context->app) {
|
if (NULL != app_context->app) {
|
||||||
free (app_context->app);
|
free (app_context->app);
|
||||||
}
|
}
|
||||||
@ -86,15 +83,8 @@ static void orte_app_context_destructor(orte_app_context_t* app_context)
|
|||||||
free(app_context->add_hostfile);
|
free(app_context->add_hostfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != app_context->map_data) {
|
if (NULL != app_context->dash_host) {
|
||||||
for (i = 0; i < app_context->num_map; ++i) {
|
opal_argv_free(app_context->dash_host);
|
||||||
if (NULL != app_context->map_data[i]) {
|
|
||||||
OBJ_RELEASE(app_context->map_data[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (NULL != app_context->map_data) {
|
|
||||||
free(app_context->map_data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != app_context->prefix_dir) {
|
if (NULL != app_context->prefix_dir) {
|
||||||
@ -117,26 +107,6 @@ OBJ_CLASS_INSTANCE(orte_app_context_t,
|
|||||||
orte_app_context_construct,
|
orte_app_context_construct,
|
||||||
orte_app_context_destructor);
|
orte_app_context_destructor);
|
||||||
|
|
||||||
|
|
||||||
static void orte_app_context_map_construct(orte_app_context_map_t *a)
|
|
||||||
{
|
|
||||||
a->map_type = ORTE_APP_CONTEXT_MAP_INVALID;
|
|
||||||
a->map_data = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void orte_app_context_map_destruct(orte_app_context_map_t *a)
|
|
||||||
{
|
|
||||||
if (NULL != a->map_data) {
|
|
||||||
free(a->map_data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
OBJ_CLASS_INSTANCE(orte_app_context_map_t,
|
|
||||||
opal_object_t,
|
|
||||||
orte_app_context_map_construct,
|
|
||||||
orte_app_context_map_destruct);
|
|
||||||
|
|
||||||
|
|
||||||
static void orte_job_construct(orte_job_t* job)
|
static void orte_job_construct(orte_job_t* job)
|
||||||
{
|
{
|
||||||
job->jobid = ORTE_JOBID_INVALID;
|
job->jobid = ORTE_JOBID_INVALID;
|
||||||
|
@ -351,3 +351,6 @@ uri for the ompi-server. Note that this is *not* a standard uri, but
|
|||||||
a special format used internally by Open MPI for communications. It can
|
a special format used internally by Open MPI for communications. It can
|
||||||
best be generated by simply directing the ompi-server to put its
|
best be generated by simply directing the ompi-server to put its
|
||||||
uri in a file, and then giving %s that filename.
|
uri in a file, and then giving %s that filename.
|
||||||
|
[orterun:multiple-hostfiles]
|
||||||
|
Error: More than one hostfile was passed for a single application context, which
|
||||||
|
is not supported at this time.
|
||||||
|
@ -970,7 +970,6 @@ static int init_globals(void)
|
|||||||
/* Only CONSTRUCT things once */
|
/* Only CONSTRUCT things once */
|
||||||
if (!globals_init) {
|
if (!globals_init) {
|
||||||
OBJ_CONSTRUCT(&orterun_globals.lock, opal_mutex_t);
|
OBJ_CONSTRUCT(&orterun_globals.lock, opal_mutex_t);
|
||||||
orterun_globals.hostfile = NULL;
|
|
||||||
orterun_globals.env_val = NULL;
|
orterun_globals.env_val = NULL;
|
||||||
orterun_globals.appfile = NULL;
|
orterun_globals.appfile = NULL;
|
||||||
orterun_globals.wdir = NULL;
|
orterun_globals.wdir = NULL;
|
||||||
@ -988,9 +987,6 @@ static int init_globals(void)
|
|||||||
orterun_globals.by_slot = false;
|
orterun_globals.by_slot = false;
|
||||||
orterun_globals.debugger = false;
|
orterun_globals.debugger = false;
|
||||||
orterun_globals.num_procs = 0;
|
orterun_globals.num_procs = 0;
|
||||||
if( NULL != orterun_globals.hostfile )
|
|
||||||
free( orterun_globals.hostfile );
|
|
||||||
orterun_globals.hostfile = NULL;
|
|
||||||
if( NULL != orterun_globals.env_val )
|
if( NULL != orterun_globals.env_val )
|
||||||
free( orterun_globals.env_val );
|
free( orterun_globals.env_val );
|
||||||
orterun_globals.env_val = NULL;
|
orterun_globals.env_val = NULL;
|
||||||
@ -1312,113 +1308,22 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
|
|||||||
int i, j, count, rc;
|
int i, j, count, rc;
|
||||||
char *param, *value, *value2;
|
char *param, *value, *value2;
|
||||||
orte_app_context_t *app = NULL;
|
orte_app_context_t *app = NULL;
|
||||||
#if 0 /* Used only in the C/N notion case, remove to silence compiler warnings */
|
bool cmd_line_made = false;
|
||||||
orte_std_cntr_t l, len;
|
|
||||||
#endif
|
|
||||||
bool map_data = false, save_arg, cmd_line_made = false;
|
|
||||||
int new_argc = 0;
|
|
||||||
char **new_argv = NULL;
|
|
||||||
|
|
||||||
*made_app = false;
|
*made_app = false;
|
||||||
|
|
||||||
/* Pre-process the command line:
|
/* Pre-process the command line if we are going to parse an appfile later.
|
||||||
|
* save any mca command line args so they can be passed
|
||||||
- convert C, cX, N, nX arguments to "-rawmap <id> <arg>" so
|
* separately to the daemons.
|
||||||
that the parser can pick it up nicely.
|
* Use Case:
|
||||||
- convert -host to -rawmap <id> <arg>
|
* $ cat launch.appfile
|
||||||
- convert -arch to -rawmap <id> <arg>
|
* -np 1 -mca aaa bbb ./my-app -mca ccc ddd
|
||||||
|
* -np 1 -mca aaa bbb ./my-app -mca eee fff
|
||||||
Converting these to the same argument type will a) simplify the
|
* $ mpirun -np 2 -mca foo bar --app launch.appfile
|
||||||
logic down below, and b) allow us to preserve the ordering of
|
* Only pick up '-mca foo bar' on this pass.
|
||||||
these arguments as the user specified them on the command
|
|
||||||
line. */
|
|
||||||
|
|
||||||
for (i = 0; i < argc; ++i) {
|
|
||||||
map_data = false;
|
|
||||||
save_arg = true;
|
|
||||||
|
|
||||||
/* JJH To fix in the future
|
|
||||||
* Currently C/N notation is not supported so don't execute this check
|
|
||||||
* Bug: Make this context sensitive since it will not behave properly
|
|
||||||
* with the following argument set:
|
|
||||||
* $ orterun -np 2 -host c2,c3,c12 hostname
|
|
||||||
* Since it will see the hosts c2, c3, and c12 as C options instead
|
|
||||||
* of hostnames.
|
|
||||||
*/
|
*/
|
||||||
if(false) { ; } /* Wrapper to preserve logic continuation while the below
|
if (NULL != orterun_globals.appfile) {
|
||||||
is commented out */
|
for (i = 0; i < argc; ++i) {
|
||||||
#if 0
|
|
||||||
if (0 == strcmp(argv[i], "C") ||
|
|
||||||
0 == strcmp(argv[i], "N")) {
|
|
||||||
map_data = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Heuristic: if the string fits "[cn][0-9]+" or "[cn][0-9],",
|
|
||||||
then accept it as mapping data */
|
|
||||||
|
|
||||||
else if ('c' == argv[i][0] || 'n' == argv[i][0]) {
|
|
||||||
len = strlen(argv[i]);
|
|
||||||
if (len > 1) {
|
|
||||||
for (l = 1; l < len; ++l) {
|
|
||||||
if (',' == argv[i][l]) {
|
|
||||||
map_data = true;
|
|
||||||
break;
|
|
||||||
} else if (!isdigit(argv[i][l])) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (l >= len) {
|
|
||||||
map_data = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* JMS commented out because we don't handle this in any
|
|
||||||
mapper */
|
|
||||||
/* Save -arch args */
|
|
||||||
|
|
||||||
else if (0 == strcmp("-arch", argv[i])) {
|
|
||||||
char str[2] = { '0' + ORTE_APP_CONTEXT_MAP_ARCH, '\0' };
|
|
||||||
|
|
||||||
opal_argv_append(&new_argc, &new_argv, "-rawmap");
|
|
||||||
opal_argv_append(&new_argc, &new_argv, str);
|
|
||||||
save_arg = false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Save -hostfile args since they can be spec'd
|
|
||||||
* on a per-app_context basis
|
|
||||||
*/
|
|
||||||
else if (0 == strcmp("--hostfile",argv[i]) ||
|
|
||||||
0 == strcmp("-hostfile", argv[i]) ||
|
|
||||||
0 == strcmp("--machinefile", argv[i]) ||
|
|
||||||
0 == strcmp("-machinefile", argv[i])) {
|
|
||||||
opal_argv_append(&new_argc, &new_argv, "-rawhosts");
|
|
||||||
save_arg = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Save -host args */
|
|
||||||
else if (0 == strcmp("--host",argv[i]) ||
|
|
||||||
0 == strcmp("-host", argv[i]) ||
|
|
||||||
0 == strcmp("-H", argv[i])) {
|
|
||||||
char str[2] = { '0' + ORTE_APP_CONTEXT_MAP_HOSTNAME, '\0' };
|
|
||||||
opal_argv_append(&new_argc, &new_argv, "-rawmap");
|
|
||||||
opal_argv_append(&new_argc, &new_argv, str);
|
|
||||||
save_arg = false;
|
|
||||||
}
|
|
||||||
/* save any mca command line args so they can be passed
|
|
||||||
* separately to the daemons.
|
|
||||||
* Only do so here if we are going to parse an appfile later.
|
|
||||||
* Use Case:
|
|
||||||
* $ cat launch.appfile
|
|
||||||
* -np 1 -mca aaa bbb ./my-app -mca ccc ddd
|
|
||||||
* -np 1 -mca aaa bbb ./my-app -mca eee fff
|
|
||||||
* $ mpirun -np 2 -mca foo bar --app launch.appfile
|
|
||||||
* Only pick up '-mca foo bar' on this pass.
|
|
||||||
*/
|
|
||||||
if (NULL != orterun_globals.appfile) {
|
|
||||||
if (0 == strcmp("-mca", argv[i]) ||
|
if (0 == strcmp("-mca", argv[i]) ||
|
||||||
0 == strcmp("--mca", argv[i]) ) {
|
0 == strcmp("--mca", argv[i]) ) {
|
||||||
opal_argv_append_nosize(&orted_cmd_line, argv[i]);
|
opal_argv_append_nosize(&orted_cmd_line, argv[i]);
|
||||||
@ -1426,36 +1331,14 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
|
|||||||
opal_argv_append_nosize(&orted_cmd_line, argv[i+2]);
|
opal_argv_append_nosize(&orted_cmd_line, argv[i+2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this token was C/N map data, save it */
|
|
||||||
|
|
||||||
if (map_data) {
|
|
||||||
char str[2] = { '0' + ORTE_APP_CONTEXT_MAP_CN, '\0' };
|
|
||||||
|
|
||||||
opal_argv_append(&new_argc, &new_argv, "-rawmap");
|
|
||||||
opal_argv_append(&new_argc, &new_argv, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (save_arg) {
|
|
||||||
opal_argv_append(&new_argc, &new_argv, argv[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
/* Parse application command line options. */
|
||||||
/* Parse application command line options. Add the -rawmap option
|
|
||||||
separately so that the user doesn't see it in the --help
|
|
||||||
message. Ditto for the -rawhosts option */
|
|
||||||
|
|
||||||
init_globals();
|
init_globals();
|
||||||
opal_cmd_line_create(&cmd_line, cmd_line_init);
|
opal_cmd_line_create(&cmd_line, cmd_line_init);
|
||||||
mca_base_cmd_line_setup(&cmd_line);
|
mca_base_cmd_line_setup(&cmd_line);
|
||||||
cmd_line_made = true;
|
cmd_line_made = true;
|
||||||
opal_cmd_line_make_opt3(&cmd_line, '\0', NULL, "rawmap", 2,
|
rc = opal_cmd_line_parse(&cmd_line, true, argc, argv);
|
||||||
"Hidden / internal parameter -- users should not use this!");
|
|
||||||
opal_cmd_line_make_opt3(&cmd_line, '\0', NULL, "rawhosts", 1, /* only one arg */
|
|
||||||
"Hidden / internal parameter -- users should not use this!");
|
|
||||||
rc = opal_cmd_line_parse(&cmd_line, true, new_argc, new_argv);
|
|
||||||
opal_argv_free(new_argv);
|
|
||||||
new_argv = NULL;
|
|
||||||
if (ORTE_SUCCESS != rc) {
|
if (ORTE_SUCCESS != rc) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1483,16 +1366,13 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine the application name, and location in the argv so we do not
|
* Get mca parameters so we can pass them to the daemons.
|
||||||
* accidentally pick of the application's arguments while trying to get
|
* Use the count determined above to make sure we do not go past
|
||||||
* our own. Example:
|
* the executable name. Example:
|
||||||
* mpirun -np 2 -mca foo bar ./my-app -mca bip bop
|
* mpirun -np 2 -mca foo bar ./my-app -mca bip bop
|
||||||
* We want to pick up '-mca foo bar' but not '-mca bip bop'
|
* We want to pick up '-mca foo bar' but not '-mca bip bop'
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < (argc - count); ++i) {
|
for (i = 0; i < (argc - count); ++i) {
|
||||||
/* save any mca command line args so they can be passed
|
|
||||||
* separately to the daemons
|
|
||||||
*/
|
|
||||||
if (0 == strcmp("-mca", argv[i]) ||
|
if (0 == strcmp("-mca", argv[i]) ||
|
||||||
0 == strcmp("--mca", argv[i]) ) {
|
0 == strcmp("--mca", argv[i]) ) {
|
||||||
opal_argv_append_nosize(&orted_cmd_line, argv[i]);
|
opal_argv_append_nosize(&orted_cmd_line, argv[i]);
|
||||||
@ -1639,42 +1519,36 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Did the user specify a hostname? This would have been converted
|
/* Did the user specify a hostfile. Need to check for both
|
||||||
* to --rawhost above
|
* hostfile and machine file.
|
||||||
|
* We can only deal with one hostfile per app context, otherwise give an error.
|
||||||
*/
|
*/
|
||||||
if (opal_cmd_line_is_taken(&cmd_line, "rawhosts")) {
|
if (0 < (j = opal_cmd_line_get_ninsts(&cmd_line, "hostfile"))) {
|
||||||
value = opal_cmd_line_get_param(&cmd_line, "rawhosts", 0, 0);
|
if(1 < j) {
|
||||||
app->hostfile = strdup(value);
|
opal_show_help("help-orterun.txt", "orterun:multiple-hostfiles",
|
||||||
|
true, orterun_basename, NULL);
|
||||||
|
return ORTE_ERR_FATAL;
|
||||||
|
} else {
|
||||||
|
value = opal_cmd_line_get_param(&cmd_line, "hostfile", 0, 0);
|
||||||
|
app->hostfile = strdup(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (0 < (j = opal_cmd_line_get_ninsts(&cmd_line, "machinefile"))) {
|
||||||
/* Did the user request any mappings? They were all converted to
|
if(1 < j || NULL != app->hostfile) {
|
||||||
--rawmap items, above. */
|
opal_show_help("help-orterun.txt", "orterun:multiple-hostfiles",
|
||||||
|
true, orterun_basename, NULL);
|
||||||
if (opal_cmd_line_is_taken(&cmd_line, "rawmap")) {
|
return ORTE_ERR_FATAL;
|
||||||
j = opal_cmd_line_get_ninsts(&cmd_line, "rawmap");
|
} else {
|
||||||
app->map_data = (orte_app_context_map_t**)malloc(sizeof(orte_app_context_map_t*) * j);
|
value = opal_cmd_line_get_param(&cmd_line, "machinefile", 0, 0);
|
||||||
if (NULL == app->map_data) {
|
app->hostfile = strdup(value);
|
||||||
rc = ORTE_ERR_OUT_OF_RESOURCE;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
app->num_map = j;
|
}
|
||||||
|
|
||||||
|
/* Did the user specify any hosts? */
|
||||||
|
if (0 < (j = opal_cmd_line_get_ninsts(&cmd_line, "host"))) {
|
||||||
for (i = 0; i < j; ++i) {
|
for (i = 0; i < j; ++i) {
|
||||||
app->map_data[i] = NULL;
|
value = opal_cmd_line_get_param(&cmd_line, "host", i, 0);
|
||||||
}
|
opal_argv_append_nosize(&app->dash_host, value);
|
||||||
for (i = 0; i < j; ++i) {
|
|
||||||
value = opal_cmd_line_get_param(&cmd_line, "rawmap", i, 0);
|
|
||||||
value2 = opal_cmd_line_get_param(&cmd_line, "rawmap", i, 1);
|
|
||||||
app->map_data[i] = OBJ_NEW(orte_app_context_map_t);
|
|
||||||
if (NULL == app->map_data[i]) {
|
|
||||||
rc = ORTE_ERR_OUT_OF_RESOURCE;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
app->map_data[i]->map_type = value[0] - '0';
|
|
||||||
app->map_data[i]->map_data = strdup(value2);
|
|
||||||
/* map_data = true;
|
|
||||||
* JJH - This activates the C/N mapping stuff,
|
|
||||||
* or at least allows us to pass the 'num_procs' check below.
|
|
||||||
* since it is not implemented yet, leave commented. */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1744,9 +1618,6 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
|
|||||||
if (NULL != app) {
|
if (NULL != app) {
|
||||||
OBJ_RELEASE(app);
|
OBJ_RELEASE(app);
|
||||||
}
|
}
|
||||||
if (NULL != new_argv) {
|
|
||||||
opal_argv_free(new_argv);
|
|
||||||
}
|
|
||||||
if (cmd_line_made) {
|
if (cmd_line_made) {
|
||||||
OBJ_DESTRUCT(&cmd_line);
|
OBJ_DESTRUCT(&cmd_line);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,6 @@ struct globals_t {
|
|||||||
bool do_not_launch;
|
bool do_not_launch;
|
||||||
bool debugger;
|
bool debugger;
|
||||||
int num_procs;
|
int num_procs;
|
||||||
char *hostfile;
|
|
||||||
char *env_val;
|
char *env_val;
|
||||||
char *appfile;
|
char *appfile;
|
||||||
char *wdir;
|
char *wdir;
|
||||||
|
@ -37,8 +37,7 @@
|
|||||||
|
|
||||||
int orte_util_add_dash_host_nodes(opal_list_t *nodes,
|
int orte_util_add_dash_host_nodes(opal_list_t *nodes,
|
||||||
bool *override_oversubscribed,
|
bool *override_oversubscribed,
|
||||||
orte_std_cntr_t num_map,
|
char ** host_argv)
|
||||||
orte_app_context_map_t **map)
|
|
||||||
{
|
{
|
||||||
opal_list_item_t* item;
|
opal_list_item_t* item;
|
||||||
orte_std_cntr_t i, j, k;
|
orte_std_cntr_t i, j, k;
|
||||||
@ -47,21 +46,20 @@ int orte_util_add_dash_host_nodes(opal_list_t *nodes,
|
|||||||
orte_node_t *node;
|
orte_node_t *node;
|
||||||
|
|
||||||
/* Accumulate all of the host name mappings */
|
/* Accumulate all of the host name mappings */
|
||||||
for (j = 0; j < num_map; ++j) {
|
for (j = 0; j < opal_argv_count(host_argv); ++j) {
|
||||||
if (ORTE_APP_CONTEXT_MAP_HOSTNAME == map[j]->map_type) {
|
mini_map = opal_argv_split(host_argv[j], ',');
|
||||||
mini_map = opal_argv_split(map[j]->map_data, ',');
|
|
||||||
|
if (mapped_nodes == NULL) {
|
||||||
if (mapped_nodes == NULL) {
|
mapped_nodes = mini_map;
|
||||||
mapped_nodes = mini_map;
|
} else {
|
||||||
} else {
|
for (k = 0; NULL != mini_map[k]; ++k) {
|
||||||
for (k = 0; NULL != mini_map[k]; ++k) {
|
rc = opal_argv_append_nosize(&mapped_nodes,
|
||||||
rc = opal_argv_append_nosize(&mapped_nodes,
|
mini_map[k]);
|
||||||
mini_map[k]);
|
if (OPAL_SUCCESS != rc) {
|
||||||
if (OPAL_SUCCESS != rc) {
|
goto cleanup;
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
opal_argv_free(mini_map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,8 +130,7 @@ cleanup:
|
|||||||
|
|
||||||
|
|
||||||
int orte_util_filter_dash_host_nodes(opal_list_t *nodes,
|
int orte_util_filter_dash_host_nodes(opal_list_t *nodes,
|
||||||
orte_std_cntr_t num_map,
|
char** host_argv)
|
||||||
orte_app_context_map_t **map)
|
|
||||||
{
|
{
|
||||||
opal_list_item_t* item;
|
opal_list_item_t* item;
|
||||||
bool found;
|
bool found;
|
||||||
@ -152,21 +149,20 @@ int orte_util_filter_dash_host_nodes(opal_list_t *nodes,
|
|||||||
|
|
||||||
|
|
||||||
/* Accumulate all of the host name mappings */
|
/* Accumulate all of the host name mappings */
|
||||||
for (j = 0; j < num_map; ++j) {
|
for (j = 0; j < opal_argv_count(host_argv); ++j) {
|
||||||
if (ORTE_APP_CONTEXT_MAP_HOSTNAME == map[j]->map_type) {
|
mini_map = opal_argv_split(host_argv[j], ',');
|
||||||
mini_map = opal_argv_split(map[j]->map_data, ',');
|
|
||||||
|
if (mapped_nodes == NULL) {
|
||||||
if (mapped_nodes == NULL) {
|
mapped_nodes = mini_map;
|
||||||
mapped_nodes = mini_map;
|
} else {
|
||||||
} else {
|
for (k = 0; NULL != mini_map[k]; ++k) {
|
||||||
for (k = 0; NULL != mini_map[k]; ++k) {
|
rc = opal_argv_append_nosize(&mapped_nodes,
|
||||||
rc = opal_argv_append_nosize(&mapped_nodes,
|
mini_map[k]);
|
||||||
mini_map[k]);
|
if (OPAL_SUCCESS != rc) {
|
||||||
if (OPAL_SUCCESS != rc) {
|
goto cleanup;
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
opal_argv_free(mini_map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,12 +33,10 @@ BEGIN_C_DECLS
|
|||||||
|
|
||||||
ORTE_DECLSPEC int orte_util_add_dash_host_nodes(opal_list_t *nodes,
|
ORTE_DECLSPEC int orte_util_add_dash_host_nodes(opal_list_t *nodes,
|
||||||
bool *override_oversubscribed,
|
bool *override_oversubscribed,
|
||||||
orte_std_cntr_t num_map,
|
char ** host_argv);
|
||||||
orte_app_context_map_t **map_data);
|
|
||||||
|
|
||||||
ORTE_DECLSPEC int orte_util_filter_dash_host_nodes(opal_list_t *nodes,
|
ORTE_DECLSPEC int orte_util_filter_dash_host_nodes(opal_list_t *nodes,
|
||||||
orte_std_cntr_t num_map,
|
char ** host_argv);
|
||||||
orte_app_context_map_t **map_data);
|
|
||||||
|
|
||||||
END_C_DECLS
|
END_C_DECLS
|
||||||
|
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user