struct svr_msg
{
    msg_header h;
    int tag;
    lsm_return_t ret;
    int incremented_flag; /* helper for reverse computation */
};

static int magic = 123;
static struct codes_cb_info cb_info;

char conf_file_name[256] = {0};

const tw_optdef app_opt[] = {
    TWOPT_GROUP("Simple Network Test Model"),
    TWOPT_CHAR("conf", conf_file_name, "Name of configuration file"),
    TWOPT_END()
};


static void svr_init(
    svr_state * ns,
    tw_lp * lp);
static void svr_event(
    svr_state * ns,
    tw_bf * b,
    svr_msg * m,
    tw_lp * lp);
static void svr_rev_event(
    svr_state * ns,
    tw_bf * b,
Example #2
0
    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)
{

#ifdef TEST_COMM_ROSS
    // Init outside of ROSS
    MPI_Init(&argc, &argv);
    // Split COMM_WORLD in half even/odd
    int mpi_rank;
    MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
    MPI_Comm split_comm;
    MPI_Comm_split(MPI_COMM_WORLD, mpi_rank%2, mpi_rank, &split_comm);
Example #3
0
    (revent_f) netdmf_srw_revent,
    (final_f)  netdmf_srw_final,
    (map_f)    netdmf_srw_map,
    sizeof    (srw_state)
  },
  {0},
};

/** Filename of [optional] NetDMF configuration */
char netdmf_config[1024] = "";

/** Various additional options for SRW */
const tw_optdef srw_opts[] = {
  TWOPT_GROUP("SRW Model"),
#ifdef WITH_NETDMF
  TWOPT_CHAR("netdmf-config", netdmf_config, "NetDMF Configuration file"),
#endif /* WITH_NETDMF */
  TWOPT_END()
};

#ifdef WITH_NETDMF
void rn_netdmf_init();

tw_petype srw_pes[] = {
  {
    (pe_init_f)  0,
    (pe_init_f)  rn_netdmf_init,
    (pe_gvt_f)   0,
    (pe_final_f) 0,
    (pe_periodic_f) 0
  },
	forwarder_magic = h1 + h2;

	lp_type_register("forwarder", &forwarder_lp);
}

/**** END IMPLEMENTATIONS ****/

/* arguments to be handled by ROSS - strings passed in are expected to be
 * pre-allocated */
static char conf_file_name[256] = { 0 };
/* this struct contains default parameters used by ROSS, as well as
 * user-specific arguments to be handled by the ROSS config sys. Pass it in
 * prior to calling tw_init */
const tw_optdef app_opt[] = {
TWOPT_GROUP("Model net test case" ),
TWOPT_CHAR("codes-config", conf_file_name, "name of codes configuration file"),
TWOPT_END() };

static tw_stime s_to_ns(tw_stime ns) {
	//printf("in s_to_ns\n");
	return (ns * (1000.0 * 1000.0 * 1000.0));
}

static tw_stime ns_to_s(tw_stime ns) {
	//printf("In ns_to_s\n");
	return (ns / (1000.0 * 1000.0 * 1000.0));
}

int main(int argc, char *argv[]) {
	//printf("In main\n");
	g_tw_ts_end = s_to_ns(60 * 60 * 24 * 365); /* one year, in nsecs */
Example #5
0
   {
     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);
Example #6
0
tw_lptype       mylps[] = {
	{(init_f) epi_init,
	 (event_f) epi_event_handler,
	 (revent_f) epi_rc_event_handler,
	 (final_f) epi_final,
	 (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"),
Example #7
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;
		total_collectives += s->num_cols;
		
		printf("\n LP %ld total sends %ld receives %ld wait_alls %ld waits %ld ", lp->gid, s->num_sends,s->num_recvs, s->num_waitall, s->num_wait);
	        avg_time += s->total_time;
		avg_compute_time += s->compute_time;
                avg_comm_time += (s->total_time - s->compute_time);
                avg_wait_time += s->wait_time;
                avg_send_time += s->send_time;
                avg_recv_time += s->recv_time;
		avg_col_time += s->col_time;
}

const tw_optdef app_opt [] =
{
	TWOPT_GROUP("Network workload test"),
    	TWOPT_CHAR("workload_type", workload_type, "workload type (either \"scalatrace\" or \"dumpi\")"),
	TWOPT_CHAR("workload_file", workload_file, "workload file name"),
	TWOPT_CHAR("offset_file", offset_file, "offset file name"),
	TWOPT_END()
};

tw_lptype nw_lp = {
    (init_f) nw_test_init,
    (pre_run_f) NULL,
    (event_f) nw_test_event_handler,
    (revent_f) nw_test_event_handler_rc,
    (final_f) nw_test_finalize,
    (map_f) codes_mapping,
    sizeof(nw_state)
};
Example #9
0
	 (map_f) tmr_map,
	 sizeof(tmr_state)
	},
	{0},
};

const tw_optdef app_opt[] =
{
	TWOPT_GROUP("TIMER 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_UINT("start-events", g_tmr_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_CHAR("verbose", verbose, "verbose statements"),
	TWOPT_END()
};

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

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

	offset_lpid = g_tw_mynode * nlp_per_pe;
	ttl_lps = tw_nnodes() * g_tw_npe * nlp_per_pe;
	g_tw_memory_nqueues = 1;
Example #10
0
	 (init_f) _rm_init,
	 (event_f) _rm_event_handler,
	 (revent_f) _rm_rc_event_handler,
	 (final_f) _rm_final,
	 (map_f) _rm_map,
	 sizeof(rm_state)},
	{0},
};

static unsigned int optimistic_memory = 0;

static const tw_optdef rm_options [] =
{
	TWOPT_UINT("memory", optimistic_memory, "Additional memory buffers"),
	TWOPT_STIME("threshold", g_rm_wave_threshold, "Wave propagation threshold"),
	TWOPT_CHAR("scenario", g_rm_spatial_scenario_fn, "Path to scenario files"),
	TWOPT_END()
};

void
rm_init(int * argc, char *** argv)
{
	/*
	 * Default Global Variables
	 */
	strcpy(g_rm_spatial_scenario_fn, "scenario");

	// add command line options
	tw_opt_add(rm_options);

	// Fix up global variables