Fix programs

This commit is contained in:
2023-12-05 15:30:07 +01:00
parent 5915b9ae2d
commit 43c02ad3fa
2 changed files with 37 additions and 13 deletions

View File

@@ -21,21 +21,25 @@
* */
void time_lattice_sizes()
{
std::string outfile = "data/timing/lattice_sizes.txt";
std::string outfile = "data/hp/timing/lattice_sizes.txt";
std::ofstream ofile;
int lattice_sizes[] = {20, 40, 60, 80, 100};
utils::mkpath(utils::dirname(outfile));
ofile.open(outfile);
double t0, t1;
double t0, t1, t2;
for (int L : lattice_sizes) {
t0 = omp_get_wtime();
montecarlo::phase_transition(L, 2.1, 2.4, 40, 100000,
montecarlo::mcmc_parallel, "/dev/null");
montecarlo::phase_transition(L, 2.1, 2.4, 40, 20000,
montecarlo::mcmc_parallel, "/dev/null", 0);
t1 = omp_get_wtime();
montecarlo::phase_transition(L, 2.1, 2.4, 40, 20000,
montecarlo::mcmc_serial, "/dev/null", 0);
t2 = omp_get_wtime();
ofile << utils::scientific_format(L) << ','
<< utils::scientific_format(t1 - t0) << '\n';
<< utils::scientific_format(t1 - t0) << ','
<< utils::scientific_format(t2 - t1) << '\n';
}
ofile.close();
}
@@ -44,21 +48,25 @@ void time_lattice_sizes()
* */
void time_sample_sizes()
{
std::string outfile = "data/timing/sample_sizes.txt";
std::string outfile = "data/hp/timing/sample_sizes.txt";
std::ofstream ofile;
int sample_sizes[] = {1000, 10000, 100000};
utils::mkpath(utils::dirname(outfile));
ofile.open(outfile);
double t0, t1;
double t0, t1, t2;
for (int samples : sample_sizes) {
t0 = omp_get_wtime();
montecarlo::phase_transition(20, 2.1, 2.4, 40, samples,
montecarlo::mcmc_parallel, "/dev/null");
montecarlo::mcmc_parallel, "/dev/null", 0);
t1 = omp_get_wtime();
montecarlo::phase_transition(20, 2.1, 2.4, 40, samples,
montecarlo::mcmc_serial, "/dev/null", 0);
t2 = omp_get_wtime();
ofile << utils::scientific_format(samples) << ','
<< utils::scientific_format(t1 - t0) << '\n';
<< utils::scientific_format(t1 - t0) << ','
<< utils::scientific_format(t2 - t1) << '\n';
}
ofile.close();
}