HiRep 0.1
Loading...
Searching...
No Matches
global.h
Go to the documentation of this file.
1/***************************************************************************\
2* Copyright (c) 2008, Claudio Pica *
3* All rights reserved. *
4\***************************************************************************/
5
11#ifndef GLOBAL_H
12#define GLOBAL_H
13
14//this file needs check_options to be included
15//because check_options makes some other definitions
16//based on the compilation options
17#include "check_options.h"
18#include "core_utils.h"
19
20#include "geometry.h"
21#include <stddef.h>
22#include "flags.h"
23
24#ifndef M_PI
25// Define M_PI if its not part of the C standard
26#define M_PI 3.14159265358979323846264338327
27#endif
28
29// Allow also to use PI for M_PI
30#define PI M_PI
31
32/* local lattice attributes */
33GLB_VAR(int, T, = 0); /* local lattice size in direction T */
34GLB_VAR(int, X, = 0); /* local lattice size in direction X */
35GLB_VAR(int, Y, = 0); /* local lattice size in direction Y */
36GLB_VAR(int, Z, = 0); /* local lattice size in direction Z */
37GLB_VAR(long int, GLB_VOL3, = 0);
38GLB_VAR(long int, GLB_VOLUME, = 0);
39/* this two probably are not more needed... */
40GLB_VAR(long int, VOL3, = 0);
41GLB_VAR(long int, VOLUME, = 0);
42
43/* Nodes attributes
44 * NP = number of processes in each direction
45 * 1 => local direction
46 */
47GLB_VAR(int, NP_T, = 1); /* number of processes in direction T */
48GLB_VAR(int, NP_X, = 1); /* number of processes in direction X */
49GLB_VAR(int, NP_Y, = 1); /* number of processes in direction Y */
50GLB_VAR(int, NP_Z, = 1); /* number of processes in direction Z */
51
52/* global MPI arrangment attributes */
53GLB_VAR(int, MPI_BLK_T, = 1); /* MPI arrangment size of the sub-block in direction T */
54GLB_VAR(int, MPI_BLK_X, = 1); /* MPI arrangment size of the sub-block in direction X */
55GLB_VAR(int, MPI_BLK_Y, = 1); /* MPI arrangment size of the sub-block in direction Y */
56GLB_VAR(int, MPI_BLK_Z, = 1); /* MPI arrangment size of the sub-block in direction Z */
57
58/* global lattice attributes */
59GLB_VAR(int, GLB_T, = 0); /* global size of the lattice in direction T */
60GLB_VAR(int, GLB_X, = 0); /* global size of the lattice in direction X */
61GLB_VAR(int, GLB_Y, = 0); /* global size of the lattice in direction Y */
62GLB_VAR(int, GLB_Z, = 0); /* global size of the lattice in direction Z */
63
64GLB_VAR(int, T_BORDER, = 0);
65GLB_VAR(int, X_BORDER, = 0);
66GLB_VAR(int, Y_BORDER, = 0);
67GLB_VAR(int, Z_BORDER, = 0);
68
69GLB_VAR(int, T_EXT, = 0);
70GLB_VAR(int, X_EXT, = 0);
71GLB_VAR(int, Y_EXT, = 0);
72GLB_VAR(int, Z_EXT, = 0);
73
74/*path blocking size*/
75GLB_VAR(int, PB_T, = 2);
76GLB_VAR(int, PB_X, = 2);
77GLB_VAR(int, PB_Y, = 2);
78GLB_VAR(int, PB_Z, = 2);
79
80/* MPI stuff */
81GLB_VAR(int, WORLD_SIZE, = 1); /* mpi rank for this process */
82GLB_VAR(int, CART_SIZE, = 1); /* mpi rank for this process */
83GLB_VAR(int, N_REP, = 1); /* number of replicas*/
84GLB_VAR(int, MPI_WORLD_SIZE, = 1); /* mpi rank for this process */
85GLB_VAR(int, MPI_PID, = 0); /* mpi rank inside MPI_COMM_WORLD (unique across replicas) */
86#ifdef WITH_MPI
87#include <hr_mpi.h>
88GLB_VAR(MPI_Comm, GLB_COMM, = MPI_COMM_WORLD); /* this is the global communicator for a replica */
89GLB_VAR(MPI_Comm, cart_comm, = MPI_COMM_NULL); /* cartesian communicator for the replica */
90#endif
91
92GLB_VAR(int, RID, = 0); /* Replica ID of this process */
93GLB_VAR(int, PID, = 0); /* Process ID inside a replica */
94GLB_VAR(int, LID, = 0); /* Process ID inside a replica local to the node */
95
96GLB_VAR(int, CID, = 0); /* Cartesian ID inside a replica */
97GLB_VAR(int, COORD[4], = { 0 }); /* cartesian coordinates for this process */
98GLB_VAR(int, PSIGN, = 0); /* parity of this process */
99
100/* Geometry indexes */
101GLB_VAR(int, *ipt, = NULL);
102GLB_VAR(int, *ipt_4d, = NULL); //CP: is this used?
103GLB_VAR(int, *iup, = NULL);
104GLB_VAR(int, *idn, = NULL);
105GLB_VAR(char, *imask, = NULL);
106GLB_VAR(int, zerocoord[4], = { 0, 0, 0, 0 });
107GLB_VAR(int, *timeslices, = NULL);
108
109GLB_VAR(int, BLK_T, = 4);
110GLB_VAR(int, BLK_X, = 4);
111GLB_VAR(int, BLK_Y, = 4);
112GLB_VAR(int, BLK_Z, = 4);
113
114#define BLK_T_GPU 4
115#define BLK_X_GPU 4
116#define BLK_Y_GPU 4
117#define BLK_Z_GPU 4
118
119/* Geometry structures */
120GLB_VAR(geometry_descriptor, glattice, = { 0 }); /* global lattice */
121GLB_VAR(geometry_descriptor, glat_even, = { 0 }); /* global even lattice */
122GLB_VAR(geometry_descriptor, glat_odd, = { 0 }); /* global odd lattice */
123GLB_VAR(geometry_descriptor, glat_even_red, = { 0 });
124GLB_VAR(geometry_descriptor, glat_odd_red, = { 0 });
125GLB_VAR(geometry_descriptor, glat_even_black, = { 0 });
126GLB_VAR(geometry_descriptor, glat_odd_black, = { 0 });
127GLB_VAR(geometry_descriptor, glat_red, = { 0 });
128GLB_VAR(geometry_descriptor, glat_black, = { 0 });
129
130// new geometry structure
131GLB_VAR(box_t *, geometryBoxes, );
132GLB_VAR(box_t *, geometryBoxes_gpu, );
133GLB_VAR(coord4 *, icoord_gpu, );
134GLB_VAR(coord4 *, sb_icoord_gpu, );
135
136#ifdef UPDATE_EO
137#define glat_default glat_even
138#else
139#define glat_default glattice
140#endif
141
142#ifdef WITH_GPU
143#define STD_MEM_TYPE (CPU_MEM | GPU_MEM)
144#include "gpu.h"
145#define BLOCK_SIZE 256
146#define BLOCK_SIZE_LINEAR_ALGEBRA 256
147#define BLOCK_SIZE_GLOBAL_SUM 512
148#define BLOCK_SIZE_DIRAC 256
149#define BLOCK_SIZE_CLOVER 256
150#define BLOCK_SIZE_DIRAC_FLT 512
151#define BLOCK_SIZE_SYNC 32
152
153GLB_VAR(cudaStream_t, non_default_stream, = NULL);
154GLB_VAR(cudaStream_t, memory_streams[16]);
155GLB_VAR(kernel_field_input, **input, = NULL);
156
157GLB_VAR(input_gpu, gpu_var, = init_input_gpu(gpu_var));
158GLB_VAR(int, gpu_id, = 0);
159GLB_VAR(int, *ipt_gpu, = NULL);
160GLB_VAR(int, *iup_gpu, = NULL);
161GLB_VAR(int, *idn_gpu, = NULL);
162GLB_VAR(char, *imask_gpu, = NULL);
163GLB_VAR(unsigned int, grid_size_max_gpu, = 65535);
164GLB_VAR(int, *timeslices_gpu, = NULL);
165#else
166#define STD_MEM_TYPE (CPU_MEM)
167#endif
168GLB_VAR(mem_t, std_mem_t, = STD_MEM_TYPE); /* default memory allocation type for fields */
169GLB_VAR(mem_t, alloc_mem_t, = STD_MEM_TYPE); /* memory type requested for allocating fields */
170
171/* Communicate only the CPU or only the GPU copy depending
172 on compilation variables. This allows also to communicate
173 both for testing purposes.*/
174#ifndef WITH_GPU
175GLB_VAR(comm_t, std_comm_t, = CPU_COMM);
176#else
177GLB_VAR(comm_t, std_comm_t, = GPU_COMM);
178#endif
179
180/* Gauge field */
181#include "suN_types.h"
182#include "spinor_field.h"
183
184GLB_VAR(suNg_field, *u_gauge, = NULL);
185GLB_VAR(suNg_scalar_field, *u_scalar, = NULL);
186GLB_VAR(suNg_field_flt, *u_gauge_flt, = NULL);
187GLB_VAR(suNf_field, *u_gauge_f, = NULL);
188GLB_VAR(suNg_field, *u_gauge_s, = NULL);
189GLB_VAR(suNf_field_flt, *u_gauge_f_flt, = NULL);
190GLB_VAR(clover_term, *cl_term, = NULL);
191#if defined(WITH_EXPCLOVER) && defined(WITH_GPU)
192GLB_VAR(clover_term, *cl_term_expAplus, = NULL);
193GLB_VAR(clover_term, *cl_term_expAminus, = NULL);
194GLB_VAR(clover_term, *cl_term_expAplusinv, = NULL);
195GLB_VAR(clover_term, *cl_term_expAminusinv, = NULL);
196#endif
197GLB_VAR(clover_force, *cl_force, = NULL);
198GLB_VAR(ldl_field, *cl_ldl, = NULL);
199GLB_VAR(suNg_av_field, *suN_momenta, = NULL);
200GLB_VAR(suNg_scalar_field, *scalar_momenta, = NULL);
201GLB_VAR(int, gauge_field_active, = 0); // whether gauge field interactions is active
202
203#define pu_gauge(ix, mu) ((u_gauge->ptr) + coord_to_index(ix, mu))
204#define pu_scalar(ix) ((u_scalar->ptr) + ix)
205#define pu_gauge_flt(ix, mu) ((u_gauge_flt->ptr) + coord_to_index(ix, mu))
206#define pu_gauge_f(ix, mu) ((u_gauge_f->ptr) + coord_to_index(ix, mu))
207#define pu_gauge_f_flt(ix, mu) ((u_gauge_f_flt->ptr) + coord_to_index(ix, mu))
208
209/* input parameters */
210#include "IO/input_par.h"
211GLB_VAR(input_glb, glb_var, = init_input_glb(glb_var));
212
213/* Random number generator parameters */
214GLB_VAR(input_rlx, rlx_var, = init_input_rlx(rlx_var));
215
216/* logger parameters */
217GLB_VAR(input_logger, logger_var, = init_input_logger(logger_var));
218
219/* Does the represented field need to be allocated? */
220#if (!defined(REPR_FUNDAMENTAL) && !defined(WITH_QUATERNIONS)) || defined(BC_T_SF_ROTATED)
221#define ALLOCATE_REPR_GAUGE_FIELD
222#endif
223
224GLB_VAR(double, *plaq_weight, = NULL);
225GLB_VAR(double, *rect_weight, = NULL);
226GLB_VAR(double, *plaq_weight_gpu, = NULL);
227GLB_VAR(double, *rect_weight_gpu, = NULL);
228
229/* Theta Boundary conditions */
230#ifdef FERMION_THETA
231GLB_VAR(hr_complex, eitheta[4], = { 1.0, 1.0, 1.0, 1.0 });
232#endif
233
234#ifdef MEASURE_FORCE
235#define MEASURE_FORCE0
236#define MEASURE_FORCEHMC
237GLB_VAR(double, *force_ave, = NULL);
238GLB_VAR(double, *force_max, = NULL);
239GLB_VAR(int, *n_inv_iter, = NULL);
240#endif
241
242/* Fields four fermion interactions */
243/* Auxiliary fields for four fermion interactions */
244GLB_VAR(scalar_field, *ff_sigma, = NULL);
245GLB_VAR(scalar_field, *ff_pi, = NULL);
246GLB_VAR(scalar_field, *ff_sigma_mom, = NULL);
247GLB_VAR(scalar_field, *ff_pi_mom, = NULL);
248
249GLB_VAR(int, four_fermion_active, = 0); // whether four fermion interactions are active
250
251#ifndef THREADSIZE
252#define THREADSIZE 32
253#endif
254#endif
Validation checks of the input parameters specified in the input file and error messages that give in...
Macros to declare global variables.
Global flags that indicate for example that a certain field has been updated.
This file contains information on the geometry of the local lattice, block decomposed geometry,...
Basic gpu imports and structs. Include this in files that define GPU logic.
Setup for mpi.
The elementary site structures defined in suN.h are used in this file to define field structures that...
Definition gpu_geometry.h:54
Definition new_geometry.h:56
Clover Force.
Definition spinor_field.h:304
Clover term.
Definition spinor_field.h:288
Definition new_geometry.h:39
This struct should contain all information necessary to perform operations on the local lattice inclu...
Definition geometry_descriptor.h:106
Definition input_par.h:23
Definition gpu.h:37
Definition input_par.h:82
Definition input_par.h:59
LDL decomposition field needed for clover improvement.
Definition spinor_field.h:256
Scalar field of double precision real values.
Definition spinor_field.h:240
Single precision gauge field in the chosen fermion representation.
Definition spinor_field.h:171
Gauge field in chosen fermion representation.
Definition spinor_field.h:153
Field of SU(N_g) algebra vectors.
Definition spinor_field.h:224
Gauge field of single precision SU(N_g) matrices.
Definition spinor_field.h:135
Gauge field of SU(N_g) matrices.
Definition spinor_field.h:98
SU(N_g) scalar field of SU(N_g) vectors.
Definition spinor_field.h:117