void prepare_and_run_sampler(const unsigned long max_iterations, int append) { unsigned int n_beta = N_BETA; unsigned int i = 0; int n_swap = N_SWAP; mcmc ** chains = setup_chains(); debug("reading calibrations file") read_calibration_file(chains, n_beta); debug("opening dump files") mcmc_open_dump_files(chains[i], "-chain", i, (append == 1 ? "a" : "w")); #ifdef DUMP_ALL_CHAINS for (i = 1; i < n_beta; i++) { mcmc_open_dump_files(chains[i], "-chain", i, (append == 1 ? "a" : "w")); } #endif if (n_swap < 0) { n_swap = 2000 / n_beta; printf("automatic n_swap: %d\n", n_swap); } debug("running sampler") register_signal_handlers(); run_sampler(chains, n_beta, n_swap, max_iterations, (append == 1 ? "a" : "w")); debug("reporting") report((const mcmc **) chains, n_beta); for (i = 0; i < n_beta; i++) { mem_free(chains[i]->additional_data); if (i != 0) { /* this was reused, thus avoid double free */ set_data(chains[i], NULL); } chains[i] = mcmc_free(chains[i]); mem_free(chains[i]); } mem_free(chains); }
int main(){ omp_set_num_threads(35); //run_vanilla_nolemma(400,0.05); //run_vanilla(800,0.05); run_sampler(100000,0.03,100); }