示例#1
0
#include <tlm.h>

static FILE	*g_tlm_output_f = NULL;

static const tw_optdef tlm_options [] =
{
	TWOPT_GROUP("Transmission Line Matrix Model"),
	TWOPT_UINT("memory", g_tlm_optmem, "Additional memory buffers"),
	TWOPT_STIME("threshold", g_tlm_wave_threshold, "Wave propagation threshold"),
	TWOPT_END()
};

void
tlm_md_opts()
{
	tw_opt_add(tlm_options);
}

void
tlm_md_init(int argc, char ** argv, char ** env)
{
	tw_lpid		 nlp_grid;

	int		 i;

	if(!g_rn_environment)
		return;

	g_tlm_stats = tw_calloc(TW_LOC, "", sizeof(*g_tlm_stats), 1);

	// g_tlm_output_fix up global variables
示例#2
0
#include <ross.h>

#define TW_GVT_NORMAL 0
#define TW_GVT_COMPUTE 1

static unsigned int g_tw_gvt_max_no_change = 10000;
static unsigned int g_tw_gvt_no_change = 0;
static tw_stat all_reduce_cnt = 0;
static unsigned int gvt_cnt = 0;
static unsigned int gvt_force = 0;

static const tw_optdef gvt_opts [] =
{
	TWOPT_GROUP("ROSS MPI GVT"),
	TWOPT_UINT("gvt-interval", g_tw_gvt_interval, "GVT Interval"),
	TWOPT_STIME("report-interval", gvt_print_interval, 
				"percent of runtime to print GVT"),
	TWOPT_END()
};

const tw_optdef *
tw_gvt_setup(void)
{
	gvt_cnt = 0;
	
	return gvt_opts;
}

void
tw_gvt_start(void)
{
}
示例#3
0
文件: phold.c 项目: nmcglohon/ROSS
    memcpy(buffer, &a, sizeof(a));
    return;
}

st_model_types model_types[] = {
    {(ev_trace_f) event_trace,
     0,
    (model_stat_f) phold_stats_collect,
    sizeof(int)},
    {0}
};

const tw_optdef app_opt[] =
{
	TWOPT_GROUP("PHOLD Model"),
	TWOPT_STIME("remote", percent_remote, "desired remote event rate"),
	TWOPT_UINT("nlp", nlp_per_pe, "number of LPs per processor"),
	TWOPT_STIME("mean", mean, "exponential distribution mean for timestamps"),
	TWOPT_STIME("mult", mult, "multiplier for event memory allocation"),
	TWOPT_STIME("lookahead", lookahead, "lookahead for events"),
	TWOPT_UINT("start-events", g_phold_start_events, "number of initial messages per LP"),
	TWOPT_UINT("stagger", stagger, "Set to 1 to stagger event uniformly across 0 to end time."),
	TWOPT_UINT("memory", optimistic_memory, "additional memory buffers"),
	TWOPT_CHAR("run", run_id, "user supplied run name"),
	TWOPT_END()
};

int
main(int argc, char **argv, char **env)
{
示例#4
0
文件: torus.c 项目: wilseypa/ROSS
     kpid = i % g_tw_nkp;
     pe = tw_getpe(kpid % g_tw_npe);
     tw_lp_onpe(nlp_nodes_per_pe+i, pe, N_nodes + g_tw_mynode * nlp_mpi_procs_per_pe + i + getRem() );
     tw_lp_onkp(g_tw_lp[nlp_nodes_per_pe + i], g_tw_kp[kpid]);
     tw_lp_settype(nlp_nodes_per_pe + i, &nodes_lps[1]);
   }
}
const tw_optdef app_opt [] =
{
	TWOPT_GROUP("Nodes Model"),
	TWOPT_UINT("memory", opt_mem, "optimistic memory"),
	TWOPT_UINT("vc_size", vc_size, "VC size"),
	TWOPT_ULONG("mpi-message-size", mpi_message_size, "mpi-message-size"),
	TWOPT_UINT("mem_factor", mem_factor, "mem_factor"),
	TWOPT_CHAR("traffic", traffic_str, "uniform, nearest, diagonal"), 
	TWOPT_STIME("injection_interval", injection_interval, "messages are injected during this interval only "),
	TWOPT_STIME("link_bandwidth", link_bandwidth, " link bandwidth per channel "),
	TWOPT_STIME("arrive_rate", MEAN_INTERVAL, "packet arrive rate"),
	TWOPT_END()
};


