su2hmc
Loading...
Searching...
No Matches
par_mpi.h
Go to the documentation of this file.
1
8#ifndef PAR_MPI
9#define PAR_MPI
10#include <coord.h>
11#include <errorcodes.h>
12#if (nproc >1)
13#include <mpi.h>
14#endif
15#ifdef _OPENMP
16#include <omp.h>
17#endif
18//#include <random.h>
19#ifdef __cplusplus
20#include <cstdio>
21#include <cstdlib>
22#include <cstring>
23#else
24#include <stdalign.h>
25#include <stdbool.h>
26#include <stdio.h>
27#include <stdlib.h>
28#include <string.h>
29#endif
30
32#define MPI_Finalise() MPI_Finalize()
33
34//Definitions
35//==========
37#define DOWN 0
39#define UP 1
40
42#define masterproc 0
43
45#define tag 0
46//#define _STAT_SIZE_ sizeof(MPI_Status)
47//Variables
48//=========
49//Up/Down arrays
51extern int __attribute__((aligned(AVX))) pu[ndim];
53extern int __attribute__((aligned(AVX))) pd[ndim];
54
55//MPI Stuff
56#if (nproc >1)
58extern MPI_Comm comm ;
60extern MPI_Request request;
61#endif
62
64extern int *pcoord;
66extern int __attribute__((aligned(AVX))) pstart[ndim][nproc];
68extern int __attribute__((aligned(AVX))) pstop[ndim][nproc];
70extern int rank;
72extern int size;
73//The common keyword from fortran is largely redundant here as everything
74//is already global scope.
75
76/*common /par/ pu, pd, procid, comm,
77 1 gsize, lsize, pcoord, pstart, pstop,
78 1 ismaster, masterproc
79 */
80
81#ifdef __cplusplus
82extern "C"
83{
84#endif
85 //Function Declarations
86 //=====================
97 int Par_begin(int argc, char *argv[]);
114 int Par_sread(const int iread, const float beta, const float fmu, const float akappa, const Complex_f ajq,\
115 const float c_sw, Complex *u11, Complex *u12, Complex *u11t, Complex *u12t);
134 int Par_swrite(const int itraj, const int icheck, const float beta, const float fmu, const float akappa,\
135 const Complex_f ajq, const float c_sw, Complex *u11, Complex *u12);
136 //Shortcuts for reductions and broadcasts. These should be inlined
148 int Par_isum(int *ival);
161 int Par_dsum(double *dval);
174 int Par_fsum(float *dval);
187 int Par_csum(Complex_f *cval);
200 int Par_zsum(Complex *zval);
210 int Par_icopy(int *ival);
220 int Par_dcopy(double *dval);
230 int Par_fcopy(float *fval);
240 int Par_ccopy(Complex *cval);
250 int Par_zcopy(Complex *zval);
251 //Halo Manipulation
262 int ZHalo_swap_all(Complex *z, int ncpt);
276 int ZHalo_swap_dir(Complex *z, int ncpt, int idir, int layer);
287 int CHalo_swap_all(Complex_f *c, int ncpt);
301 int CHalo_swap_dir(Complex_f *c, int ncpt, int idir, int layer);
312 int DHalo_swap_all(double *d, int ncpt);
326 int DHalo_swap_dir(double *d, int ncpt, int idir, int layer);
337 int SHalo_swap_all(float *d, int ncpt);
351 int SHalo_swap_dir(float *d, int ncpt, int idir, int layer);
367 int Trial_Exchange(Complex *ut[2], Complex_f *ut_f[2]);
368 //If we have more than two processors on the time axis, there's an extra step in the Polyakov loop calculation
369#if(npt>1)
379 int Par_tmul(Complex_f *z11, Complex_f *z12);
380#endif
381#ifdef __cplusplus
382}
383#endif
384#endif
Header for routines related to lattice sites.
This header is intended to be a useful reference for error codes and their meanings.
int CHalo_swap_all(Complex_f *c, int ncpt)
Calls the functions to send data to both the up and down halos.
int Par_fcopy(float *fval)
Broadcasts a float to the other processes.
int ZHalo_swap_all(Complex *z, int ncpt)
Calls the functions to send data to both the up and down halos.
int Par_fsum(float *dval)
Performs a reduction on a float dval to get a sum which is then distributed to all ranks.
int Par_dcopy(double *dval)
Broadcasts a double to the other processes.
int Par_begin(int argc, char *argv[])
Initialises the MPI configuration.
Definition par_mpi.c:24
int Par_swrite(const int itraj, const int icheck, const float beta, const float fmu, const float akappa, const Complex_f ajq, const float c_sw, Complex *u11, Complex *u12)
Copies u11 and u12 into arrays without halos which then get written to output.
Definition par_mpi.c:324
int Par_isum(int *ival)
Performs a reduction on an integer ival to get a sum which is then distributed to all ranks.
int Par_icopy(int *ival)
Broadcasts an integer to the other processes.
int ZHalo_swap_dir(Complex *z, int ncpt, int idir, int layer)
Swaps the halos along the axis given by idir in the direction given by layer.
int Par_ccopy(Complex *cval)
Broadcasts a complex float to the other processes.
int Par_zcopy(Complex *zval)
Broadcasts a complex double to the other processes.
int DHalo_swap_all(double *d, int ncpt)
Calls the functions to send data to both the up and down halos.
int SHalo_swap_all(float *d, int ncpt)
Calls the functions to send data to both the up and down halos.
int SHalo_swap_dir(float *d, int ncpt, int idir, int layer)
Swaps the halos along the axis given by idir in the direction given by layer.
int CHalo_swap_dir(Complex_f *c, int ncpt, int idir, int layer)
Swaps the halos along the axis given by idir in the direction given by layer.
int Trial_Exchange(Complex *ut[2], Complex_f *ut_f[2])
Exchanges the trial fields.
Definition par_mpi.c:1043
int Par_csum(Complex_f *cval)
Performs a reduction on a complex float cval to get a sum which is then distributed to all ranks.
int Par_zsum(Complex *zval)
Performs a reduction on a complex double zval to get a sum which is then distributed to all ranks.
int Par_sread(const int iread, const float beta, const float fmu, const float akappa, const Complex_f ajq, const float c_sw, Complex *u11, Complex *u12, Complex *u11t, Complex *u12t)
Reads and assigns the gauges from file.
Definition par_mpi.c:114
int DHalo_swap_dir(double *d, int ncpt, int idir, int layer)
Swaps the halos along the axis given by idir in the direction given by layer.
int Par_dsum(double *dval)
Performs a reduction on a double dval to get a sum which is then distributed to all ranks.
int pu[ndim]
Processors in the up direction.
Definition par_mpi.c:21
int pd[ndim]
Processors in the down direction.
Definition par_mpi.c:22
int size
The number of MPI ranks in total.
Definition par_mpi.c:20
int rank
The MPI rank.
Definition par_mpi.c:20
int pstop[ndim][nproc]
The final lattice site on each sublattice in a given direction.
Definition par_mpi.c:19
int pstart[ndim][nproc]
The initial lattice site on each sublattice in a given direction.
Definition par_mpi.c:18
int * pcoord
The processor grid.
Definition par_mpi.c:17
#define AVX
Alignment of arrays. 64 for AVX-512, 32 for AVX/AVX2. 16 for SSE. Since AVX is standard on modern x86...
Definition sizes.h:279
#define nproc
Number of processors for MPI.
Definition sizes.h:138
#define Complex
Double precision complex number.
Definition sizes.h:64
#define Complex_f
Single precision complex number.
Definition sizes.h:62
#define ndim
Dimensions.
Definition sizes.h:188