1
1

Added Bi-Directional connection in the carto file.

This commit was SVN r17393.
Этот коммит содержится в:
Sharon Melamed 2008-02-07 09:51:19 +00:00
родитель c9f80caf7c
Коммит 51f8308c68
4 изменённых файлов: 92 добавлений и 20 удалений

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

@ -19,15 +19,7 @@
*/
/**
* @file
*
* The file component uses a cartograpy file to discover the
* host cartography.
*
* An example cartography file:
*
# This is a comment
* @file#this is a comment
# Node declaration Node type (Free string) Node name (Free string)
# (Reserve word) (slot is a reserve word (free string)
# for CPU slot)
@ -54,22 +46,34 @@
# above) above) above)
#===============================================================================================
CONNECTION mem0 slot0:0
CONNECTION mem1 slot1:0
CONNECTION mem2 slot2:0
CONNECTION mem3 slot3:0
#
CONNECTION slot0 mem0:0 slot1:1 slot2:1 mthca0:1 eth0:1
CONNECTION slot1 mem1:0 slot0:1 slot3:1
CONNECTION slot2 mem2:0 slot1:1 slot3:1
CONNECTION slot1 slot0:1 slot3:1
CONNECTION slot2 slot1:1 slot3:1
CONNECTION slot3 mem3:0 slot1:1 slot2:1 mthca1:1 eth1:1
#
#
CONNECTION mthca0 slot0:1
CONNECTION mthca1 slot3:1
#
CONNECTION eth0 slot0:1
CONNECTION eth1 slot3:1
#Bi-Directional connection
#
CON_BI_DIR slot1 mem1:0
CON_BI_DIR slot2 mem2:0
#
# end of carto file.
*
* The file component uses a cartograpy file to discover the
* host cartography.
*
* An example cartography file:
*
*
*
*

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

@ -59,9 +59,10 @@ extern orte_rds_value_t carto_file_value;
#define OPAL_CARTO_FILE_ERROR 1
#define OPAL_CARTO_FILE_NODE_DECELERATION 2
#define OPAL_CARTO_FILE_CONNECTION_DECELERATION 3
#define OPAL_CARTO_FILE_INT 4
#define OPAL_CARTO_FILE_NAME 5
#define OPAL_CARTO_FILE_NODE_CONNECTION 6
#define OPAL_CARTO_FILE_BIDIRECTION_CONNECTION 4
#define OPAL_CARTO_FILE_INT 5
#define OPAL_CARTO_FILE_NAME 6
#define OPAL_CARTO_FILE_NODE_CONNECTION 7
#endif

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

@ -86,6 +86,9 @@ NODE { carto_file_value.sval = yytext;
CONNECTION { carto_file_value.sval = yytext;
return OPAL_CARTO_FILE_CONNECTION_DECELERATION; }
CON_BI_DIR { carto_file_value.sval = yytext;
return OPAL_CARTO_FILE_BIDIRECTION_CONNECTION; }
[0-9] { carto_file_value.ival = atol(yytext);
return OPAL_CARTO_FILE_INT; }

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

@ -137,10 +137,13 @@ static int opal_carto_file_parse(const char *cartofile)
"File-error",
"Node deceleration",
"Connection deceleration",
"bi directional connection",
"Integer",
"Name",
"Node connection",
"Undefined"
"Undefined"
"Undefined"
};
/* set the done flag to false. at the end of file the the lexical analyzer will set it to true */
@ -248,6 +251,67 @@ static int opal_carto_file_parse(const char *cartofile)
goto error;
}
break;
case OPAL_CARTO_FILE_BIDIRECTION_CONNECTION:
token = carto_file_lex();
switch (token) {
case OPAL_CARTO_FILE_NAME:
node1_name = strdup(carto_file_value.sval);
while (OPAL_CARTO_FILE_NEWLINE != token) {
token = carto_file_lex();
switch (token) {
case OPAL_CARTO_FILE_NODE_CONNECTION:
value = carto_file_value.sval;
argv = opal_argv_split (value, ':');
cnt = opal_argv_count (argv);
if (2 == cnt) {
node2_name = strdup(argv[0]);
weight = atoi(argv[1]);
} else {
opal_show_help("help-opal-carto-file.txt", "incorrect connection", true, cartofile, line_number, value);
opal_argv_free (argv);
free(node1_name);
free(node2_name);
goto error;
}
opal_argv_free (argv);
/* find the start node of the connection */
node = opal_carto_base_graph_find_node(carto_base_common_host_graph,node1_name);
if (NULL == node) {
opal_show_help("help-opal-carto-file.txt", "vertex not found", true, cartofile, line_number, node1_name);
free(node1_name);
free(node2_name);
goto error;
}
/* find the end node of the connection */
end_node = opal_carto_base_graph_find_node(carto_base_common_host_graph,node2_name);
if (NULL == end_node) {
opal_show_help("help-opal-carto-file.txt", "vertex not found", true, cartofile, line_number, node2_name);
free(node1_name);
free(node2_name);
goto error;
}
opal_carto_base_connect_nodes(carto_base_common_host_graph, node, end_node, weight);
opal_carto_base_connect_nodes(carto_base_common_host_graph, end_node, node, weight);
free(node2_name);
break;
case OPAL_CARTO_FILE_NEWLINE:
line_number++;
break;
default:
opal_show_help("help-opal-carto-file.txt", "expected Connection",
true, cartofile, line_number, token_to_string[token]);
free(node1_name);
goto error;
}
}
free(node1_name);
break;
default:
opal_show_help("help-opal-carto-file.txt", "expected node name",
true, cartofile, line_number, token_to_string[token]);
goto error;
}
break;
default:
opal_show_help("help-opal-carto-file.txt", "expected deceleration",
true, cartofile, line_number, token_to_string[token]);