-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbenchmark.cpp
More file actions
55 lines (42 loc) · 1.19 KB
/
benchmark.cpp
File metadata and controls
55 lines (42 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// SPDX-License-Identifier: Apache-2.0
// Copyright Contributors to the OpenQMC Project.
#include <benchmark.h>
#include <cstdio>
#include <cstdlib>
int main(int argc, char* argv[])
{
if(argc == 1)
{
std::fprintf(stderr,
"No arguments passed; "
"user must specify a sampler and a measurement.\n");
return EXIT_FAILURE;
}
if(argc < 3)
{
std::fprintf(stderr,
"Too few arguments passed; "
"user must specify a sampler and a measurement.\n");
return EXIT_FAILURE;
}
if(argc > 3)
{
std::fprintf(stderr,
"Too many arguments passed; "
"user must specify a sampler and a measurement.\n");
return EXIT_FAILURE;
}
constexpr auto nsamples = 1 << 15; // 32k
constexpr auto ndims = 256;
int time;
if(!oqmc_benchmark(argv[1], argv[2], nsamples, ndims, &time))
{
std::fprintf(stderr, "Configuration that was requested was not found; "
"sampler options are pmj, pmjbn, sobol, sobolbn, "
"lattice, latticebn; "
"measurement options are init, samples.\n");
return EXIT_FAILURE;
}
std::printf("%i\n", time);
return EXIT_SUCCESS;
}