15constexpr double mintime = 1000;
21static inline double timediff(timeval start, timeval end) {
22 long long t1 = (
long long)(start.tv_usec) + 1000000 * (
long long)(start).tv_sec;
23 long long t2 = (
long long)(end.tv_usec) + 1000000 * (
long long)(end).tv_sec;
24 return 1e-3 * (double)(t2 - t1);
35#define MADD(x) (MSIZE + x)
48int main(
int argc,
char **argv) {
51 struct timeval start, end;
57 lattice.
setup(latsize);
63 for (n_runs = 1; timing < mintime;) {
65 gettimeofday(&start, NULL);
66 for (
int i = 0; i < n_runs; i++) {
68 for (
int a = 0; a < 4; a++)
69 for (
int b = 0; b < 4; b++)
70 matd[X].e(a, b) = a + b;
74 gettimeofday(&end, NULL);
75 timing = timediff(start, end);
77 timing = timing / (double)n_runs;
78 hila::out0 <<
"4x4 matrix index .e : " << timing <<
" ms \n";
98 for (n_runs = 1; timing < mintime;) {
100 gettimeofday(&start, NULL);
101 for (
int i = 0; i < n_runs; i++) {
102 matrix1[
ALL] = matrix1[X].dagger() * matrix1[X] * matrix1[X].dagger();
105 gettimeofday(&end, NULL);
106 timing = timediff(start, end);
108 timing = timing / (double)n_runs;
109 hila::out0 <<
"matrix size " << (int)MSIZE <<
"*" << (
int)MSIZE <<
" : " << timing
116 for (n_runs = 1; timing < mintime;) {
118 gettimeofday(&start, NULL);
119 for (
int i = 0; i < n_runs; i++) {
120 matrix2[
ALL] = matrix2[X].dagger() * matrix2[X] * matrix2[X].dagger();
123 gettimeofday(&end, NULL);
124 timing = timediff(start, end);
126 timing = timing / (double)n_runs;
127 hila::out0 <<
"matrix size " << (int)MSIZE + 1 <<
"*" << (
int)MSIZE + 1 <<
" : "
128 << timing <<
" ms \n";
134 for (n_runs = 1; timing < mintime;) {
136 gettimeofday(&start, NULL);
137 for (
int i = 0; i < n_runs; i++) {
138 matrix3[
ALL] = matrix3[X].dagger() * matrix3[X] * matrix3[X].dagger();
141 gettimeofday(&end, NULL);
142 timing = timediff(start, end);
144 timing = timing / (double)n_runs;
145 hila::out0 <<
"matrix size " << (int)MSIZE + 3 <<
"*" << (
int)MSIZE + 3 <<
" : "
146 << timing <<
" ms \n";
149 for (n_runs = 1; timing < mintime;) {
151 gettimeofday(&start, NULL);
152 for (
int i = 0; i < n_runs; i++) {
153 matrix4[
ALL] = matrix4[X].dagger() * matrix4[X] * matrix4[X].dagger();
156 gettimeofday(&end, NULL);
157 timing = timediff(start, end);
159 timing = timing / (double)n_runs;
160 hila::out0 <<
"matrix size " << (int)MSIZE + 6 <<
"*" << (
int)MSIZE + 6 <<
" : "
161 << timing <<
" ms \n";
167 for (n_runs = 1; timing < mintime;) {
169 gettimeofday(&start, NULL);
170 for (
int i = 0; i < n_runs; i++) {
171 matrix1[
ALL] = matrix1[X].adjoint() * matrix1[X] * matrix1[X].adjoint();
174 gettimeofday(&end, NULL);
175 timing = timediff(start, end);
177 timing = timing / (double)n_runs;
178 hila::out0 <<
"matrix size " << (int)MSIZE <<
"*" << (
int)MSIZE <<
" : " << timing
183 for (n_runs = 1; timing < mintime;) {
185 gettimeofday(&start, NULL);
186 for (
int i = 0; i < n_runs; i++) {
187 matrix2[
ALL] = matrix2[X].adjoint() * matrix2[X] * matrix2[X].adjoint();
190 gettimeofday(&end, NULL);
191 timing = timediff(start, end);
193 timing = timing / (double)n_runs;
194 hila::out0 <<
"matrix size " << (int)MSIZE + 1 <<
"*" << (
int)MSIZE + 1 <<
" : "
195 << timing <<
" ms \n";
199 for (n_runs = 1; timing < mintime;) {
201 gettimeofday(&start, NULL);
202 for (
int i = 0; i < n_runs; i++) {
203 matrix3[
ALL] = matrix3[X].adjoint() * matrix3[X] * matrix3[X].adjoint();
206 gettimeofday(&end, NULL);
207 timing = timediff(start, end);
209 timing = timing / (double)n_runs;
210 hila::out0 <<
"matrix size " << (int)MSIZE + 3 <<
"*" << (
int)MSIZE + 3 <<
" : "
211 << timing <<
" ms \n";
214 for (n_runs = 1; timing < mintime;) {
216 gettimeofday(&start, NULL);
217 for (
int i = 0; i < n_runs; i++) {
218 matrix4[
ALL] = matrix4[X].adjoint() * matrix4[X] * matrix4[X].adjoint();
221 gettimeofday(&end, NULL);
222 timing = timediff(start, end);
224 timing = timing / (double)n_runs;
225 hila::out0 <<
"matrix size " << (int)MSIZE + 6 <<
"*" << (
int)MSIZE + 6 <<
" : "
226 << timing <<
" ms \n";
The field class implements the standard methods for accessing Fields. Hilapp replaces the parity acce...
Matrix class which defines matrix operations.
void setup(const CoordinateVector &siz)
General lattice setup.
constexpr Parity ALL
bit pattern: 011
This file defines all includes for HILA.
This files containts definitions for the Field class and the classes required to define it such as fi...
Definition of Matrix types.
void synchronize()
synchronize mpi
std::ostream out0
This writes output only from main process (node 0)
void initialize(int argc, char **argv)
Read in command line arguments. Initialise default stream and MPI communication.
void seed_random(uint64_t seed, bool device_rng=true)
Seed random generators with 64-bit unsigned value. On MPI shuffles the seed so that different MPI ran...
void finishrun()
Normal, controlled exit - all nodes must call this. Prints timing information and information about c...