mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
FOrmatting
This commit is contained in:
parent
7f6bffe5ad
commit
5e48b701ec
@ -1,4 +1,4 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
@ -24,8 +24,8 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#include <Grid/GridCore.h>
|
#include <Grid/GridCore.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -72,9 +72,9 @@ void LebesgueOrder::ThreadInterleave(void)
|
|||||||
|
|
||||||
for(int t=0;t<threads;t++){
|
for(int t=0;t<threads;t++){
|
||||||
for(int ss=0;ss<vol;ss++){
|
for(int ss=0;ss<vol;ss++){
|
||||||
if ( ( ss >> blockbits) % threads == t ) {
|
if ( ( ss >> blockbits) % threads == t ) {
|
||||||
throrder.push_back(reorder[ss]);
|
throrder.push_back(reorder[ss]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_LebesgueReorder = throrder;
|
_LebesgueReorder = throrder;
|
||||||
@ -112,9 +112,9 @@ void LebesgueOrder::CartesianBlocking(void)
|
|||||||
};
|
};
|
||||||
|
|
||||||
void LebesgueOrder::IterateO(int ND,int dim,
|
void LebesgueOrder::IterateO(int ND,int dim,
|
||||||
std::vector<IndexInteger> & xo,
|
std::vector<IndexInteger> & xo,
|
||||||
std::vector<IndexInteger> & xi,
|
std::vector<IndexInteger> & xi,
|
||||||
std::vector<IndexInteger> &dims)
|
std::vector<IndexInteger> &dims)
|
||||||
{
|
{
|
||||||
for(xo[dim]=0;xo[dim]<dims[dim];xo[dim]+=Block[dim]){
|
for(xo[dim]=0;xo[dim]<dims[dim];xo[dim]+=Block[dim]){
|
||||||
if ( dim > 0 ) {
|
if ( dim > 0 ) {
|
||||||
@ -126,10 +126,10 @@ void LebesgueOrder::IterateO(int ND,int dim,
|
|||||||
};
|
};
|
||||||
|
|
||||||
void LebesgueOrder::IterateI(int ND,
|
void LebesgueOrder::IterateI(int ND,
|
||||||
int dim,
|
int dim,
|
||||||
std::vector<IndexInteger> & xo,
|
std::vector<IndexInteger> & xo,
|
||||||
std::vector<IndexInteger> & xi,
|
std::vector<IndexInteger> & xi,
|
||||||
std::vector<IndexInteger> &dims)
|
std::vector<IndexInteger> &dims)
|
||||||
{
|
{
|
||||||
std::vector<IndexInteger> x(ND);
|
std::vector<IndexInteger> x(ND);
|
||||||
for(xi[dim]=0;xi[dim]<std::min(dims[dim]-xo[dim],Block[dim]);xi[dim]++){
|
for(xi[dim]=0;xi[dim]<std::min(dims[dim]-xo[dim],Block[dim]);xi[dim]++){
|
||||||
@ -138,9 +138,9 @@ void LebesgueOrder::IterateI(int ND,
|
|||||||
} else {
|
} else {
|
||||||
for(int d=0;d<ND;d++){
|
for(int d=0;d<ND;d++){
|
||||||
x[d]=xi[d]+xo[d];
|
x[d]=xi[d]+xo[d];
|
||||||
// std::cout << x[d]<<" ";
|
// std::cout << x[d]<<" ";
|
||||||
}
|
}
|
||||||
// std::cout << "\n";
|
// std::cout << "\n";
|
||||||
IndexInteger index;
|
IndexInteger index;
|
||||||
Lexicographic::IndexFromCoor(x,index,grid->_rdimensions);
|
Lexicographic::IndexFromCoor(x,index,grid->_rdimensions);
|
||||||
_LebesgueReorder.push_back(index);
|
_LebesgueReorder.push_back(index);
|
||||||
@ -227,16 +227,16 @@ void LebesgueOrder::ZGraph(void)
|
|||||||
assert( _LebesgueReorder.size() == vol );
|
assert( _LebesgueReorder.size() == vol );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
std::vector<int> coor(4);
|
std::vector<int> coor(4);
|
||||||
for(IndexInteger asite=0;asite<vol;asite++){
|
for(IndexInteger asite=0;asite<vol;asite++){
|
||||||
grid->oCoorFromOindex (coor,_LebesgueReorder[asite]);
|
grid->oCoorFromOindex (coor,_LebesgueReorder[asite]);
|
||||||
std::cout << " site "<<asite << "->" << _LebesgueReorder[asite]<< " = ["
|
std::cout << " site "<<asite << "->" << _LebesgueReorder[asite]<< " = ["
|
||||||
<< coor[0]<<","
|
<< coor[0]<<","
|
||||||
<< coor[1]<<","
|
<< coor[1]<<","
|
||||||
<< coor[2]<<","
|
<< coor[2]<<","
|
||||||
<< coor[3]<<"]"
|
<< coor[3]<<"]"
|
||||||
<<std::endl;
|
<<std::endl;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
NAMESPACE_END(Grid);
|
NAMESPACE_END(Grid);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
@ -24,8 +24,8 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#ifndef GRID_LEBESGUE_H
|
#ifndef GRID_LEBESGUE_H
|
||||||
#define GRID_LEBESGUE_H
|
#define GRID_LEBESGUE_H
|
||||||
|
|
||||||
@ -34,48 +34,48 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
|
|||||||
// Lebesgue, Morton, Z-graph ordering assistance
|
// Lebesgue, Morton, Z-graph ordering assistance
|
||||||
NAMESPACE_BEGIN(Grid);
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
class LebesgueOrder {
|
class LebesgueOrder {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef int32_t IndexInteger;
|
typedef int32_t IndexInteger;
|
||||||
|
|
||||||
static int UseLebesgueOrder;
|
static int UseLebesgueOrder;
|
||||||
GridBase *grid;
|
GridBase *grid;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LebesgueOrder(GridBase *_grid);
|
LebesgueOrder(GridBase *_grid);
|
||||||
|
|
||||||
inline IndexInteger Reorder(IndexInteger ss) {
|
inline IndexInteger Reorder(IndexInteger ss) {
|
||||||
return _LebesgueReorder[ss] ;
|
return _LebesgueReorder[ss] ;
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Space filling fractal for cache oblivious
|
// Space filling fractal for cache oblivious
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
void ZGraph(void);
|
void ZGraph(void);
|
||||||
IndexInteger alignup(IndexInteger n);
|
IndexInteger alignup(IndexInteger n);
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Cartesian stencil blocking strategy
|
// Cartesian stencil blocking strategy
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
static std::vector<int> Block;
|
static std::vector<int> Block;
|
||||||
void NoBlocking(void);
|
void NoBlocking(void);
|
||||||
void CartesianBlocking(void);
|
void CartesianBlocking(void);
|
||||||
void IterateO(int ND,int dim,
|
void IterateO(int ND,int dim,
|
||||||
std::vector<IndexInteger> & xo,
|
std::vector<IndexInteger> & xo,
|
||||||
std::vector<IndexInteger> & xi,
|
std::vector<IndexInteger> & xi,
|
||||||
std::vector<IndexInteger> &dims);
|
std::vector<IndexInteger> &dims);
|
||||||
void IterateI(int ND,int dim,
|
void IterateI(int ND,int dim,
|
||||||
std::vector<IndexInteger> & xo,
|
std::vector<IndexInteger> & xo,
|
||||||
std::vector<IndexInteger> & xi,
|
std::vector<IndexInteger> & xi,
|
||||||
std::vector<IndexInteger> &dims);
|
std::vector<IndexInteger> &dims);
|
||||||
|
|
||||||
void ThreadInterleave(void);
|
void ThreadInterleave(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<IndexInteger> _LebesgueReorder;
|
std::vector<IndexInteger> _LebesgueReorder;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NAMESPACE_END(Grid);
|
NAMESPACE_END(Grid);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
@ -23,14 +23,14 @@
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#include <Grid/GridCore.h>
|
#include <Grid/GridCore.h>
|
||||||
|
|
||||||
NAMESPACE_BEGIN(Grid);
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
void Gather_plane_table_compute (GridBase *grid,int dimension,int plane,int cbmask,
|
void Gather_plane_table_compute (GridBase *grid,int dimension,int plane,int cbmask,
|
||||||
int off,std::vector<std::pair<int,int> > & table)
|
int off,std::vector<std::pair<int,int> > & table)
|
||||||
{
|
{
|
||||||
table.resize(0);
|
table.resize(0);
|
||||||
|
|
||||||
@ -52,17 +52,17 @@ void Gather_plane_table_compute (GridBase *grid,int dimension,int plane,int cbma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int bo=0;
|
int bo=0;
|
||||||
table.resize(e1*e2/2);
|
table.resize(e1*e2/2);
|
||||||
for(int n=0;n<e1;n++){
|
for(int n=0;n<e1;n++){
|
||||||
for(int b=0;b<e2;b++){
|
for(int b=0;b<e2;b++){
|
||||||
int o = n*stride;
|
int o = n*stride;
|
||||||
int ocb=1<<grid->CheckerBoardFromOindexTable(o+b);
|
int ocb=1<<grid->CheckerBoardFromOindexTable(o+b);
|
||||||
if ( ocb &cbmask ) {
|
if ( ocb &cbmask ) {
|
||||||
table[bo]=std::pair<int,int>(bo,o+b); bo++;
|
table[bo]=std::pair<int,int>(bo,o+b); bo++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,30 +23,30 @@
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#ifndef GRID_STENCIL_H
|
#ifndef GRID_STENCIL_H
|
||||||
#define GRID_STENCIL_H
|
#define GRID_STENCIL_H
|
||||||
|
|
||||||
#include <Grid/stencil/SimpleCompressor.h> // subdir aggregate
|
#include <Grid/stencil/SimpleCompressor.h> // subdir aggregate
|
||||||
#include <Grid/stencil/Lebesgue.h> // subdir aggregate
|
#include <Grid/stencil/Lebesgue.h> // subdir aggregate
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Must not lose sight that goal is to be able to construct really efficient
|
// Must not lose sight that goal is to be able to construct really efficient
|
||||||
// gather to a point stencil code. CSHIFT is not the best way, so need
|
// gather to a point stencil code. CSHIFT is not the best way, so need
|
||||||
// additional stencil support.
|
// additional stencil support.
|
||||||
//
|
//
|
||||||
// Stencil based code will exchange haloes and use a table lookup for neighbours.
|
// Stencil based code will exchange haloes and use a table lookup for neighbours.
|
||||||
// This will be done with generality to allow easier efficient implementations.
|
// This will be done with generality to allow easier efficient implementations.
|
||||||
// Overlap of comms and compute is enabled by tabulating off-node connected,
|
// Overlap of comms and compute is enabled by tabulating off-node connected,
|
||||||
//
|
//
|
||||||
// Generic services
|
// Generic services
|
||||||
// 0) Prebuild neighbour tables
|
// 0) Prebuild neighbour tables
|
||||||
// 1) Compute sizes of all haloes/comms buffers; allocate them.
|
// 1) Compute sizes of all haloes/comms buffers; allocate them.
|
||||||
// 2) Gather all faces, and communicate.
|
// 2) Gather all faces, and communicate.
|
||||||
// 3) Loop over result sites, giving nbr index/offnode info for each
|
// 3) Loop over result sites, giving nbr index/offnode info for each
|
||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
NAMESPACE_BEGIN(Grid);
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ NAMESPACE_BEGIN(Grid);
|
|||||||
// Gather for when there *is* need to SIMD split with compression
|
// Gather for when there *is* need to SIMD split with compression
|
||||||
///////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////
|
||||||
void Gather_plane_table_compute (GridBase *grid,int dimension,int plane,int cbmask,
|
void Gather_plane_table_compute (GridBase *grid,int dimension,int plane,int cbmask,
|
||||||
int off,std::vector<std::pair<int,int> > & table);
|
int off,std::vector<std::pair<int,int> > & table);
|
||||||
|
|
||||||
template<class vobj,class cobj,class compressor>
|
template<class vobj,class cobj,class compressor>
|
||||||
void Gather_plane_simple_table (std::vector<std::pair<int,int> >& table,const Lattice<vobj> &rhs,cobj *buffer,compressor &compress, int off,int so) __attribute__((noinline));
|
void Gather_plane_simple_table (std::vector<std::pair<int,int> >& table,const Lattice<vobj> &rhs,cobj *buffer,compressor &compress, int off,int so) __attribute__((noinline));
|
||||||
@ -89,21 +89,21 @@ void Gather_plane_exchange_table(std::vector<std::pair<int,int> >& table,const L
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct StencilEntry {
|
struct StencilEntry {
|
||||||
uint64_t _offset;
|
uint64_t _offset;
|
||||||
uint64_t _byte_offset;
|
uint64_t _byte_offset;
|
||||||
uint16_t _is_local;
|
uint16_t _is_local;
|
||||||
uint16_t _permute;
|
uint16_t _permute;
|
||||||
uint16_t _around_the_world; //256 bits, 32 bytes, 1/2 cacheline
|
uint16_t _around_the_world; //256 bits, 32 bytes, 1/2 cacheline
|
||||||
uint16_t _pad;
|
uint16_t _pad;
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// The Stencil Class itself
|
// The Stencil Class itself
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
template<class vobj,class cobj>
|
template<class vobj,class cobj>
|
||||||
class CartesianStencil { // Stencil runs along coordinate axes only; NO diagonal fill in.
|
class CartesianStencil { // Stencil runs along coordinate axes only; NO diagonal fill in.
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef typename cobj::vector_type vector_type;
|
typedef typename cobj::vector_type vector_type;
|
||||||
typedef typename cobj::scalar_type scalar_type;
|
typedef typename cobj::scalar_type scalar_type;
|
||||||
@ -538,17 +538,17 @@ class CartesianStencil { // Stencil runs along coordinate axes only; NO diagonal
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CartesianStencil(GridBase *grid,
|
CartesianStencil(GridBase *grid,
|
||||||
int npoints,
|
int npoints,
|
||||||
int checkerboard,
|
int checkerboard,
|
||||||
const std::vector<int> &directions,
|
const std::vector<int> &directions,
|
||||||
const std::vector<int> &distances)
|
const std::vector<int> &distances)
|
||||||
: _permute_type(npoints),
|
: _permute_type(npoints),
|
||||||
_comm_buf_size(npoints),
|
_comm_buf_size(npoints),
|
||||||
comm_bytes_thr(npoints),
|
comm_bytes_thr(npoints),
|
||||||
comm_enter_thr(npoints),
|
comm_enter_thr(npoints),
|
||||||
comm_leave_thr(npoints),
|
comm_leave_thr(npoints),
|
||||||
comm_time_thr(npoints)
|
comm_time_thr(npoints)
|
||||||
{
|
{
|
||||||
face_table_computed=0;
|
face_table_computed=0;
|
||||||
_npoints = npoints;
|
_npoints = npoints;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user