LQCD, MG, and Qlua - BU Blogs

Preview:

Citation preview

LQCD, MG, and Qlua

Andrew Pochinskyavp@mit.edu

Monday, November 4, 13

OUTLINE

Iterative solvers and multigrid

Application domain: lattice QCD

Algorithm design with Qlua

References

Monday, November 4, 13

ITERATIVE SOLVERS AND MULTIGRID

Monday, November 4, 13

ITERATIVE SOLVERS AND MULTIGRID

Ax=b

Monday, November 4, 13

ITERATIVE SOLVERS AND MULTIGRID

Hilbert spaces

Vector space operations

Homomorphisms

Linear operators

Monday, November 4, 13

LATTICE QCD

Monday, November 4, 13

LATTICE QCD

Tori in n-dim

Monday, November 4, 13

LATTICE QCD

Tori in n-dim

Simple (constant) stencil structures

Monday, November 4, 13

LATTICE QCD

Tori in n-dim

Simple (constant) stencil structures

Physics encoded in parallel transport coefficients

Monday, November 4, 13

LATTICE QCD

Tori in n-dim

Simple (constant) stencil structures

Physics encoded in parallel transport coefficients

Non-hermitian operators

Monday, November 4, 13

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

QLUA

Monday, November 4, 13

QLUA

Scripting language Lua with domain-specific extensions

$

Monday, November 4, 13

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

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

QLUA

Extensions implement algebraic structuresLattices - Tori and Stencils

Monday, November 4, 13

QLUA

Extensions implement algebraic structuresLattices - Tori and Stencils

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

Monday, November 4, 13

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

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

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

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

QLUA

Extensions implement algebraic structuresLQCD-specific data types

Monday, November 4, 13

QLUA

Extensions implement algebraic structuresLQCD-specific data types - Vectors

Monday, November 4, 13

QLUA

Extensions implement algebraic structuresLQCD-specific data types - Vectors

lx  =  qcd.lattice{24,48}

Monday, November 4, 13

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

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

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

QLUA

Extensions implement algebraic structuresLQCD operations

Monday, November 4, 13

QLUA

Extensions implement algebraic structuresLQCD operations - Vector spaces

Monday, November 4, 13

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

QLUA

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

Monday, November 4, 13

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

QLUA

Extensions implement algebraic structuresCollectives - Linear maps

Monday, November 4, 13

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

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

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

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

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

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

QLUA

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

Monday, November 4, 13

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

Recommended