unsigned char * generate_random_data(struct generator * g, unsigned int nbytes) { unsigned char * b; unsigned long new_key[2]; b = malloc(nbytes + 16); generate_blocks(g, nbytes/16, b); generate_blocks(g, 2, new_key); memcpy(g->key, new_key, 16); return b; }
int main(int argc, char **argv) { unsigned block_count; // Initialize the MPI environment MPI_Init(NULL, NULL); // Get the number of processes int proc_cnt; MPI_Comm_size(MPI_COMM_WORLD, &proc_cnt); // Get the rank of the process int proc_id; MPI_Comm_rank(MPI_COMM_WORLD, &proc_id); //~ printf("Hello world from processor %d out of %d processors\n", proc_id, proc_cnt); int width, height, seed; if(argc < 4) { printf("run program: %s WIDTH HEIGHT SEED\n", argv[0]); return 1; } //~ printf("enter width: "); //~ scanf("%d", &width); //~ printf("enter height: "); //~ scanf("%d", &height); //~ printf("enter seed: "); //~ scanf("%d", &seed); sscanf(argv[1], "%d", &width); sscanf(argv[2], "%d", &height); sscanf(argv[3], "%d", &seed); //~ Tetromino_block * all_blocks = generate_blocks(WIDTH, HEIGHT, SEED, block_count); Tetromino_block * all_blocks = generate_blocks(width, height, seed, block_count); //~ Problem * problem = init_problem(all_blocks, block_count, WIDTH, HEIGHT, proc_cnt, proc_id); Problem * problem = init_problem(all_blocks, block_count, width, height, proc_cnt, proc_id); unsigned * parcial_solution = new unsigned[problem->cells/TETROMINO_SIZE]; solve(problem, parcial_solution, 0); int sig_index = problem->tree->best_posib_sig; if(problem->best_solution_src == problem->proc_id) { usleep(100); printf("\n----- END ----- END ----- END ----- END ----- END ----- END ----- END -----\n"); printf("width: %d, height %d, seed %d\n", width, height, seed); printf("best posible price %f, disb: %d, level %d\n", problem->tree->best_posib_price, problem->tree->signatures[sig_index].disbalance, problem->tree->signatures[sig_index].level); print_best_solution(problem); } delete_problem(problem); delete [] parcial_solution; delete [] all_blocks; // Finalize the MPI environment. MPI_Finalize(); return 0; }
void database_fixture::set_price_feed(const price &new_price) { try { for (int i = 1; i < 8; i++) { feed_publish_operation op; op.publisher = STEEMIT_INIT_MINER_NAME + fc::to_string(i); op.exchange_rate = new_price; trx.operations.push_back(op); trx.set_expiration(db.head_block_time() + STEEMIT_MAX_TIME_UNTIL_EXPIRATION); db.push_transaction(trx, ~0); trx.operations.clear(); } } FC_CAPTURE_AND_RETHROW((new_price)) generate_blocks(STEEMIT_BLOCKS_PER_HOUR); #ifdef STEEMIT_BUILD_TESTNET BOOST_REQUIRE(!db.skip_price_feed_limit_check || db.get(feed_history_id_type()).current_median_history == new_price); #else BOOST_REQUIRE(db.get(feed_history_id_type()).current_median_history == new_price); #endif }
void wait_for_maintenance() { generate_blocks( db.get_dynamic_global_properties().next_maintenance_time ); generate_block(); }
void wait_for_hf_core_216() { generate_blocks( HARDFORK_CORE_216_TIME ); generate_block(); }
void expire_feed() { generate_blocks(db.head_block_time() + GRAPHENE_DEFAULT_PRICE_FEED_LIFETIME); generate_block(); FC_ASSERT( swan().bitasset_data(db).current_feed.settlement_price.is_null() ); }