forked from kostrzewa/tmLQCD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LapH_ev.c
214 lines (187 loc) · 5.33 KB
/
LapH_ev.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
/***********************************************************************
* 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/>.
***********************************************************************/
/*
* Program for computing the eigensystem of the Laplacian operator
* Authors Luigi Scorzato, Marco Cristoforetti
*
*
*******************************************************************************/
#define MAIN_PROGRAM
#ifdef HAVE_CONFIG_H
# include "config.h"
#else
#error "no 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 MPI
# include <mpi.h>
#endif
#include "global.h"
#include <io/params.h>
#include <io/gauge.h>
#include "su3.h"
#include "ranlxd.h"
#include "geometry_eo.h"
#include "read_input.h"
#include "start.h"
#include "xchange.h"
#include "init_gauge_field.h"
#include "init_geometry_indices.h"
#include "mpi_init.h"
#include "solver/eigenvalues_Jacobi.h"
#include "init_jacobi_field.h"
int main(int argc,char *argv[])
{
int tslice,j,k;
char conf_filename[50];
#ifdef MPI
MPI_Init(&argc, &argv);
#endif
/* Read the input file */
read_input("LapH.input");
tmlqcd_mpi_init(argc, argv);
if(g_proc_id==0) {
#ifdef SSE
printf("# The code was compiled with SSE instructions\n");
#endif
#ifdef SSE2
printf("# The code was compiled with SSE2 instructions\n");
#endif
#ifdef SSE3
printf("# The code was compiled with SSE3 instructions\n");
#endif
#ifdef P4
printf("# The code was compiled for Pentium4\n");
#endif
#ifdef OPTERON
printf("# The code was compiled for AMD Opteron\n");
#endif
#ifdef _GAUGE_COPY
printf("# The code was compiled with -D_GAUGE_COPY\n");
#endif
#ifdef BGL
printf("# The code was compiled for Blue Gene/L\n");
#endif
#ifdef BGP
printf("# The code was compiled for Blue Gene/P\n");
#endif
#ifdef _USE_HALFSPINOR
printf("# The code was compiled with -D_USE_HALFSPINOR\n");
#endif
#ifdef _USE_SHMEM
printf("# the code was compiled with -D_USE_SHMEM\n");
# ifdef _PERSISTENT
printf("# the code was compiled for persistent MPI calls (halfspinor only)\n");
# endif
#endif
#ifdef MPI
# ifdef _NON_BLOCKING
printf("# the code was compiled for non-blocking MPI calls (spinor and gauge)\n");
# endif
#endif
printf("\n");
fflush(stdout);
}
#ifndef WITHLAPH
printf(" Error: WITHLAPH not defined");
exit(0);
#endif
#ifdef MPI
#ifndef _INDEX_INDEP_GEOM
printf(" Error: _INDEX_INDEP_GEOM not defined");
exit(0);
#endif
#ifndef _USE_TSPLITPAR
printf(" Error: _USE_TSPLITPAR not defined");
exit(0);
#endif
#endif
#ifdef FIXEDVOLUME
printf(" Error: FIXEDVOLUME not allowed");
exit(0);
#endif
init_gauge_field(VOLUMEPLUSRAND + g_dbw2rand, 0);
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("# Computing LapH eigensystem \n");
fflush(stdout);
}
/* define the geometry */
geometry();
start_ranlux(1, 123456);
/* Read Gauge field */
sprintf(conf_filename, "%s.%.4d", gauge_input_filename, nstore);
if (g_cart_id == 0) {
printf("#\n# Trying to read gauge field from file %s in %s precision.\n",
conf_filename, (gauge_precision_read_flag == 32 ? "single" : "double"));
fflush(stdout);
}
if( (j = read_gauge_field(conf_filename)) !=0) {
fprintf(stderr, "Error %d while reading gauge field from %s\n Aborting...\n", j, conf_filename);
exit(-2);
}
if (g_cart_id == 0) {
printf("# Finished reading gauge field.\n");
fflush(stdout);
}
#ifdef MPI
/*For parallelization: exchange the gaugefield */
xchange_gauge(g_gauge_field);
#endif
/* Init Jacobi field */
init_jacobi_field(SPACEVOLUME+SPACERAND,3);
#ifdef MPI
{
/* for debugging in parallel set i_gdb = 0 */
volatile int i_gdb = 8;
char hostname[256];
gethostname(hostname, sizeof(hostname));
printf("PID %d on %s ready for attach\n", getpid(), hostname);
fflush(stdout);
if(g_cart_id == 0){
while (0 == i_gdb){
sleep(5);
}
}
}
MPI_Barrier(MPI_COMM_WORLD);
#endif
for (k=0 ; k<3 ; k++)
random_jacobi_field(g_jacobi_field[k],SPACEVOLUME);
/* Compute LapH Eigensystem */
for(tslice=0; tslice<T; tslice++){
eigenvalues_Jacobi(&no_eigenvalues,5000, eigenvalue_precision,0,tslice,nstore);
}
#ifdef MPI
MPI_Finalize();
#endif
return(0);
}