lqcd, mg, and qlua - bu blogs

41
LQCD, MG, and Qlua Andrew Pochinsky [email protected] Monday, November 4, 13

Upload: others

Post on 05-Jan-2022

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: LQCD, MG, and Qlua - BU Blogs

LQCD, MG, and Qlua

Andrew [email protected]

Monday, November 4, 13

Page 2: LQCD, MG, and Qlua - BU Blogs

OUTLINE

Iterative solvers and multigrid

Application domain: lattice QCD

Algorithm design with Qlua

References

Monday, November 4, 13

Page 3: LQCD, MG, and Qlua - BU Blogs

ITERATIVE SOLVERS AND MULTIGRID

Monday, November 4, 13

Page 4: LQCD, MG, and Qlua - BU Blogs

ITERATIVE SOLVERS AND MULTIGRID

Ax=b

Monday, November 4, 13

Page 5: LQCD, MG, and Qlua - BU Blogs

ITERATIVE SOLVERS AND MULTIGRID

Hilbert spaces

Vector space operations

Homomorphisms

Linear operators

Monday, November 4, 13

Page 6: LQCD, MG, and Qlua - BU Blogs

LATTICE QCD

Monday, November 4, 13

Page 7: LQCD, MG, and Qlua - BU Blogs

LATTICE QCD

Tori in n-dim

Monday, November 4, 13

Page 8: LQCD, MG, and Qlua - BU Blogs

LATTICE QCD

Tori in n-dim

Simple (constant) stencil structures

Monday, November 4, 13

Page 9: LQCD, MG, and Qlua - BU Blogs

LATTICE QCD

Tori in n-dim

Simple (constant) stencil structures

Physics encoded in parallel transport coefficients

Monday, November 4, 13

Page 10: LQCD, MG, and Qlua - BU Blogs

LATTICE QCD

Tori in n-dim

Simple (constant) stencil structures

Physics encoded in parallel transport coefficients

Non-hermitian operators

Monday, November 4, 13

Page 11: LQCD, MG, and Qlua - BU Blogs

LATTICE QCD

Tori in n-dim

Simple (constant) stencil structures

Physics encoded in parallel transport coefficients

Non-hermitian operators

Large condition numbers

Monday, November 4, 13

Page 12: LQCD, MG, and Qlua - BU Blogs

QLUA

Monday, November 4, 13

Page 13: LQCD, MG, and Qlua - BU Blogs

QLUA

Scripting language Lua with domain-specific extensions

$

Monday, November 4, 13

Page 14: LQCD, MG, and Qlua - BU Blogs

QLUA

Scripting language Lua with domain-specific extensions

$  cat  sines.qluarequire  "stdlib"for  i  =  1,  5  do    printf("sin(%d  deg)  =  %7.5f\n",  i,  math.sin(i*math.pi/180));end$

Monday, November 4, 13

Page 15: LQCD, MG, and Qlua - BU Blogs

QLUA

Scripting language Lua with domain-specific extensions

$  cat  sines.qluarequire  "stdlib"for  i  =  1,  5  do    printf("sin(%d  deg)  =  %7.5f\n",  i,  math.sin(i*math.pi/180));end$  qlua  sines.qluasin(1  deg)  =  0.01745sin(2  deg)  =  0.03490sin(3  deg)  =  0.05234sin(4  deg)  =  0.06976sin(5  deg)  =  0.08716$

Monday, November 4, 13

Page 16: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresLattices - Tori and Stencils

Monday, November 4, 13

Page 17: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresLattices - Tori and Stencils

require  "stdlib"lx  =  qcd.lattice  {4,  2}

Monday, November 4, 13

Page 18: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresLattices - Tori and Stencils

require  "stdlib"lx  =  qcd.lattice  {4,  2}A  =  lx:Real(lx:pcoord(1)  +  10  *  lx:pcoord(0))

Monday, November 4, 13

Page 19: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresLattices - Tori and Stencils

require  "stdlib"lx  =  qcd.lattice  {4,  2}A  =  lx:Real(lx:pcoord(1)  +  10  *  lx:pcoord(0))B  =  A:shift(0,  "from_backward")

Monday, November 4, 13

Page 20: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresLattices - Tori and Stencils

require  "stdlib"lx  =  qcd.lattice  {4,  2}A  =  lx:Real(lx:pcoord(1)  +  10  *  lx:pcoord(0))B  =  A:shift(0,  "from_backward")for  i  =  0,  lx[0]  -­‐  1  do      for  j  =  0,  lx[1]  -­‐  1  do            printf("[%d  %d]:    %3d  %3d\n",  i,  j,  A[{i,j}],  B[{i,j}])      endend

Monday, November 4, 13

Page 21: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresLattices - Tori and Stencils

require  "stdlib"lx  =  qcd.lattice  {4,  2}A  =  lx:Real(lx:pcoord(1)  +  10  *  lx:pcoord(0))B  =  A:shift(0,  "from_backward")for  i  =  0,  lx[0]  -­‐  1  do      for  j  =  0,  lx[1]  -­‐  1  do            printf("[%d  %d]:    %3d  %3d\n",  i,  j,  A[{i,j}],  B[{i,j}])      endend$  qlua  ts.qlua[0  0]:        0    30[0  1]:        1    31[1  0]:      10      0[1  1]:      11      1[2  0]:      20    10[2  1]:      21    11[3  0]:      30    20[3  1]:      31    21

