2
3
4
5
6
7
8
9
10
11
19
20
24 montecarlo::progression(1.0, 20, 20000,
25 "../output/burn_in_time/unordered_1_0.txt");
26 montecarlo::progression(1.0, 20, 20000, 1,
27 "../output/burn_in_time/ordered_1_0.txt");
28 montecarlo::progression(2.4, 20, 20000,
29 "../output/burn_in_time/unordered_2_4.txt");
30 montecarlo::progression(2.4, 20, 20000, 1,
31 "../output/burn_in_time/ordered_2_4.txt");
35
36
41 "../output/pd_estimate/estimate_1_0.txt");
43 "../output/pd_estimate/estimate_2_4.txt");
47
48
53 "../output/test_burn_in_time/burn_in.txt", 5000);
56 "../output/test_burn_in_time/no_burn_in.txt", 0);
67 for (size_t i = 0; i < tries; i++)
70 for (size_t i = 0; i < tries; i++)
74 std::cout <<
"Time serial : " << (t1 - t0) / tries <<
" seconds"
76 std::cout <<
"Time parallel : " << (t2 - t1) / tries <<
" seconds"
78 std::cout <<
"Speedup parallel: " << (t1 - t0) / (t2 - t1) <<
'\n';
82
91 "../output/phase_transition/size_20.txt");
94 "../output/phase_transition/size_40.txt");
97 "../output/phase_transition/size_60.txt");
100 "../output/phase_transition/size_80.txt");
103 "../output/phase_transition/size_100.txt");
104 t1 = omp_get_wtime();
106 std::cout <<
"Time: " << t1 - t0 << std::endl;
112 std::cout <<
"Usage: " << filename <<
" OPTION ...\n"
113 <<
"At least one option should be used.\n\n"
114 <<
"\t[ -h | --help ]\n"
116 <<
"\t[ --create-burn-in-data ]\n"
117 <<
"\t[ --create-pd-estimate-data ]\n"
118 <<
"\t[ --create-phase-transition-data ]\n"
119 <<
"\t[ --test-parallel-speedup ]\n"
120 <<
"\t[ --test-burn-in-time ]\n";
127 static struct option long_options[] = {
128 {
"all", no_argument, 0, 0},
129 {
"create-burn-in-data", no_argument, 0, 0},
130 {
"create-pd-estimate-data", no_argument, 0, 0},
131 {
"test-parallel-speedup", no_argument, 0, 0},
132 {
"create-phase-transition-data", no_argument, 0, 0},
133 {
"test-burn-in-time", no_argument, 0, 0},
134 {
"help", no_argument, 0, 0}};
136 int option_index = -1;
140 c = getopt_long(argc, argv,
"h", long_options, &option_index);
147 switch (option_index) {
Type to use with the IsingModel class and montecarlo module.
void test_parallel_speedup()
Test how much Openmp speeds up.
int main(int argc, char **argv)
The main function.
void create_pd_estimate_data()
Create the data used to estimate the probability distribution for tempratures 1.0 anbd 2....
void create_burn_in_time_data()
Create the data for the burn-in time for temperatures 1.0 and 2.4 for both unordered and ordered init...
void test_burn_in_time()
Create data using the same parameters except one uses burn-in time, while the other doesn't.
void create_phase_transition_data()
Create data for studying phase transition.
void usage(std::string filename)
A function that displays how to use the program and quits.
void phase_transition(int L, double start_T, double end_T, int points_T, int cycles, std::function< data_t(int, double, int, int)> monte_carlo, std::string outfile, int burn_in_time=BURN_IN_TIME)
Perform the MCMC algorithm using a range of temperatures.
data_t mcmc_parallel(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)
Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.
data_t mcmc_serial(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)
Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles.
void pd_estimate(double T, int L, int cycles, const std::string filename, int burn_in_time=BURN_IN_TIME)
Estimate the probability distribution for the energy.