CHROMA
t_lwldslash.cc
Go to the documentation of this file.
1 
2 #include <iostream>
3 #include <cstdio>
4 
5 #include "chroma.h"
6 
7 
8 using namespace Chroma;
9 
10 
11 int main(int argc, char **argv)
12 {
13  // Put the machine into a known state
14  Chroma::initialize(&argc, &argv);
15 
16  // Setup the layout
17  const int foo[] = {4,4,4,4};
18  multi1d<int> nrow(Nd);
19  nrow = foo; // Use only Nd elements
20  Layout::setLattSize(nrow);
21  Layout::create();
22 
23  //! Test out dslash
24  multi1d<LatticeColorMatrix> u(Nd);
25  for(int m=0; m < u.size(); ++m)
26  gaussian(u[m]);
27 
28  LatticeFermion psi, chi;
29  random(psi);
30  chi = zero;
31 
32  int iter = 10000;
33  QDPIO::cout << "Iters is " << iter << std::endl;
34 
35  //! Create a linear operator
36  QDPIO::cout << "Constructing WilsonDslash" << std::endl;
37 
38  // WilsonDslash class can be optimised
39  WilsonDslash D(u);
40 
41  QDPIO::cout << "Done" << std::endl;
42 
43  int i;
44 
45  int isign, cb, loop;
46  for(isign = 1; isign >= -1; isign -= 2) {
47  for(cb = 0; cb < 2; ++cb) {
48 
49  clock_t myt1;
50  clock_t myt2;
51  double mydt;
52 
53  QDPIO::cout << "Applying D" << std::endl;
54 
55  myt1=clock();
56  for(i=0; i < iter; i++) {
57  D.apply(chi, psi, (isign == 1 ? PLUS : MINUS), cb);
58  }
59  myt2=clock();
60 
61  mydt=(double)(myt2-myt1)/((double)(CLOCKS_PER_SEC));
62  mydt=1.0e6*mydt/((double)(iter*(Layout::vol()/2)));
63 
64  QDPIO::cout << "cb = " << cb << " isign = " << isign << std::endl;
65  QDPIO::cout << "The time per lattice point is "<< mydt << " micro sec"
66  << " (" << (double)(1392.0f/mydt) << ") Mflops " << std::endl;
67  }
68  }
69 
70 
71  //! Create and try a more sophisticated operator
72  /* Real Kappa = 0.1;
73  PreconditionedWilson M(u,Kappa);
74  LatticeFermion eta;
75  M(eta, psi, PLUS);
76 
77  write(nml,"eta", eta);
78  */
79 
80  // Time to bolt
82 
83  exit(0);
84 }
Primary include file for CHROMA in application codes.
General Wilson-Dirac dslash.
Definition: lwldslash_w.h:48
void apply(T &chi, const T &psi, enum PlusMinus isign, int cb) const
General Wilson-Dirac dslash.
Definition: lwldslash_w.h:228
static int m[4]
Definition: make_seeds.cc:16
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
gaussian(aux)
static multi1d< LatticeColorMatrix > u
int i
Definition: pbg5p_w.cc:55
void initialize(int *argc, char ***argv)
Chroma initialisation routine.
Definition: chroma_init.cc:114
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
void finalize(void)
Chroma finalization routine.
Definition: chroma_init.cc:308
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
int cb
Definition: invbicg.cc:120
Double zero
Definition: invbicg.cc:106
int main(int argc, char **argv)
Definition: t_lwldslash.cc:11