Commit a611dd16 authored by Jonathan Jenkins's avatar Jonathan Jenkins
Browse files

Partly automated merge of codes-net

Build system and documentation files were largely hand-merged.
parents f32214c7 41431554
......@@ -2,7 +2,7 @@
......@@ -16,8 +16,9 @@
# make generated artifacts
......@@ -13,35 +13,37 @@ EXTRA_PROGRAMS =
src_models_CESOURCES =
# pkgconfig files
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = maint/codes-base.pc
pkgconfig_DATA = maint/codes.pc
$(pkgconfig_DATA): config.status
EXTRA_DIST += COPYRIGHT uc-codes.cfg
EXTRA_DIST += \ COPYRIGHT TODO.txt uc-codes.cfg \
misc/README misc/ptrn_loggp-2.4.6.patch \
AM_CPPFLAGS = -I$(top_srcdir)/src ${ROSS_CFLAGS}
include Make.rules
include $(top_srcdir)/scripts/Makefile.subdir
include $(top_srcdir)/src/Makefile.subdir
include $(top_srcdir)/src/models/Makefile.subdir
include $(top_srcdir)/tests/Makefile.subdir
include $(top_srcdir)/doc/Makefile.subdir
src_libcodes_base_a_SOURCES += src/workload/methods/codes-darshan-io-wrkld.c
tests_workload_codes_workload_test_LDADD += ${DARSHAN_LIBS}
tests_workload_codes_workload_mpi_replay_LDADD += ${DARSHAN_LIBS}
TESTS += tests/workload/
......@@ -53,6 +55,5 @@ endif
src_libcodes_base_a_SOURCES += src/workload/methods/codes-dumpi-trace-nw-wrkld.c
tests_workload_codes_workload_test_LDADD += ${DUMPI_LIBS}
tests_workload_codes_workload_mpi_replay_LDADD += ${DUMPI_LIBS}
1- Torus network model:
- Check how to specify the buffer size in the config file (buffer size is in flits)--- Option 1 specify the buffer size in packets and convert it into flits?
- Check how to specify the number of torus nodes from the config file? Currently they are being calculated from the file... How to integrate this with the mapping thing?
Option: Specify the torus network and the length of each torus dimension.
2- Tests
- clean up modelnet-test.c and code based on it. The way it calculates lpids is
extremely fragile (a bunch of constants + some assumptions that lead to very
confusing code)
* 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) */
* 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);
/* mapping utilities to and from linearized torus node ids */
void model_net_torus_get_dim_id(
int flat_id,
int ndims,
const int * dim_lens,
int * out_dim_ids);
int model_net_torus_get_flat_id(
int ndims,
const int * dim_lens,
const int * dim_ids);
#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
* Copyright (C) 2014 University of Chicago.
* See COPYRIGHT notice in top-level directory.
/* This is the base model-net LP that all events pass through before
* performing any topology-specific work. Packet scheduling, dealing with
* packet loss (potentially), etc. happens here.
* Additionally includes wrapper event "send" function that all
* events for underlying models must go through */
#ifndef MODEL_NET_LP_H
#define MODEL_NET_LP_H
#include <ross.h>
#include "codes/lp-msg.h"
#include "model-net.h"
#include "model-net-sched.h"
#include "net/dragonfly.h"
#include "net/loggp.h"
#include "net/simplenet-upd.h"
#include "net/simplep2p.h"
#include "net/torus.h"
extern int model_net_base_magic;
// register the networks with ROSS, given the array of flags, one for each
// network type
void model_net_base_register(int *do_config_nets);
// configure the base LP type, setting up general parameters
void model_net_base_configure();
/// The remaining functions/data structures are only of interest to model-net
/// model developers
// Construct a model-net-specific event, analagous to a tw_event_new and
// codes_event_new. The difference here is that we return pointers to
// both the message data (to be cast into the appropriate type) and the
// pointer to the end of the event struct.
// This function is expected to be called within each specific model-net
// method - strange and disturbing things will happen otherwise
tw_event * model_net_method_event_new(
tw_lpid dest_gid,
tw_stime offset_ts,
tw_lp *sender,
int net_id,
void **msg_data,
void **extra_data);
// Construct a model-net-specific event, similar to model_net_method_event_new.
// The primary differences are:
// - the event gets sent to final_dest_lp and put on it's receiver queue
// - no message initialization is needed - that's the job of the
// model_net_method_recv_msg_event functions
// NOTE: this is largely a constructor of a model_net_request
void model_net_method_send_msg_recv_event(
tw_lpid final_dest_lp,
tw_lpid dest_mn_lp, // which model-net lp is going to handle message
tw_lpid src_lp, // the "actual" source (as opposed to the model net lp)
uint64_t msg_size, // the size of this message
int is_pull,
uint64_t pull_size, // the size of the message to pull if is_pull==1
int remote_event_size,
const mn_sched_params *sched_params,
const char * category,
int net_id,
void * msg,
tw_stime offset,
tw_lp *sender);
// just need to reverse an RNG for the time being
void model_net_method_send_msg_recv_event_rc(tw_lp *sender);
// Issue an event from the underlying model (e.g., simplenet, loggp) to tell the
// scheduler when next to issue a packet event. As different models update their
// notion of "idleness" separately, this is necessary. DANGER: Failure to call
// this function appropriately will cause the scheduler to hang or cause other
// weird behavior.
// This function is expected to be called within each specific model-net
// method - strange and disturbing things will happen otherwise
void model_net_method_idle_event(tw_stime offset_ts, int is_recv_queue,
tw_lp * lp);
// Get a ptr to past the message struct area, where the self/remote events
// are located, given the type of network.
// NOTE: this should ONLY be called on model-net implementations, nowhere else
void * model_net_method_get_edata(int net_id, void * msg);
/// The following functions/data structures should not need to be used by
/// model developers - they are just provided so other internal components can
/// use them
enum model_net_base_event_type {
// schedule next packet
// message goes directly down to topology-specific event handler
typedef struct model_net_base_msg {
// no need for event type - in wrap message
model_net_request req;
int is_from_remote;
// parameters to pass to new messages (via model_net_set_msg_params)
// TODO: make this a union for multiple types of parameters
mn_sched_params sched_params;
model_net_sched_rc rc; // rc for scheduling events
} model_net_base_msg;
typedef struct model_net_wrap_msg {
msg_header h;
union {
model_net_base_msg m_base; // base lp
terminal_message m_dfly; // dragonfly
loggp_message m_loggp; // loggp
sn_message m_snet; // simplenet
sp_message m_sp2p; // simplep2p
nodes_message m_torus; // torus
// add new ones here
} msg;
} model_net_wrap_msg;
#endif /* end of include guard: MODEL_NET_LP_H */
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
* vim: ft=c ts=8 sts=4 sw=4 expandtab
* Copyright (C) 2013 University of Chicago.
* See COPYRIGHT notice in top-level directory.
#include <ross.h>
// forward decl of model_net_method since we currently have a circular include
// (method needs sched def, sched needs method def)
struct model_net_method;
#include "codes/model-net-sched.h"
// interface that each model-net model implements
struct model_net_method
uint64_t packet_size; /* packet size */
void (*mn_configure)(); /* For initializing the network */
/* Register lp types with ROSS. This may be left as NULL, in which case the
* type corresponding to name "modelnet_<type>" will be registered
* automatically. Most networks don't need this (currently, only dragonfly
* uses it) */
void (*mn_register)(tw_lptype *base_type);
tw_stime (*model_net_method_packet_event)(
model_net_request const * req,
uint64_t message_offset, // offset in the context of the whole message
uint64_t packet_size, // needed in case message < packet
tw_stime offset,
mn_sched_params const * sched_params,
void const * remote_event,
void const * self_event,
tw_lp *sender,
int is_last_pckt);
void (*model_net_method_packet_event_rc)(tw_lp *sender);
tw_stime (*model_net_method_recv_msg_event)(
const char * category,
tw_lpid final_dest_lp,
tw_lpid src_mn_lp, // the modelnet LP this message came from
uint64_t msg_size,
int is_pull,
uint64_t pull_size,
tw_stime offset,
int remote_event_size,
const void* remote_event,
tw_lpid src_lp, // original caller of model_net_(pull_)event
tw_lp *sender); // lp message is being called from (base LP)
void (*model_net_method_recv_msg_event_rc)(tw_lp *lp);
const tw_lptype* (*mn_get_lp_type)();
int (*mn_get_msg_sz)();
void (*mn_report_stats)();
void (*mn_collective_call)(char const * category, int message_size, int remote_event_size, const void* remote_event, tw_lp* sender);
void (*mn_collective_call_rc)(int message_size, tw_lp* sender);
extern struct model_net_method * method_array[];
#endif /* MODELNET_METHOD_H */
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
* vim: ft=c ts=8 sts=4 sw=4 expandtab
* Copyright (C) 2014 University of Chicago.
* See COPYRIGHT notice in top-level directory.
/* A scheduler interface for use by model-net models. */
#include <ross.h>
#include "model-net.h"
// forward decl of mn_sched_params since we currently have a circular include
// (method needs sched def, sched needs method def)
typedef struct mn_sched_params_s mn_sched_params;
#include "model-net-method.h"
/// types of schedulers
/// format: enum type, config string, function pointer names
/// fcfs-full eschews packetization
X(MN_SCHED_FCFS, "fcfs", &fcfs_tab) \
X(MN_SCHED_FCFS_FULL, "fcfs-full", &fcfs_tab) \
X(MN_SCHED_RR, "round-robin", &rr_tab) \
X(MN_SCHED_PRIO, "priority", &prio_tab) \
#define X(a,b,c) a,
enum sched_type {
#undef X
/// scheduler decls
typedef struct model_net_sched_s model_net_sched;
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
enum sched_type sub_stype;
} mn_prio_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 mn_sched_cfg_params {
mn_prio_params prio;
} mn_sched_cfg_params;
/// message-specific parameters
enum sched_msg_param_type {
MN_SCHED_PARAM_PRIO, // currently, only the priority scheduler has params
// scheduler-specific parameter definitions must go here
struct mn_sched_params_s {
int prio; // MN_SCHED_PARAM_PRIO (currently the only one)
} ;
/// interface to be implemented by schedulers
/// see corresponding general functions
typedef struct model_net_sched_interface {
// initialize the scheduler
// params - scheduler specific params (currently only prio q uses)
void (*init)(
const struct model_net_method * method,
const model_net_sched_cfg_params * params,
int is_recv_queue,
void ** sched);
// finalize the scheduler
void (*destroy)(void * sched);
// add a new request to the scheduler
// sched_params - per-message parameters distinct to each scheduler:
// prio (currently the only user): int priority
// - NULL arguments should be treated as "use default value"
void (*add)(
const model_net_request * req,
const mn_sched_params * sched_params,
int remote_event_size,
void * remote_event,
int local_event_size,
void * local_event,
void * sched,
model_net_sched_rc * rc,
tw_lp * lp);
// reverse the previous request addition
void (*add_rc)(void *sched, const model_net_sched_rc *rc, tw_lp *lp);
// schedule the next packet for processing by the model
int (*next)(
tw_stime * poffset,
void * sched,
// NOTE: copy here when deleting remote/local events for rc
void * rc_event_save,
model_net_sched_rc * rc,
tw_lp * lp);
// reverse schedule the previous packet
void (*next_rc)(
void * sched,
const void * rc_event_save,
const model_net_sched_rc * rc,
tw_lp * lp);
} model_net_sched_interface;
/// overall scheduler struct - type puns the actual data structure
struct model_net_sched_s {
enum sched_type type;
// data for the underlying scheduler implementation (see
// model-net-sched-impl*)
void * dat;
const model_net_sched_interface * impl;
/// scheduler-specific structures go here
/// reverse computation structure - this is expected to be held by upper-level
/// model-net LPs and passed to the scheduler functions to allow proper rc
/// NOTE: since modelnet LPs will be stashing this in their event structs,
/// need to provide full definition in header
struct model_net_sched_rc_s {
// NOTE: sched implementations may need different types, but for now they
// are equivalent
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
// initialize the scheduler
// - params is created by the configuration routine and can be different from
// type to type. Currently only priority scheduler uses it
void model_net_sched_init(
const model_net_sched_cfg_params * params,
int is_recv_queue,
struct model_net_method *method,
model_net_sched *sched);
/// schedules the next chunk, storing any info needed for rc in sched_rc
/// packet issue time is placed in poffset to be able to separate packet calls
/// between multiple scheduler events
/// returns:
/// * 0 on success,
/// * 1 on success and the corresponding request is finished. In this case,
/// out_req is set to the underlying request
/// * -1 when there is nothing to be scheduled
int model_net_sched_next(
tw_stime *poffset,
model_net_sched *sched,
void *rc_event_save,
model_net_sched_rc *sched_rc,
tw_lp *lp);
void model_net_sched_next_rc(
model_net_sched *sched,
const void *rc_event_save,
const model_net_sched_rc *sched_rc,
tw_lp *lp);
/// enter a new request into the scheduler, storing any info needed for rc in
/// sched_rc
/// sched_msg_params is scheduler-specific parameters (currently only used by
/// prio scheduler)
void model_net_sched_add(
const model_net_request *req,
const mn_sched_params * sched_params,
int remote_event_size,
void * remote_event,
int local_event_size,
void * local_event,
model_net_sched *sched,
model_net_sched_rc *sched_rc,
tw_lp *lp);
void model_net_sched_add_rc(
model_net_sched *sched,
const model_net_sched_rc *sched_rc,
tw_lp *lp);
// set default parameters for messages that don't specify any
void model_net_sched_set_default_params(mn_sched_params *sched_params);
extern char * sched_names[];
#endif /* end of include guard: MODEL_NET_SCHED_H */
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
* vim: ft=c ts=8 sts=4 sw=4 expandtab
* Copyright (C) 2013 University of Chicago.
* See COPYRIGHT notice in top-level directory.
#ifndef MODELNET_H
#define MODELNET_H
#include <ross.h>
#include <codes/lp-type-lookup.h>
#include <codes/configuration.h>
#include <codes/lp-io.h>
#include <codes/codes-mapping-context.h>
#include <stdint.h>
#define PULL_MSG_SIZE 128
#define MAX_NAME_LENGTH 256
#define CATEGORY_MAX 12
// simple deprecation attribute hacking
#if !defined(DEPRECATED)
# if defined(__GNUC__) || defined(__GNUG__) || defined(__clang__)
# define DEPRECATED __attribute__((deprecated))
# else
# endif
/* HACK: there is currently no scheduling fidelity across multiple
* model_net_event calls. Hence, problems arise when some LP sends multiple
* messages as part of an event and expects FCFS ordering. A proper fix which
* involves model-net LP-level scheduling of requests is ideal, but not
* feasible for now (would basically have to redesign model-net), so expose
* explicit start-sequence and stop-sequence markers as a workaround
extern int mn_in_sequence;
extern tw_stime mn_msg_offset;
#define MN_START_SEQ() do {\
mn_in_sequence = 1; \
mn_msg_offset = 0.0; \
} while (0)
#define MN_END_SEQ() do {\
mn_in_sequence = 0;\
} while (0)
typedef struct mn_stats mn_stats;
// use the X-macro to get types and names rolled up into one structure
// format: { enum vals, config name, internal lp name, lp method struct}
// last value is sentinel
#define NETWORK_DEF \
X(SIMPLENET, "modelnet_simplenet", "simplenet", &simplenet_method)\
X(SIMPLEP2P, "modelnet_simplep2p", "simplep2p", &simplep2p_method)\
X(TORUS, "modelnet_torus", "torus", &torus_method)\
X(DRAGONFLY, "modelnet_dragonfly", "dragonfly", &dragonfly_method)\
X(LOGGP, "modelnet_loggp", "loggp", &loggp_method)\
#define X(a,b,c,d) a,
#undef X
// message parameter types
enum msg_param_type {
// parameters for modelnet-scheduler (priorities and such)
// parameter allowing the explicit setting of a messages start time (useful
// for routing scenarios in which a single message is implemented in terms
// of multiple model-net events, such as for model_net_pull_*event's)
// MN_MSG_PARAM_MSG_START_TIME parameter types (only one for the time being)
enum msg_param_start_time {