forked from etmc/tmLQCD
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_lemon.c
174 lines (146 loc) · 4.94 KB
/
test_lemon.c
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/***********************************************************************
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Carsten Urbach
*
* This file is part of tmLQCD.
*
* tmLQCD is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* tmLQCD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with tmLQCD. If not, see <http://www.gnu.org/licenses/>.
***********************************************************************/
/*******************************************************************************
*
* Benchmark program for the even-odd preconditioned Wilson-Dirac operator
*
*
*******************************************************************************/
#include <lime.h>
#ifdef HAVE_CONFIG_H
#include "tmlqcd_config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string.h>
#if (defined BGL && !defined BGP)
# include <rts.h>
#endif
#ifdef TM_USE_MPI
#include <mpi.h>
#endif
#include "su3.h"
#include "su3adj.h"
#include <io/params.h>
#include <io/gauge.h>
#include "ranlxd.h"
#include "geometry_eo.h"
#include "read_input.h"
#include "start.h"
#include "boundary.h"
#include "global.h"
#include "xchange/xchange.h"
#include "init/init.h"
#include "measure_gauge_action.h"
#include "mpi_init.h"
int main(int argc,char *argv[]) {
double plaquette_energy;
paramsXlfInfo *xlfInfo;
#ifdef TM_USE_MPI
MPI_Init(&argc, &argv);
#endif
g_rgi_C1 = 1.;
/* Read the input file */
read_input("benchmark.input");
tmlqcd_mpi_init(argc, argv);
#ifdef _GAUGE_COPY
init_gauge_field(VOLUMEPLUSRAND + g_dbw2rand, 1);
#else
init_gauge_field(VOLUMEPLUSRAND + g_dbw2rand, 0);
#endif
init_geometry_indices(VOLUMEPLUSRAND + g_dbw2rand);
if(g_proc_id == 0) {
fprintf(stdout,"The number of processes is %d \n",g_nproc);
printf("# The lattice size is %d x %d x %d x %d\n",
(int)(T*g_nproc_t), (int)(LX*g_nproc_x), (int)(LY*g_nproc_y), (int)(g_nproc_z*LZ));
printf("# The local lattice size is %d x %d x %d x %d\n",
(int)(T), (int)(LX), (int)(LY),(int) LZ);
printf("# Testing IO routines for gauge-fields\n");
fflush(stdout);
}
/* define the geometry */
geometry();
/* define the boundary conditions for the fermion fields */
boundary(g_kappa);
/* generate a random gauge field */
start_ranlux(1, 123456);
random_gauge_field(reproduce_randomnumber_flag, g_gauge_field);
#ifdef TM_USE_MPI
/*For parallelization: exchange the gaugefield */
xchange_gauge(g_gauge_field);
#endif
plaquette_energy = measure_plaquette(g_gauge_field) / (6.*VOLUME*g_nproc);
if(g_proc_id == 0) {
printf("# the first plaquette value is %e\n", plaquette_energy);
printf("# writing with lime first to conf.lime\n");
}
/* write with lime first */
xlfInfo = construct_paramsXlfInfo(plaquette_energy, 0);
write_lime_gauge_field( "conf.lime", 64, xlfInfo);
#ifdef HAVE_LIBLEMON
if(g_proc_id == 0) {
printf("Now we do write with lemon to conf.lemon...\n");
}
write_lemon_gauge_field_parallel( "conf.lemon", 64, xlfInfo);
if(g_proc_id == 0) {
printf("# now we read with lemon from conf.lime\n");
}
read_lemon_gauge_field_parallel("conf.lime", NULL, NULL, NULL);
plaquette_energy = measure_plaquette(g_gauge_field) / (6.*VOLUME*g_nproc);
if(g_proc_id == 0) {
printf("# the plaquette value after lemon read of conf.lime is %e\n", plaquette_energy);
}
if(g_proc_id == 0) {
printf("# now we read with lemon from conf.lemon\n");
}
read_lemon_gauge_field_parallel("conf.lemon", NULL, NULL, NULL);
plaquette_energy = measure_plaquette(g_gauge_field) / (6.*VOLUME*g_nproc);
if(g_proc_id == 0) {
printf("# the plaquette value after lemon read of conf.lemon is %e\n", plaquette_energy);
}
if(g_proc_id == 0) {
printf("# now we read with lime from conf.lemon\n");
}
read_lime_gauge_field("conf.lemon");
plaquette_energy = measure_plaquette(g_gauge_field) / (6.*VOLUME*g_nproc);
if(g_proc_id == 0) {
printf("# the plaquette value after lime read of conf.lemon is %e\n", plaquette_energy);
}
free(xlfInfo);
if(g_proc_id==0) {
printf("done ...\n");
}
#endif
if(g_proc_id == 0) {
printf("# now we read with lime from conf.lime\n");
}
read_lime_gauge_field("conf.lime", NULL, NULL, NULL);
plaquette_energy = measure_plaquette(g_gauge_field) / (6.*VOLUME*g_nproc);
if(g_proc_id == 0) {
printf("# the plaquette value after lime read of conf.lime is %e\n", plaquette_energy);
}
#ifdef TM_USE_MPI
MPI_Finalize();
#endif
free_gauge_field();
free_geometry_indices();
return(0);
}