Monday, November 4, 13

Page 22: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresLQCD-specific data types

Monday, November 4, 13

Page 23: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresLQCD-specific data types - Vectors

Monday, November 4, 13

Page 24: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresLQCD-specific data types - Vectors

lx  =  qcd.lattice{24,48}

Monday, November 4, 13

Page 25: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresLQCD-specific data types - Vectors

lx  =  qcd.lattice{24,48}rnd  =  lx:RandomState(35,  lx:pcoord(0)  +  24  *  lx:pcoord(1))

Monday, November 4, 13

Page 26: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresLQCD-specific data types - Vectors

lx  =  qcd.lattice{24,48}rnd  =  lx:RandomState(35,  lx:pcoord(0)  +  24  *  lx:pcoord(1))phi  =  rnd:gaussian_DiracFermion()

Monday, November 4, 13

Page 27: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresLQCD-specific data types - Vectors

lx  =  qcd.lattice{24,48}rnd  =  lx:RandomState(35,  lx:pcoord(0)  +  24  *  lx:pcoord(1))phi  =  rnd:gaussian_DiracFermion()g  =  rnd:gaussian_ColorMatrix()r  =  lx:Real(lx:pcoord(0))  +  0.5  *  rnd:gaussian_Real()

Monday, November 4, 13

Page 28: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresLQCD operations

Monday, November 4, 13

Page 29: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresLQCD operations - Vector spaces

Monday, November 4, 13

Page 30: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresLQCD operations - Vector spaces

lx  =  qcd.lattice{24,48}rnd  =  lx:RandomState(35,  lx:pcoord(0)  +  24  *  lx:pcoord(1))phi  =  rnd:gaussian_DiracFermion()g  =  rnd:gaussian_ColorMatrix()r  =  lx:Real(lx:pcoord(0))  +  0.5  *  rnd:gaussian_Real()

rho  =  lx:DiracFermion()psi  =  g  *  phi  +  6.5  *  rho

Monday, November 4, 13

Page 31: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresFull set of arithmetic operations on lattice data objects

Monday, November 4, 13

Page 32: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresFull set of arithmetic operations on lattice data objects

lx  =  qcd.lattice{24,48}rnd  =  lx:RandomState(35,  lx:pcoord(0)  +  24  *  lx:pcoord(1))phi  =  rnd:gaussian_DiracFermion()g  =  rnd:gaussian_ColorMatrix()r  =  lx:Real(lx:pcoord(0))  +  0.5  *  rnd:gaussian_Real()

rho  =  lx:DiracFermion()

function  LinOp(x)      return  g  *  x  +  r  *  xend

Monday, November 4, 13

Page 33: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresCollectives - Linear maps

Monday, November 4, 13

Page 34: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresCollectives - Linear maps

srcL = qcd.lattice{7,6}dstL = qcd.lattice{4,2}I0 = srcL:Int(...)I1 = srcL:Int(...)V = srcL:Int(...)

Monday, November 4, 13

Page 35: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresCollectives - Linear maps

srcL = qcd.lattice{7,6}dstL = qcd.lattice{4,2}I0 = srcL:Int(...)I1 = srcL:Int(...)V = srcL:Int(...)

Monday, November 4, 13

Page 36: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresCollectives - Linear maps

srcL = qcd.lattice{7,6}dstL = qcd.lattice{4,2}I0 = srcL:Int(...)I1 = srcL:Int(...)V = srcL:Int(...)

gx = qcd.gather(dstL, srcL, {I0, I1})

Monday, November 4, 13

Page 37: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresCollectives - Linear maps

srcL = qcd.lattice{7,6}dstL = qcd.lattice{4,2}I0 = srcL:Int(...)I1 = srcL:Int(...)V = srcL:Int(...)

gx = qcd.gather(dstL, srcL, {I0, I1})Wadd = gx:add(V)Wmax = gx:max(V)Wxor = gx:xor(V)

Monday, November 4, 13

Page 38: LQCD, MG, and Qlua - BU Blogs

QLUA

Extensions implement algebraic structuresCollectives - Linear maps

srcL = qcd.lattice{7,6}dstL = qcd.lattice{4,2}I0 = srcL:Int(...)I1 = srcL:Int(...)V = srcL:Int(...)

gx = qcd.gather(dstL, srcL, {I0, I1})Wadd = gx:add(V)Wmax = gx:max(V)Wxor = gx:xor(V)

Monday, November 4, 13

Page 39: LQCD, MG, and Qlua - BU Blogs

QLUA

Scripting language Lua with domain-specific extensionsExtensions implement algebraic structures

Lattices - Tori and StencilsLQCD-specific data types - VectorsLQCD operations - Vector spaces, OperatorsCollectives - Linear mapsAccess to QIO files - real data

Monday, November 4, 13

Page 40: LQCD, MG, and Qlua - BU Blogs

QLUA

More tutorials at  https://usqcd.lns.mit.edu/w/index.php/QLUA_tutorials

Monday, November 4, 13

Page 41: LQCD, MG, and Qlua - BU Blogs

REFERENCES

http://www.usqcd.org/http://www.lua.org/https://usqcd.lns.mit.edu/qluahttps://usqcd.lns.mit.edu/w/index.php/QLUA_tutorials

Monday, November 4, 13