int
main(int argc, char **argv, char **env)
{
	int i;
	num_buf_slots = vc_size / chunk_size;
	tw_opt_add(app_opt);
	tw_init(&argc, &argv);

	if(strcmp(traffic_str, "uniform") == 0)
示例#5
0
/**
 * @file tw-setup.c
 * @brief tw_define_lps is defined here!
 */

#define VERIFY_MAPPING 0

static tw_pe *setup_pes(void);
unsigned int nkp_per_pe = 16;

static const tw_optdef kernel_options[] = {
    TWOPT_GROUP("ROSS Kernel"),
    TWOPT_UINT("synch", g_tw_synchronization_protocol, "Sychronization Protocol: SEQUENTIAL=1, CONSERVATIVE=2, OPTIMISTIC=3, OPTIMISTIC_DEBUG=4"),
    TWOPT_UINT("nkp", nkp_per_pe, "number of kernel processes (KPs) per pe"),
    TWOPT_STIME("end", g_tw_ts_end, "simulation end timestamp"),
    TWOPT_UINT("batch", g_tw_mblock, "messages per scheduler block"),
    TWOPT_UINT("extramem", g_tw_events_per_pe_extra, "Number of extra events allocated per PE."),
    TWOPT_UINT("buddy-size", g_tw_buddy_alloc, "delta encoding buddy system allocation (2^X)"),
    TWOPT_UINT("lz4-knob", g_tw_lz4_knob, "LZ4 acceleration factor (higher = faster)"),
#ifdef AVL_TREE
    TWOPT_UINT("avl-size", g_tw_avl_node_count, "AVL Tree contains 2^avl-size nodes"),
#endif
    TWOPT_END()
};

void tw_init(int *argc, char ***argv) {
    int i;
#if HAVE_CTIME
    time_t raw_time;
#endif
示例#6
0
文件: epi.c 项目: chleemobile/rossnet
	 (map_f) epi_map,
	 sizeof(epi_state)},
	{0},
};

