Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged qos features. #210

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions codes/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,26 @@ int configuration_get_value_double (ConfigHandle *handle,
const char * annotation,
double *value);

/*
* Get's the values for a give section/key pair which has multiple values
* and converts them to an int.
* Assumes the key name is a MULTIKEY configuration type.
*
* handle - configuration handle
* section_name - name of the section the key is in
* key_name - name of the key
* annotation - optional annotation to look for (NULL -> no annotation)
* values - array of points to values (must be freed by caller)
* length - number of value items
*/
int configuration_get_multivalue_int(ConfigHandle *handle,
const char * section_name,
const char * key_name,
const char * annotation,
int **values,
size_t *length);


/*
* Get the LPGROUPS configuration from the config file which is stored
* in the associated data structures.
Expand Down
30 changes: 23 additions & 7 deletions codes/model-net-sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ typedef struct mn_sched_params_s mn_sched_params;
X(MN_SCHED_FCFS_FULL, "fcfs-full", &fcfs_tab) \
X(MN_SCHED_RR, "round-robin", &rr_tab) \
X(MN_SCHED_PRIO, "priority", &prio_tab) \
X(MN_SCHED_QOS, "qos", &qos_tab) \
X(MAX_SCHEDS, NULL, NULL)

#define X(a,b,c) a,
Expand All @@ -46,18 +47,29 @@ typedef struct model_net_sched_rc_s model_net_sched_rc;
// priority scheduler configurtion parameters
typedef struct mn_prio_params_s {
int num_prios; // number of priorities
// sub-scheduler to use. can be any but prio
// sub-scheduler to use. can be any but prio or qos
enum sched_type sub_stype;
} mn_prio_params;

typedef struct mn_qos_params_s {
int *qos_table;
size_t numSLs;
} mn_qos_params;

// TODO: other scheduler config params

// initialization parameter set
//typedef struct model_net_sched_cfg_params_s {
// enum sched_type type;
// union {
// mn_prio_params prio;
// } u;
//} model_net_sched_cfg_params;

typedef struct model_net_sched_cfg_params_s {
enum sched_type type;
union {
mn_prio_params prio;
} u;
enum sched_type type;
mn_prio_params prio;
mn_qos_params qos;
} model_net_sched_cfg_params;

typedef struct mn_sched_cfg_params {
Expand All @@ -72,7 +84,7 @@ enum sched_msg_param_type {

// scheduler-specific parameter definitions must go here
struct mn_sched_params_s {
int prio; // MN_SCHED_PARAM_PRIO (currently the only one)
int prio; // used by prio and qos
} ;

/// interface to be implemented by schedulers
Expand Down Expand Up @@ -141,7 +153,11 @@ struct model_net_sched_rc_s {
model_net_request req; // request gets deleted...
mn_sched_params sched_params; // along with msg params
int rtn; // return code from a sched_next
int prio; // prio when doing priority queue events
int prio; // prio when doing priority queue or qos events

// For QoS
size_t qos_table_index;
size_t qos_table_counter;
};

// initialize the scheduler
Expand Down
6 changes: 6 additions & 0 deletions codes/net/fattree.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ struct fattree_message
int remote_event_size_bytes;
int local_event_size_bytes;

size_t service_level;

// QoS params needed to revert operations
size_t qos_table_index;
size_t qos_table_counter;

};

#endif /* end of include guard: FATTREE_H */
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_RANLIB
AC_PROG_LIBTOOL

PKG_PROG_PKG_CONFIG

Expand Down
7 changes: 5 additions & 2 deletions src/Makefile.subdir
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ nobase_include_HEADERS = \
codes/net/simplep2p.h \
codes/net/express-mesh.h \
codes/net/torus.h \
codes/codes-mpi-replay.h \
codes/codes-mpi-replay.h \
codes/configfile.h


Expand Down Expand Up @@ -174,7 +174,10 @@ src_libcodes_la_SOURCES = \
src/networks/model-net/simplep2p.c \
src/networks/model-net/core/model-net-lp.c \
src/networks/model-net/core/model-net-sched.c \
src/networks/model-net/core/model-net-sched-impl.c
src/networks/model-net/core/model-net-sched-impl.c \
src/networks/model-net/qos.h \
src/networks/model-net/qos.c


src_libcodes_mpi_replay_la_SOURCES = \
src/network-workloads/model-net-mpi-replay.c
Expand Down
36 changes: 36 additions & 0 deletions src/modelconfig/configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,42 @@ int configuration_get_value_double (ConfigHandle *handle,
return rc;
}


