/** * initializer for the UF array */ uf_t * uf_create () { HREassert (sizeof (uf_state_t) == sizeof (int[8]), "Improper structure for uf_state_t. Expected: size = %zu", sizeof (int[8])); uf_t *uf = RTmalloc (sizeof (uf_t)); uf->array = RTalignZero (sizeof(int[8]), sizeof (uf_state_t) * (1ULL << dbs_size) ); return uf; }
/** * initializer for the UF array */ uf_t * uf_create () { HREassert (sizeof (uf_state_t) == sizeof (int[8]), "Improper structure for uf_state_t. Expected: size = %zu", sizeof (int[8])); uf_t *uf = RTmalloc (sizeof (uf_t)); // allocate one entry extra since [0] is not used uf->array = RTalignZero (sizeof(int[8]), sizeof (uf_state_t) * ( (1ULL << dbs_size) + 1 ) ); return uf; }
static inline loc_t * get_local (treedbs_ll_t dbs) { loc_t *loc = HREgetLocal (dbs->local_key); if (loc == NULL) { loc = RTalign (CACHE_LINE_SIZE, sizeof (loc_t)); memset (loc, 0, sizeof (loc_t)); loc->storage = RTalign (CACHE_LINE_SIZE, sizeof (int[dbs->nNodes * 2])); loc->node_count = RTalignZero (CACHE_LINE_SIZE, sizeof (size_t[dbs->nNodes])); memset (loc->storage, -1, sizeof (int[dbs->nNodes * 2])); HREsetLocal (dbs->local_key, loc); } return loc; }
fset_t * fset_create (size_t key_length, size_t data_length, size_t init_size, size_t max_size) { HREassert (true == 1); HREassert (false == 0); HREassert (key_length > 0); HREassert (sizeof(mem_hash_t) == 4);// CACHE_MEM HREassert (max_size < 32); // FULL bit HREassert (init_size <= max_size); // precondition HREassert (init_size >= FSET_MIN_SIZE); // walk the line code fset_t *dbs = RTalign (CACHE_LINE_SIZE, sizeof(fset_t)); dbs->key_length = key_length; dbs->data_length = data_length; dbs->total_length = data_length + key_length; dbs->size_max = 1ULL << max_size; dbs->data = RTalign (CACHE_LINE_SIZE, dbs->total_length * dbs->size_max); dbs->todo_data = RTalign (CACHE_LINE_SIZE, dbs->total_length * dbs->size_max); dbs->hash = RTalignZero (CACHE_LINE_SIZE, sizeof(mem_hash_t) * dbs->size_max); dbs->todo = RTalign (CACHE_LINE_SIZE, 2 * sizeof(mem_hash_t) * dbs->size_max); dbs->delled_data = RTalign (CACHE_LINE_SIZE, data_length); dbs->init_size = 1ULL << init_size; dbs->init_size3 = dbs->init_size * 3; dbs->size = dbs->init_size; dbs->size3 = dbs->init_size3; dbs->mask = dbs->size - 1; dbs->load = 0; dbs->tombs = 0; dbs->resizing = 0; dbs->resizes = 0; dbs->max_grow = dbs->init_size; dbs->max_load = 0; dbs->max_todos = 0; dbs->lookups = 0; dbs->probes = 0; dbs->timer = RTcreateTimer (); //fset_clear (dbs); // mallocZero max_size = (size_t)fset_resize_names[0]; // avoid warning unused return dbs; }
permute_t * permute_create (permutation_perm_t permutation, model_t model, alg_state_seen_f ssf, int worker_index, void *run_ctx) { permute_t *perm = RTalign (CACHE_LINE_SIZE, sizeof(permute_t)); perm->todos = RTalign (CACHE_LINE_SIZE, sizeof(permute_todo_t[K+TODO_MAX])); perm->tosort = RTalign (CACHE_LINE_SIZE, sizeof(int[K+TODO_MAX])); perm->shift = ((double)K)/W; perm->shiftorder = (1UL<<dbs_size) / W * worker_index; perm->start_group = perm->shift * worker_index; perm->model = model; perm->state_seen = ssf; perm->por_proviso = 1; perm->permutation = permutation; perm->run_ctx = run_ctx; perm->next = state_info_create (); if (Perm_Otf == perm->permutation) perm->pad = RTalign (CACHE_LINE_SIZE, sizeof(int[K+TODO_MAX])); if (Perm_Random == perm->permutation) { perm->rand = RTalignZero (CACHE_LINE_SIZE, sizeof(int*[K+TODO_MAX])); for (size_t i = 1; i < K+TODO_MAX; i++) { perm->rand[i] = RTalign (CACHE_LINE_SIZE, sizeof(int[ i ])); randperm (perm->rand[i], i, perm->shiftorder); } } if (Perm_RR == perm->permutation) { perm->rand = RTalignZero (CACHE_LINE_SIZE, sizeof(int*)); perm->rand[0] = RTalign (CACHE_LINE_SIZE, sizeof(int[1<<RR_ARRAY_SIZE])); srandom (time(NULL) + 9876432*worker_index); for (int i =0; i < (1<<RR_ARRAY_SIZE); i++) perm->rand[0][i] = random(); } if (Perm_SR == perm->permutation || Perm_Dynamic == perm->permutation) { perm->rand = RTalignZero (CACHE_LINE_SIZE, sizeof(int*)); perm->rand[0] = RTalign (CACHE_LINE_SIZE, sizeof(int[K+TODO_MAX])); randperm (perm->rand[0], K+TODO_MAX, (time(NULL) + 9876*worker_index)); } perm->labels = lts_type_get_edge_label_count (GBgetLTStype(model)); for (size_t i = 0; i < K+TODO_MAX; i++) { if (act_detect || files[1] || (PINS_BUCHI_TYPE == PINS_BUCHI_TYPE_TGBA)) { perm->todos[i].ti.labels = RTmalloc (sizeof(int*[perm->labels])); } else { perm->todos[i].ti.labels = NULL; } } perm->class_label = lts_type_find_edge_label (GBgetLTStype(model),LTSMIN_EDGE_TYPE_ACTION_CLASS); if (inhibit){ int id=GBgetMatrixID(model,"inhibit"); if (id>=0){ perm->inhibit_matrix = GBgetMatrix (model, id); Warning(infoLong,"inhibit matrix is:"); if (log_active(infoLong)) dm_print (stderr, perm->inhibit_matrix); perm->inhibited_by = (ci_list **)dm_cols_to_idx_table (perm->inhibit_matrix); } else { Warning(infoLong,"no inhibit matrix"); } id = GBgetMatrixID(model,LTSMIN_EDGE_TYPE_ACTION_CLASS); if (id>=0){ perm->class_matrix=GBgetMatrix(model,id); Warning(infoLong,"inhibit class matrix is:"); if (log_active(infoLong)) dm_print(stderr,perm->class_matrix); } else { Warning(infoLong,"no inhibit class matrix"); } if (perm->class_label>=0) { Warning(infoLong,"inhibit class label is %d",perm->class_label); } else { Warning(infoLong,"no inhibit class label"); } } if (PINS_POR) por_set_find_state (state_find, perm); return perm; }