const tw_optdef app_opt[] =
{
	TWOPT_GROUP("EPI Model: "),

	// output files
	TWOPT_CHAR("positions", g_epi_position_fn, "Agent position output file"),
	TWOPT_CHAR("hospital-output", g_epi_hospital_fn, "Hospital output file name"),
	TWOPT_UINT("report-int", g_epi_mod, "Reporting Interval"),

	// agent parameters
	TWOPT_STIME("sick-rate", g_epi_sick_rate, "Probability agents start sick"),
	TWOPT_CHAR("worried-well", g_epi_ww_rate, "Probability agents are worried well"),
	TWOPT_STIME("wwell-thresh", g_epi_ww_threshold, "Worried well threshold"),
	TWOPT_UINT("wwell-dur", g_epi_ww_duration, "Worried well duration"),
	TWOPT_STIME("work-while-sick", g_epi_wws_rate, "Probability agents work while sick"),

	// init model algorithmically
	TWOPT_GROUP("EPI Model: initialize algorithmically (default mode)"),
	TWOPT_UINT("nagents", g_epi_nagents, "number of agents per location per CPU"),
	TWOPT_ULONG("nlocations", g_tw_nlp, "number of locations per region per CPU"),
	TWOPT_UINT("nregions", g_epi_nregions, "number of regions per CPU"),
	TWOPT_UINT("mean", g_epi_mean, "exponential mean for location durations (secs)"),

	// init model from input files
	TWOPT_GROUP("EPI Model: initialize from file"),
	TWOPT_CHAR("ic", g_epi_ic_fn, "IC input file name"),
示例#7
0
#include <rp.h>

static const tw_optdef rp_options [] =
{
	TWOPT_UINT("rw-min", g_rp_mu, "random walk min change dir"),
	TWOPT_UINT("rw-max", g_rp_distr_sd, "random walk max change dir"),
	TWOPT_STIME("wave-percent", percent_wave, "percentage of waves per move"),
	TWOPT_END()
};

void
rp_md_opts()
{
	tw_opt_add(rp_options);
}
	
void
rp_md_init(int argc, char ** argv, char ** env)
{
	int	 nbufs;

	g_rp_stats = tw_calloc(TW_LOC, "", sizeof(*g_rp_stats), 1);

	nbufs = 1000000 / g_tw_nkp;
	nbufs = 10000 / g_tw_nkp;

	g_rp_fd = tw_memory_init(nbufs, sizeof(rp_message), 1);

	if(tw_ismaster())
	{
		printf("\nInitializing Model: Random Walk\n");
示例#8
0
tw_lptype mylps[] = {
		{(init_f) init,
		(event_f) event_handler,
		(revent_f) event_handler_rc,
		(final_f) finish,
		(map_f) map_to_pe,
		sizeof(ping_pong_state)},
	{0},
};

const tw_optdef app_opt[] =
{
	TWOPT_GROUP("Ping Pong Model"),
	TWOPT_UINT("nlp", nlp_per_pe, "number of LPs per processor"),
	TWOPT_STIME("lookahead", lookahead, "lookahead for events"),
	TWOPT_UINT("start-events", g_start_events, "number of initial messages per LP"),
	TWOPT_UINT("memory", optimistic_memory, "additional memory buffers"),
	TWOPT_END()
};

int main(int argc, char **argv, char **env)
{
	int		 i;

	lookahead = 1.0;
	tw_opt_add(app_opt);
	tw_init(&argc, &argv);

	if( lookahead > 1.0 )
		tw_error(TW_LOC, "Lookahead > 1.0 .. needs to be less\n");
示例#9
0
#include "olsr.h"

const tw_optdef olsr_opts[] = {
    TWOPT_GROUP("OLSR Model"),
    TWOPT_UINT("lp_per_pe", nlp_per_pe, "number of LPs per processor"),
    TWOPT_STIME("lookahead", g_tw_lookahead, "lookahead for the simulation"),
    TWOPT_CHAR("rwalk", g_olsr_mobility, "random walk [Y/N]"),
    TWOPT_END(),
};

// Done mainly so doxygen will catch and differentiate this main
// from other mains while allowing smooth compilation.
#define olsr_main main

int olsr_main(int argc, char *argv[])
{
    int i;
    char log[32];

    tw_opt_add(olsr_opts);
    tw_init(&argc, &argv);

#if DEBUG
    sprintf( log, "olsr-log.%ld", g_tw_mynode );

    olsr_event_log = fopen( log, "w+");
    if( olsr_event_log == nullptr )
        tw_error( TW_LOC, "Failed to Open OLSR Event Log file \n");
#endif

    g_tw_mapping = CUSTOM;
示例#10
0
文件: wifi.c 项目: laprej/ROSS-Models
  for( i=0; i < WIFI_MAX_STATIONS_PER_ACCESS_POINT; i++)
    {
      station_failed_packets += s->stations[i].failed_packets;
	  station_total_packets += s->stations[i].total_packets;
    }

  printf("LP %llu had %llu / %llu failed Access Point to Station packets\n", lp->gid, station_failed_packets, station_total_packets);
}


const tw_optdef app_opt[] =
  {
    TWOPT_GROUP("802.11b Model"),
    TWOPT_UINT("nlp", nlp_per_pe, "number of LPs per processor"),
    TWOPT_STIME("mean", mean, "exponential distribution mean for timestamps"),
    TWOPT_STIME("mult", mult, "multiplier for event memory allocation"),
    TWOPT_STIME("lookahead", lookahead, "lookahead for events"),
    TWOPT_UINT("start-events", g_wifi_start_events, "number of initial messages per LP"),
    TWOPT_UINT("memory", optimistic_memory, "additional memory buffers"),
    TWOPT_CHAR("run", run_id, "user supplied run name"),
    TWOPT_END()
  };

int
main(int argc, char **argv, char **env)
{
  int i;
  lookahead = 1.0;
  tw_opt_add(app_opt);
  tw_init(&argc, &argv);
示例#11
0
static tw_mutex g_tw_gvt_lck = TW_MUTEX_INIT;
static tw_volatile tw_stime sim_gvt;
static tw_stime node_lvt;
static unsigned int gvt_cnt;
static tw_stime secs = 0.1;
static tw_stime delta_t = 0.01;
static unsigned int CPU = 1998;

static int TW_PARALLEL = 0;
static int TW_DISTRIBUTED = 0;

static const tw_optdef gvt_opts [] =
{
	TWOPT_GROUP("ROSS 7 O'clock GVT"),
	TWOPT_STIME("report-interval", gvt_print_interval, 
			"percent of runtime to print GVT"),
	TWOPT_STIME("delta_t", delta_t, "Max event send time (secs)"),
	TWOPT_STIME("clock-interval", secs, "GVT clock interval (in secs)"),
	TWOPT_UINT("clock-speed", CPU, "CPU clock speed (in MHz)"),
	TWOPT_UINT("gvt-interval", g_tw_gvt_interval, "GVT interval (shm only)"),
	TWOPT_END()
};

void
tw_gvt_stats(FILE * f)
{
	fprintf(f, "TW GVT Settings: Seven O'clock\n");
	fprintf(f, "\t%-50s %11.2lf (secs)\n", "GVT Clock Interval", secs);
	fprintf(f, "\t%-50s %11d\n", "GVT Interval", g_tw_gvt_interval);
	fprintf(f, "\t%-50s %11d\n", "Batch Size", g_tw_mblock);
	fprintf(f, "\n");
tw_lptype svr_lp = {
    (init_f) svr_init,
    (pre_run_f) NULL,
    (event_f) svr_event,
    (revent_f) svr_rev_event,
    (final_f)  svr_finalize,
    (map_f) codes_mapping,
    sizeof(svr_state),
};

const tw_optdef app_opt [] =
{
        TWOPT_GROUP("Model net synthetic traffic " ),
	TWOPT_UINT("traffic", traffic, "UNIFORM RANDOM=1, NEAREST NEIGHBOR=2 "),
	TWOPT_STIME("arrival_time", arrival_time, "INTER-ARRIVAL TIME"),
        TWOPT_END()
};

const tw_lptype* svr_get_lp_type()
{
            return(&svr_lp);
}

static void svr_add_lp_type()
{
  lp_type_register("server", svr_get_lp_type());
}

static void issue_event(
    svr_state * ns,