GLAC  1.0
communicator.h
Go to the documentation of this file.
1 
11 #ifndef COMMUNICATOR_H
12 #define COMMUNICATOR_H
13 
14 #include <vector>
15 #include "math/lattice.h"
16 
17 namespace Parallel {
19 {
20 private:
21  // Parallel variables
22  static int m_processRank;
23  static int m_numprocs;
24  static int m_processorsPerDimension[4];
25 
26  // Fetching variables
27  static bool muDir;
28  static bool nuDir;
29  static SU3 exchangeU;
30 
31  // Sub lattice dimensions
32  static std::vector<unsigned int> m_N;
33 
34  // Private fetchSU3 functions
35  inline static void MPIfetchSU3Positive(Lattice<SU3> *lattice, std::vector<int> n, int mu, int SU3Dir);
36  inline static void MPIfetchSU3Negative(Lattice<SU3> *lattice, std::vector<int> n, int mu, int SU3Dir);
37 public:
38  Communicator();
39  ~Communicator();
40 
41  // Initializers
42  static void init(int *numberOfArguments, char ***cmdLineArguments);
43  static void initializeSubLattice();
44 
45  // Link getters
46  static SU3 getPositiveLink(Lattice<SU3> *lattice, std::vector<int> n, int mu, int *muIndex, int SU3Dir);
47  static SU3 getNegativeLink(Lattice<SU3> *lattice, std::vector<int> n, int mu, int *muIndex, int SU3Dir);
48  static SU3 getNeighboursNeighbourLink(Lattice<SU3> * lattice, std::vector<int> n , int mu, int *muIndex, int nu, int *nuIndex, int SU3Dir);
49  static SU3 getNeighboursNeighbourNegativeLink(Lattice<SU3> * lattice, std::vector<int> n, int mu, int *muIndex, int nu, int *nuIndex, int SU3Dir);
50 
51  // Getters
52  static int getProcessRank() { return m_processRank; }
53  static int getNumProc() { return m_numprocs; }
54 
55  // Setters
56  static void setN(std::vector<unsigned int> N);
57 
58  // MPI
59  static void MPIExit(std::string message);
60  static void MPIPrint(std::string message);
61  static void setBarrier();
62  static void setBarrierActive();
63  static void gatherDoubleResults(double * data, unsigned int N);
64  static void freeMPIGroups();
65 
66  // MPI method for reducing to a single dimension
67  static void reduceToTemporalDimension(std::vector<double> &obsResults, std::vector<double> obs);
68 
69  // Validity checkers
70  static void checkProcessorValidity();
72  static void checkSubLatticeValidity();
73 
74  // Function used for bug testing
75  static void checkLattice(Lattice<SU3> *lattice, std::string message);
76 };
77 }
78 
79 #endif // COMMUNICATOR_H
static void gatherDoubleResults(double *data, unsigned int N)
Parallel::Communicator::gatherDoubleResults.
Definition: communicator.cpp:546
Communicator()
Definition: communicator.cpp:21
static void checkLattice(Lattice< SU3 > *lattice, std::string message)
Parallel::Communicator::checkLattice checks if the lattice containts invalid numbers/nan.
Definition: communicator.cpp:569
Definition: communicator.h:18
static void setBarrierActive()
Parallel::Communicator::setBarrierActive.
Definition: communicator.cpp:494
static void init(int *numberOfArguments, char ***cmdLineArguments)
Parallel::Communicator::init initializes the communicater and sets up the lattice geometry.
Definition: communicator.cpp:337
static void MPIExit(std::string message)
Parallel::Communicator::MPIExit exits the program. Frees MPI groups before it exits.
Definition: communicator.cpp:520
class for holding matrices.
Definition: su3.h:18
static void setBarrier()
Parallel::Communicator::setBarrier.
Definition: communicator.cpp:484
static void setN(std::vector< unsigned int > N)
Parallel::Communicator::setN sets the lattice dimensions in the Parallel::Communicator class.
Definition: communicator.cpp:557
Parallel contains all of the relevant methods for communicating between the lattices.
Definition: communicator.h:17
static SU3 getNeighboursNeighbourLink(Lattice< SU3 > *lattice, std::vector< int > n, int mu, int *muIndex, int nu, int *nuIndex, int SU3Dir)
Parallel::Communicator::getNeighboursNeighbourLink fetches a neighbours neighbor link.
Definition: communicator.cpp:147
static SU3 getPositiveLink(Lattice< SU3 > *lattice, std::vector< int > n, int mu, int *muIndex, int SU3Dir)
Parallel::Communicator::getPositiveLink fetches a link in the positive direction.
Definition: communicator.cpp:82
static void freeMPIGroups()
Parallel::Communicator::freeMPIGroups.
Definition: communicator.cpp:504
static SU3 getNegativeLink(Lattice< SU3 > *lattice, std::vector< int > n, int mu, int *muIndex, int SU3Dir)
Parallel::Communicator::getNegativeLink fetches a link in the negative direction.
Definition: communicator.cpp:112
static void reduceToTemporalDimension(std::vector< double > &obsResults, std::vector< double > obs)
Parallel::Communicator::reduceToTemporalDimension reduces the results to the temporal dimensions,...
Definition: communicator.cpp:267
~Communicator()
Definition: communicator.cpp:25
static void MPIPrint(std::string message)
Parallel::Communicator::MPIPrint prints a message from rank 0. Includes barriers.
Definition: communicator.cpp:532
static void initializeSubLattice()
Parallel::Communicator::initializeSubLattice.
Definition: communicator.cpp:429
static SU3 getNeighboursNeighbourNegativeLink(Lattice< SU3 > *lattice, std::vector< int > n, int mu, int *muIndex, int nu, int *nuIndex, int SU3Dir)
Parallel::Communicator::getNeighboursNeighbourNegativeLink.
Definition: communicator.cpp:211
static int getProcessRank()
Definition: communicator.h:52
static int getNumProc()
Definition: communicator.h:53
static void checkProcessorValidity()
Parallel::Communicator::checkProcessorValidity checks that we do not have an odd number of processors...
Definition: communicator.cpp:390
static void checkSubLatticeValidity()
Parallel::Communicator::checkSubLatticeValidity runs a series of tests to ensure that the sub lattice...
Definition: communicator.cpp:303
static void checkSubLatticeDimensionsValidity()
Parallel::Communicator::checkSubLatticeDimensionsValidity.
Definition: communicator.cpp:407