int configuration_get_multivalue_int(ConfigHandle *handle,
const char *section_name,
const char *key_name,
const char *annotation,
int **values,
size_t *len) {
char **valuestr;
int rc = 1;
int r;

r = configuration_get_multivalue(handle,
section_name,
key_name,
annotation,
&valuestr,
len);
if (r > 0)
{
int *vals = malloc(sizeof(int) * (*len));
//printf("Vals: %d\n", vals);
//printf("Len: %d\n", *len);
for (size_t i = 0; i < *len; ++i)
{
//printf("%s\n", valuestr[i]);
vals[i] = atoi(valuestr[i]);
//printf("%d\n", vals[i]);
}
*values = vals;
rc = 0;
}

return rc;
}


static void check_add_anno(
int anno_offset,
config_anno_map_t *map){
Expand Down
35 changes: 25 additions & 10 deletions src/networks/model-net/core/model-net-lp.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ static void base_read_config(const char * anno, model_net_base_params *p){
char sched[MAX_NAME_LENGTH];
long int packet_size_l = 0;
uint64_t packet_size;
int ret;
int ret, is_prio;

ret = configuration_get_value(&config, "PARAMS", "modelnet_scheduler",
anno, sched, MAX_NAME_LENGTH);
Expand Down Expand Up @@ -311,11 +311,28 @@ static void base_read_config(const char * anno, model_net_base_params *p){
"setting to %d\n", p->node_copy_queues);
}

is_prio = p->sched_params.type == MN_SCHED_PRIO || p->sched_params.type == MN_SCHED_QOS;

// get scheduler-specific parameters
if (p->sched_params.type == MN_SCHED_PRIO){
// prio scheduler uses default parameters
int * num_prios = &p->sched_params.u.prio.num_prios;
enum sched_type * sub_stype = &p->sched_params.u.prio.sub_stype;
if (p->sched_params.type == MN_SCHED_QOS) {
mn_qos_params *qos = &p->sched_params.qos;
ret = configuration_get_multivalue_int(&config, "PARAMS", "qos_table",
anno, &qos->qos_table, &qos->numSLs);
if (ret != 0) {
qos->numSLs = 1;
qos->qos_table = malloc(sizeof(int));
qos->qos_table[0] = 100;
}

// QoS uses the prio scheduler, so set those params as well
p->sched_params.prio.num_prios = qos->numSLs;
p->sched_params.prio.sub_stype = MN_SCHED_RR;
}

if (p->sched_params.type == MN_SCHED_PRIO) {
int * num_prios = &p->sched_params.prio.num_prios;
enum sched_type * sub_stype = &p->sched_params.prio.sub_stype;

// number of priorities to allocate
ret = configuration_get_value_int(&config, "PARAMS",
"prio-sched-num-prios", anno, num_prios);
Expand All @@ -338,7 +355,7 @@ static void base_read_config(const char * anno, model_net_base_params *p){
tw_error(TW_LOC, "Unknown value for "
"PARAMS:prio-sched-sub-sched %s", sched);
}
else if (i == MN_SCHED_PRIO){
else if (i == MN_SCHED_PRIO || i == MN_SCHED_QOS){
tw_error(TW_LOC, "priority scheduler cannot be used as a "
"priority scheduler's sub sched "
"(PARAMS:prio-sched-sub-sched)");
Expand All @@ -347,16 +364,14 @@ static void base_read_config(const char * anno, model_net_base_params *p){
}

if (p->sched_params.type == MN_SCHED_FCFS_FULL ||
(p->sched_params.type == MN_SCHED_PRIO &&
p->sched_params.u.prio.sub_stype == MN_SCHED_FCFS_FULL)){
(is_prio && p->sched_params.prio.sub_stype == MN_SCHED_FCFS_FULL)){
// override packet size to something huge (leave a bit in the unlikely
// case that an op using packet size causes overflow)
packet_size = 1ull << 62;
}
else if (!packet_size &&
(p->sched_params.type != MN_SCHED_FCFS_FULL ||
(p->sched_params.type == MN_SCHED_PRIO &&
p->sched_params.u.prio.sub_stype != MN_SCHED_FCFS_FULL))){
(is_prio && p->sched_params.prio.sub_stype != MN_SCHED_FCFS_FULL))){
packet_size = 512;
fprintf(stderr, "WARNING, no packet size specified, setting packet "
"size to %llu\n", LLU(packet_size));
Expand Down
Loading