Grid 0.7.0
Stencil.cc
Go to the documentation of this file.
1/*************************************************************************************
2
3 Grid physics library, www.github.com/paboyle/Grid
4
5 Source file: ./lib/Stencil.cc
6
7 Copyright (C) 2015
8
9 Author: Peter Boyle <paboyle@ph.ed.ac.uk>
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License along
22 with this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
25 See the full license in the file "LICENSE" in the top level distribution directory
26*************************************************************************************/
27/* END LEGAL */
28#include <Grid/GridCore.h>
29
31
33//uint64_t DslashPartialCount;
35
37{
39 // DslashPartialCount=0;
41}
42void DslashGetCounts(uint64_t &dirichlet,uint64_t &partial,uint64_t &full)
43{
44 dirichlet = DslashDirichletCount;
45 partial = 0;
46 full = DslashFullCount;
47}
49//void DslashLogPartial(void) { DslashPartialCount++;}
51
53
54void Gather_plane_table_compute (GridBase *grid,int dimension,int plane,int cbmask,
55 int off,std::vector<std::pair<int,int> > & table)
56{
57 table.resize(0);
58
59 if ( !grid->CheckerBoarded(dimension) ) {
60 cbmask = 0x3;
61 }
62 int rd = grid->_rdimensions[dimension];
63 int so= plane*grid->_ostride[dimension]; // base offset for start of plane
64 int e1=grid->_slice_nblock[dimension];
65 int e2=grid->_slice_block[dimension];
66 int stride=grid->_slice_stride[dimension];
67 if ( cbmask == 0x3 ) {
68 table.resize(e1*e2);
69 for(int n=0;n<e1;n++){
70 for(int b=0;b<e2;b++){
71 int o = n*stride;
72 int bo = n*e2;
73 table[bo+b]=std::pair<int,int>(bo+b,o+b);
74 }
75 }
76 } else {
77 int bo=0;
78 table.resize(e1*e2/2);
79 for(int n=0;n<e1;n++){
80 for(int b=0;b<e2;b++){
81 int o = n*stride;
82 int ocb=1<<grid->CheckerBoardFromOindexTable(o+b);
83 if ( ocb &cbmask ) {
84 table[bo]=std::pair<int,int>(bo,o+b); bo++;
85 }
86 }
87 }
88 }
89}
90
92
std::vector< T, devAllocator< T > > deviceVector
#define NAMESPACE_BEGIN(A)
Definition Namespace.h:35
#define NAMESPACE_END(A)
Definition Namespace.h:36
void DslashResetCounts(void)
Definition Stencil.cc:36
uint64_t DslashDirichletCount
Definition Stencil.cc:34
uint64_t DslashFullCount
Definition Stencil.cc:32
void DslashLogDirichlet(void)
Definition Stencil.cc:50
void Gather_plane_table_compute(GridBase *grid, int dimension, int plane, int cbmask, int off, std::vector< std::pair< int, int > > &table)
Definition Stencil.cc:54
void DslashLogFull(void)
Definition Stencil.cc:48
void DslashGetCounts(uint64_t &dirichlet, uint64_t &partial, uint64_t &full)
Definition Stencil.cc:42
Coordinate _slice_stride
Coordinate _slice_nblock
Coordinate _slice_block
virtual int CheckerBoarded(int dim)=0
Coordinate _rdimensions
virtual int CheckerBoardFromOindexTable(int Oindex)=0
Coordinate _ostride
static deviceVector< unsigned char > DeviceCommBuf
Definition Stencil.h:75