Commit d9ae517e authored by Jonathan Jenkins's avatar Jonathan Jenkins

modified when lpconf is initialized + slight refactor

parent 9ee2d600
......@@ -38,7 +38,7 @@ typedef struct config_anno_map_s
char lp_name[CONFIGURATION_MAX_NAME];
// only explicit annotations tracked here - use a flag to indicate a
// non-annotated LP type
uint64_t num_unanno_lps;
int has_unanno_lp;
uint64_t num_annos;
// maintain the number of lps that have the particular annotation
uint64_t num_anno_lps[CONFIGURATION_MAX_ANNOS];
......@@ -223,6 +223,8 @@ int configuration_get_annotation_index(const char * anno,
*/
extern ConfigHandle config;
extern config_lpgroups_t lpconf;
#endif
/*
......
......@@ -63,8 +63,6 @@ static int strcmp_anno(
static char local_lp_name[MAX_NAME_LENGTH],
local_annotation[MAX_NAME_LENGTH];
config_lpgroups_t lpconf;
int codes_mapping_get_lps_for_pe()
{
int rank;
......@@ -445,8 +443,6 @@ void codes_mapping_setup()
int grp, lpt, message_size;
int pes = tw_nnodes();
configuration_get_lpgroups(&config, "LPGROUPS", &lpconf);
for (grp = 0; grp < lpconf.lpgroups_count; grp++)
{
for (lpt = 0; lpt < lpconf.lpgroups[grp].lptypes_count; lpt++)
......
......@@ -17,6 +17,9 @@
*/
ConfigHandle config;
/* Global to hold LP configuration */
config_lpgroups_t lpconf;
int configuration_load (const char *filepath,
MPI_Comm comm,
ConfigHandle *handle)
......@@ -71,6 +74,9 @@ int configuration_load (const char *filepath,
(*handle)->config_dir = strdup(dirname(tmp_path));
free(tmp_path);
if (rc == 0)
configuration_get_lpgroups(handle, "LPGROUPS", &lpconf);
return rc;
}
......@@ -267,7 +273,7 @@ static void check_add_anno(
const char *anno,
config_anno_map_t *map){
if (anno[0] == '\0'){
map->num_unanno_lps++;
map->has_unanno_lp = 1;
}
else{
uint64_t a = 0;
......@@ -304,7 +310,7 @@ static void check_add_lp_type_anno(
// initialize this annotation map
strcpy(map->lp_name, lp_name);
map->num_annos = 0;
map->num_unanno_lps = 0;
map->has_unanno_lp = 0;
memset(map->num_anno_lps, 0,
CONFIGURATION_MAX_ANNOS*sizeof(*map->num_anno_lps));
check_add_anno(anno, map);
......
......@@ -778,7 +778,7 @@ void lsm_configure(void)
models_anno = malloc(anno_map->num_annos * sizeof(*models_anno));
// read the configuration for unannotated entries
if (anno_map->num_unanno_lps > 0){
if (anno_map->has_unanno_lp > 0){
read_config(&config, NULL, &model_unanno);
}
......
......@@ -453,7 +453,7 @@ void resource_lp_configure(){
// get the unannotated version
long int avail;
int ret;
if (anno_map->num_unanno_lps > 0){
if (anno_map->has_unanno_lp > 0){
ret = configuration_get_value_longint(&config, RESOURCE_LP_NM,
"available", NULL, &avail);
if (ret){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment