Commit a57bc2d2 authored by Jonathan Jenkins's avatar Jonathan Jenkins

network introspection abilities

parent 3ced26b0
/*
* Copyright (C) 2013 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
/* This header provides ways for modelnet users to look at the state of the
* underlying implementations (e.g., torus) */
#ifndef MODEL_NET_INSPECT_H
#define MODEL_NET_INSPECT_H
/* ALL FUNCTIONS
* anno is the annotation specified in the configuration (NULL -> no
* annotation), while ignore_annotations is a flag controlling whether
* annotations are checked for or not - if not, then */
/* get the dimensions of a torus configuration torus network. n and dims are
* return paramters */
void model_net_torus_get_dims(
char const * anno,
int ignore_annotations,
int * n,
int const * const * dims);
#endif /* end of include guard: MODEL_NET_INSPECT_H */
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*
* vim: ft=c ts=8 sts=4 sw=4 expandtab
*/
......@@ -21,6 +21,7 @@ nobase_include_HEADERS = \
codes/model-net-method.h \
codes/model-net-lp.h \
codes/model-net-sched.h \
codes/model-net-inspect.h \
codes/net/dragonfly.h \
codes/net/loggp.h \
codes/net/simplenet-upd.h \
......
......@@ -1374,6 +1374,36 @@ struct model_net_method torus_method =
.mn_collective_call_rc = torus_collective_rc
};
/* user-facing modelnet functions */
void model_net_torus_get_dims(
char const * anno,
int ignore_annotations,
int * n,
int const ** dims)
{
torus_param const * p = NULL;
int i;
if (ignore_annotations)
p = &all_params[0];
else if (anno_map->has_unanno_lp > 0 && anno == NULL)
p = &all_params[anno_map->num_annos];
else {
for (i = 0; i < num_params; i++) {
if (strcmp(anno, anno_map->annotations[i]) == 0) {
p = &all_params[i];
break;
}
}
}
if (p == NULL)
tw_error(TW_LOC, "unable to find configuration for annotation %s", anno);
*n = p->n_dims;
*dims = p->dim_length;
}
/*
* Local variables:
* c-indent-level: 4
......
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