1
1

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
Этот коммит содержится в:
Tim Prins 2008-03-05 22:12:27 +00:00
родитель ef8f807c1c
Коммит f9916811ae
19 изменённых файлов: 132 добавлений и 540 удалений

Просмотреть файл

@ -591,11 +591,7 @@ static int spawn(int count, char **array_of_commands,
/* check for 'host' */
ompi_info_get (array_of_info[i], "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_HOSTNAME;
app->map_data[0]->map_data = strdup(host);
opal_argv_append_nosize(&app->dash_host, host);
}
/* check for 'hostfile' */
@ -604,23 +600,13 @@ static int spawn(int count, char **array_of_commands,
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' */
ompi_info_get (array_of_info[i], "add-hostfile", sizeof(host), host, &flag);
if ( flag ) {
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
* 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 */
/* Resource types */
#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 + 12) /**< describes capabilities of nodes */
#define ORTE_SLOT_DESC (OPAL_DSS_ID_DYNAMIC + 13) /**< describes slot allocations/reservations */
#define ORTE_JOB (OPAL_DSS_ID_DYNAMIC + 14) /**< job information */
#define ORTE_NODE (OPAL_DSS_ID_DYNAMIC + 15) /**< node information */
#define ORTE_PROC (OPAL_DSS_ID_DYNAMIC + 16) /**< process information */
#define ORTE_JOB_MAP (OPAL_DSS_ID_DYNAMIC + 17) /**< map of process locations */
#define ORTE_NODE_DESC (OPAL_DSS_ID_DYNAMIC + 11) /**< describes capabilities of nodes */
#define ORTE_SLOT_DESC (OPAL_DSS_ID_DYNAMIC + 12) /**< describes slot allocations/reservations */
#define ORTE_JOB (OPAL_DSS_ID_DYNAMIC + 13) /**< job information */
#define ORTE_NODE (OPAL_DSS_ID_DYNAMIC + 14) /**< node information */
#define ORTE_PROC (OPAL_DSS_ID_DYNAMIC + 15) /**< process information */
#define ORTE_JOB_MAP (OPAL_DSS_ID_DYNAMIC + 16) /**< map of process locations */
/* 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 */
#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 */
#define ORTE_GRPCOMM_MODE (OPAL_DSS_ID_DYNAMIC + 20)
#define ORTE_GRPCOMM_MODE (OPAL_DSS_ID_DYNAMIC + 19)
#endif

Просмотреть файл

@ -220,8 +220,7 @@ int orte_ras_base_allocate(orte_job_t *jdata)
if (0 < apps[i]->num_map) {
if (ORTE_SUCCESS != (rc = orte_util_add_dash_host_nodes(&nodes,
&override_oversubscribed,
apps[i]->num_map,
apps[i]->map_data))) {
apps[i]->dash_host))) {
ORTE_ERROR_LOG(rc);
OBJ_DESTRUCT(&nodes);
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 */
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);
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! */
if (0 == opal_list_get_size(allocated_nodes)) {
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;
}

Просмотреть файл

@ -157,18 +157,6 @@ int orte_dt_compare_app_context(orte_app_context_t *value1, orte_app_context_t *
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
*/

Просмотреть файл

@ -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 rc;
orte_std_cntr_t i;
/* create the new object */
*dest = OBJ_NEW(orte_app_context_t);
if (NULL == *dest) {
@ -314,20 +311,7 @@ int orte_dt_copy_app_context(orte_app_context_t **dest, orte_app_context_t *src,
else
(*dest)->preload_files_dest_dir = NULL;
if (0 < src->num_map) {
(*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;
}
}
}
(*dest)->dash_host = opal_argv_copy(src->dash_host);
if (NULL != 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;
}
/*
* 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)
{
orte_proc_state_t *ps;

Просмотреть файл

@ -559,16 +559,17 @@ int orte_dt_pack_app_context(opal_buffer_t *buffer, const void *src,
return rc;
}
/* Pack the map data */
if (ORTE_SUCCESS != (rc = opal_dss.pack_buffer(buffer,
(void*)(&(app_context[i]->num_map)), 1, ORTE_STD_CNTR))) {
/* pack the dash host argv array */
count = opal_argv_count(app_context[i]->dash_host);
if (ORTE_SUCCESS != (rc = opal_dss.pack_buffer(buffer, (void*)(&count), 1, ORTE_STD_CNTR))) {
ORTE_ERROR_LOG(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,
(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);
return rc;
}
@ -651,34 +652,6 @@ int orte_dt_pack_app_context(opal_buffer_t *buffer, const void *src,
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
*/

Просмотреть файл

@ -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)
{
char *tmp, *tmp2, *tmp3, *pfx, *pfx2;
int32_t j;
int i, rc, count;
char *tmp, *tmp2, *pfx2;
int i, count;
/* set default result */
*output = NULL;
@ -414,24 +413,17 @@ int orte_dt_print_app_context(char **output, char *prefix, orte_app_context_t *s
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,
(NULL == src->add_hostfile) ? "NULL" : src->add_hostfile,
(unsigned long)src->num_map);
(NULL == src->add_hostfile) ? "NULL" : src->add_hostfile);
free(tmp);
tmp = tmp2;
asprintf(&pfx, "%s\t", pfx2);
for (j = 0; j < src->num_map; ++j) {
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);
count = opal_argv_count(src->dash_host);
for (i=0; i < count; i++) {
asprintf(&tmp2, "%s\n%s\tDash_host[%lu]: %s", tmp, pfx2, (unsigned long)i, src->dash_host[i]);
free(tmp);
free(tmp2);
tmp = tmp3;
tmp = tmp2;
}
/* 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;
}
/*
* 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
*/

Просмотреть файл

@ -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 j, rc, count;
int32_t i;
size_t map_size;
/* account for the object itself */
*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);
}
count = opal_argv_count(src->argv);
if (0 < count) {
/* account for array of char* */
*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 */
*size += opal_argv_len(src->argv);
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 */
*size += opal_argv_len(src->env);
if (NULL != src->cwd) {
*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 */
}
if (0 < src->num_map) {
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;
}
}
}
*size += opal_argv_len(src->dash_host);
if (NULL != 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;
}
/*
* 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
*/

Просмотреть файл

@ -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_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_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,
orte_exit_code_t *value2,
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_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_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_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);
@ -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);
int orte_dt_pack_app_context(opal_buffer_t *buffer, const void *src,
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,
int32_t num_vals, opal_data_type_t type);
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_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_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);
/** 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_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_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);
/** 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);
int orte_dt_unpack_app_context(opal_buffer_t *buffer, void *dest,
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,
int32_t *num_vals, opal_data_type_t type);
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;
}
/* unpack the map data */
max_n=1;
if (ORTE_SUCCESS != (rc = opal_dss.unpack_buffer(buffer, &(app_context[i]->num_map),
&max_n, ORTE_STD_CNTR))) {
/* get the number of dash_host strings that were packed */
max_n = 1;
if (ORTE_SUCCESS != (rc = opal_dss.unpack_buffer(buffer, &count, &max_n, ORTE_STD_CNTR))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (app_context[i]->num_map > 0) {
app_context[i]->map_data = (orte_app_context_map_t**)malloc(sizeof(orte_app_context_map_t*) * app_context[i]->num_map);
if (NULL == app_context[i]->map_data) {
/* if there are dash_host strings, allocate the required space for the char * pointers */
if (0 < count) {
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);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (rc = opal_dss.unpack_buffer(buffer, app_context[i]->map_data,
&(app_context[i]->num_map), ORTE_APP_CONTEXT_MAP))) {
app_context[i]->dash_host[count] = NULL;
/* 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);
return rc;
}
@ -711,45 +714,6 @@ int orte_dt_unpack_app_context(opal_buffer_t *buffer, void *dest,
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
*/

Просмотреть файл

@ -277,20 +277,6 @@ int orte_dt_init(void)
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;
if (ORTE_SUCCESS != (rc = opal_dss.register_type(orte_dt_pack_node_state,
orte_dt_unpack_node_state,

Просмотреть файл

@ -60,36 +60,6 @@ BEGIN_C_DECLS
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.
*/
@ -116,11 +86,9 @@ typedef struct {
char *add_hostfile;
/** Length of the map_data array, not including the final NULL entry */
orte_std_cntr_t num_map;
/** Mapping data about how this app should be laid out across CPUs
/ nodes */
orte_app_context_map_t **map_data;
/** Prefix directory for this app (or NULL if no override
necessary) */
/** argv of hosts passed in to -host */
char ** dash_host;
/** Prefix directory for this app (or NULL if no override necessary) */
char *prefix_dir;
/** Preload the binary on the remote machine (in PLS via FileM) */
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->hostfile=NULL;
app_context->add_hostfile=NULL;
app_context->num_map = 0;
app_context->map_data = NULL;
app_context->dash_host = NULL;
app_context->prefix_dir = NULL;
app_context->preload_binary = false;
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)
{
orte_std_cntr_t i;
if (NULL != 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);
}
if (NULL != app_context->map_data) {
for (i = 0; i < app_context->num_map; ++i) {
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->dash_host) {
opal_argv_free(app_context->dash_host);
}
if (NULL != app_context->prefix_dir) {
@ -117,26 +107,6 @@ OBJ_CLASS_INSTANCE(orte_app_context_t,
orte_app_context_construct,
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)
{
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
best be generated by simply directing the ompi-server to put its
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 */
if (!globals_init) {
OBJ_CONSTRUCT(&orterun_globals.lock, opal_mutex_t);
orterun_globals.hostfile = NULL;
orterun_globals.env_val = NULL;
orterun_globals.appfile = NULL;
orterun_globals.wdir = NULL;
@ -988,9 +987,6 @@ static int init_globals(void)
orterun_globals.by_slot = false;
orterun_globals.debugger = false;
orterun_globals.num_procs = 0;
if( NULL != orterun_globals.hostfile )
free( orterun_globals.hostfile );
orterun_globals.hostfile = NULL;
if( NULL != orterun_globals.env_val )
free( orterun_globals.env_val );
orterun_globals.env_val = NULL;
@ -1312,105 +1308,13 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
int i, j, count, rc;
char *param, *value, *value2;
orte_app_context_t *app = NULL;
#if 0 /* Used only in the C/N notion case, remove to silence compiler warnings */
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;
bool cmd_line_made = false;
*made_app = false;
/* Pre-process the command line:
- convert C, cX, N, nX arguments to "-rawmap <id> <arg>" so
that the parser can pick it up nicely.
- convert -host to -rawmap <id> <arg>
- convert -arch to -rawmap <id> <arg>
Converting these to the same argument type will a) simplify the
logic down below, and b) allow us to preserve the ordering of
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
is commented out */
#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
/* 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
* 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
@ -1419,6 +1323,7 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
* Only pick up '-mca foo bar' on this pass.
*/
if (NULL != orterun_globals.appfile) {
for (i = 0; i < argc; ++i) {
if (0 == strcmp("-mca", argv[i]) ||
0 == strcmp("--mca", 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]);
}
}
/* 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. Add the -rawmap option
separately so that the user doesn't see it in the --help
message. Ditto for the -rawhosts option */
/* Parse application command line options. */
init_globals();
opal_cmd_line_create(&cmd_line, cmd_line_init);
mca_base_cmd_line_setup(&cmd_line);
cmd_line_made = true;
opal_cmd_line_make_opt3(&cmd_line, '\0', NULL, "rawmap", 2,
"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;
rc = opal_cmd_line_parse(&cmd_line, true, argc, argv);
if (ORTE_SUCCESS != rc) {
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
* accidentally pick of the application's arguments while trying to get
* our own. Example:
* Get mca parameters so we can pass them to the daemons.
* Use the count determined above to make sure we do not go past
* the executable name. Example:
* mpirun -np 2 -mca foo bar ./my-app -mca bip bop
* We want to pick up '-mca foo bar' but not '-mca bip bop'
*/
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]) ||
0 == strcmp("--mca", 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
* to --rawhost above
/* Did the user specify a hostfile. Need to check for both
* 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")) {
value = opal_cmd_line_get_param(&cmd_line, "rawhosts", 0, 0);
if (0 < (j = opal_cmd_line_get_ninsts(&cmd_line, "hostfile"))) {
if(1 < j) {
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"))) {
if(1 < j || NULL != app->hostfile) {
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, "machinefile", 0, 0);
app->hostfile = strdup(value);
}
}
/* Did the user request any mappings? They were all converted to
--rawmap items, above. */
if (opal_cmd_line_is_taken(&cmd_line, "rawmap")) {
j = opal_cmd_line_get_ninsts(&cmd_line, "rawmap");
app->map_data = (orte_app_context_map_t**)malloc(sizeof(orte_app_context_map_t*) * j);
if (NULL == app->map_data) {
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) {
app->map_data[i] = NULL;
}
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. */
value = opal_cmd_line_get_param(&cmd_line, "host", i, 0);
opal_argv_append_nosize(&app->dash_host, value);
}
}
@ -1744,9 +1618,6 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
if (NULL != app) {
OBJ_RELEASE(app);
}
if (NULL != new_argv) {
opal_argv_free(new_argv);
}
if (cmd_line_made) {
OBJ_DESTRUCT(&cmd_line);
}

Просмотреть файл

@ -49,7 +49,6 @@ struct globals_t {
bool do_not_launch;
bool debugger;
int num_procs;
char *hostfile;
char *env_val;
char *appfile;
char *wdir;

Просмотреть файл

@ -37,8 +37,7 @@
int orte_util_add_dash_host_nodes(opal_list_t *nodes,
bool *override_oversubscribed,
orte_std_cntr_t num_map,
orte_app_context_map_t **map)
char ** host_argv)
{
opal_list_item_t* item;
orte_std_cntr_t i, j, k;
@ -47,9 +46,8 @@ int orte_util_add_dash_host_nodes(opal_list_t *nodes,
orte_node_t *node;
/* Accumulate all of the host name mappings */
for (j = 0; j < num_map; ++j) {
if (ORTE_APP_CONTEXT_MAP_HOSTNAME == map[j]->map_type) {
mini_map = opal_argv_split(map[j]->map_data, ',');
for (j = 0; j < opal_argv_count(host_argv); ++j) {
mini_map = opal_argv_split(host_argv[j], ',');
if (mapped_nodes == NULL) {
mapped_nodes = mini_map;
@ -61,7 +59,7 @@ int orte_util_add_dash_host_nodes(opal_list_t *nodes,
goto cleanup;
}
}
}
opal_argv_free(mini_map);
}
}
@ -132,8 +130,7 @@ cleanup:
int orte_util_filter_dash_host_nodes(opal_list_t *nodes,
orte_std_cntr_t num_map,
orte_app_context_map_t **map)
char** host_argv)
{
opal_list_item_t* item;
bool found;
@ -152,9 +149,8 @@ int orte_util_filter_dash_host_nodes(opal_list_t *nodes,
/* Accumulate all of the host name mappings */
for (j = 0; j < num_map; ++j) {
if (ORTE_APP_CONTEXT_MAP_HOSTNAME == map[j]->map_type) {
mini_map = opal_argv_split(map[j]->map_data, ',');
for (j = 0; j < opal_argv_count(host_argv); ++j) {
mini_map = opal_argv_split(host_argv[j], ',');
if (mapped_nodes == NULL) {
mapped_nodes = mini_map;
@ -166,7 +162,7 @@ int orte_util_filter_dash_host_nodes(opal_list_t *nodes,
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,
bool *override_oversubscribed,
orte_std_cntr_t num_map,
orte_app_context_map_t **map_data);
char ** host_argv);
ORTE_DECLSPEC int orte_util_filter_dash_host_nodes(opal_list_t *nodes,
orte_std_cntr_t num_map,
orte_app_context_map_t **map_data);
char ** host_argv);
END_C_DECLS