Brick Library 0.1
Performance-portable stencil datalayout & codegen
minimal_brick.h
Go to the documentation of this file.
1
5#ifndef BRICK_H
6#define BRICK_H
7
8#include <memory>
9
10template<unsigned base, unsigned exp>
11struct static_power {
12 static constexpr unsigned value = base * static_power<base, exp - 1>::value;
13};
14
15template<unsigned base>
16struct static_power<base, 0> {
17 static constexpr unsigned value = 1;
18};
19
20struct BrickStorage {
21 std::shared_ptr<bElem> dat;
22 long chunks;
23 long step;
24 void *mmap_info = nullptr;
25};
26
27template<unsigned dims>
28struct BrickInfo {
31 unsigned nbricks;
32};
33
34template<unsigned ... Ds>
35struct Dim {
36};
37
38template<typename...>
39struct Brick;
40
41template<
42 unsigned ... BDims,
43 unsigned ... Folds>
44struct Brick<Dim<BDims...>, Dim<Folds...> > {
45 typedef BrickInfo<sizeof...(BDims)> myBrickInfo;
46
47 myBrickInfo *bInfo;
48 unsigned step;
49 bElem *dat;
50 BrickStorage bStorage;
51};
52
53#endif //BRICK_H
Definition: base.py:1
Metadata related to bricks.
Definition: brick.h:92
unsigned(* adjlist)[static_power< 3, dims >::value]
Adjacency list type.
Definition: brick.h:94
unsigned nbricks
Number of bricks in this list.
Definition: brick.h:98
adjlist adj
Adjacency list.
Definition: brick.h:96
Initializing and holding the storage of bricks.
Definition: brick.h:49
std::shared_ptr< bElem > dat
Pointer holding brick data.
Definition: brick.h:51
long chunks
Number of chunks.
Definition: brick.h:57
long step
Definition: minimal_brick.h:23
void * mmap_info
MMAP data structure when using mmap as allocator.
Definition: brick.h:61
unsigned step
Definition: minimal_brick.h:48
Generic base template, see Brick< Dim< BDims... >, Dim< Folds... > >
Definition: brick.h:335
Empty template to specify an n-D list.
Definition: brick.h:126
Compute Statically compute exponentials.
Definition: brick.h:31
static constexpr unsigned value
Definition: brick.h:32
#define bElem
Basic datatype for all brick elements.
Definition: vecscatter.h:13