static void add_strategies(const char *string, unsigned attr) { struct strategy *list = NULL; int list_alloc = 0, list_nr = 0, i; memset(&list, 0, sizeof(list)); split_merge_strategies(string, &list, &list_nr, &list_alloc); if (list) { for (i = 0; i < list_nr; i++) append_strategy(get_strategy(list[i].name)); return; } for (i = 0; i < ARRAY_SIZE(all_strategy); i++) if (all_strategy[i].attr & attr) append_strategy(&all_strategy[i]); }
void rec_ndfs_call (wctx_t *ctx, ref_t state) { cndfs_alg_local_t *cloc = (cndfs_alg_local_t *) ctx->local; alg_global_t *sm = ctx->global; strategy_t rec_strat = get_strategy (ctx->run->shared->rec->alg); dfs_stack_push (sm->rec->local->stack, (int*)&state); cloc->counters.rec++; switch (rec_strat) { case Strat_ENDFS: endfs_blue (sm->rec->run, sm->rec); break; case Strat_LNDFS: lndfs_blue (sm->rec->run, sm->rec); break; case Strat_NDFS: ndfs_blue (sm->rec->run, sm->rec); break; default: Abort ("Invalid recursive strategy."); } }
void ndfs_local_setup (run_t *run, wctx_t *ctx) { alg_local_t *loc = ctx->local; size_t local_bits = 2; int res = bitvector_create (&loc->color_map, local_bits<<dbs_size); HREassert (res != -1, "Failure to allocate a color_map bitvector."); if (all_red) res = bitvector_create (&loc->stackbits, MAX_STACK); HREassert (res != -1, "Failure to allocate a all_red bitvector."); loc->rec_bits = 0; loc->strat = get_strategy (run->alg); loc->seed = state_info_create (); size_t len = state_info_serialize_int_size (ctx->state); //state_info_add_simple (ctx->state, sizeof(int), &loc->bits); //state_info_add_simple (ctx->local->seed, sizeof(int), &loc->seed_bits); loc->stack = dfs_stack_create (len); }
void timed_run (run_t *run, wctx_t *ctx) { transition_info_t ti = GB_NO_TRANSITION; if ( Strat_PBFS & strategy[0] ) { ta_queue_state = pbfs_queue_state; } if (0 == ctx->id) { // only w1 receives load, as it is propagated later if ( Strat_PBFS & strategy[0] ) { if (ctx->local->lts != NULL) { state_data_t initial = state_info_state(ctx->initial); int src_owner = ref_hash(ctx->initial->ref) % W; lts_write_init (ctx->local->lts, src_owner, initial); } } ta_handle (ctx, ctx->initial, &ti, 0); ctx->counters->trans = 0; //reset trans count } HREbarrier (HREglobal()); switch (get_strategy(run->alg)) { case Strat_TA_PBFS: ta_pbfs (ctx); break; case Strat_TA_SBFS: ta_sbfs (ctx); break; case Strat_TA_BFS: ta_bfs (ctx); break; case Strat_TA_DFS: ta_dfs (ctx); break; default: Abort ("Missing case in timed_run"); } }
static int option_parse_strategy(const struct option *opt, const char *name, int unset) { int i; struct strategy *s; if (unset) return 0; s = get_strategy(name); if (s) append_strategy(s); else { struct strbuf err; strbuf_init(&err, 0); for (i = 0; i < ARRAY_SIZE(all_strategy); i++) strbuf_addf(&err, " %s", all_strategy[i].name); fprintf(stderr, "Could not find merge strategy '%s'.\n", name); fprintf(stderr, "Available strategies are:%s.\n", err.buf); exit(1); } return 0; }
bool Backtester::should_run (Index k) { return (_time == 0) || ((get_strategy(k)->rebalanced) && (_time % get_strategy(k)->frequency == 0)); }
/** * TBD * * @param w TBD * @param data TBD */ static void on_ok_clicked( GtkWidget * w, gpointer data ) { config.level = get_level( ); config.strategy = get_strategy( ); gtk_widget_destroy( dlg_settings ); } // on_ok_clicked