forked from exafmm/exafmm-beta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPOLICY
80 lines (76 loc) · 2.26 KB
/
POLICY
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
[Priority]
1. Performance
- Only optimize hot-spots
- Keep everything else simple
2. Simplicity
- Never show-off language skills
- Take time to simplify code
3. Portability
- Don't use tools that aren't available everywhere
- Performance must be portable
[Balance]
Application oriented features <-> Filling table of all combination of features
Premature optimization <-> Restructuring code later on
Documentation <-> Publication
[Variable name convention]
Use all captial for
- Macro variables
- Environtment values
- Makefile variables
- Struct elements
Start with captial for
- Class & Struct names
- User defined types
Start with small case for
- everything else
Use camel case for variable names, underscore for file names
Avoid abbreviation as much as possible
- Short scope, short name
- Use plural for vectors (e.g. vector<cell> cells;)
- For equations use the same characters in the equations
Common characters (prefix)
- d* : Difference
- i* : Loop counter (don't just use i)
- k* : Waves
- n* : Size (for inner kernels)
- X* : Coordinates
Common characters (postfix)
- *i : target
- *j : source
- *p : parent
- *c : child
- *0 : first element
- *N : last element
Common three letter keywords (prefix)
- max* : Maximum
- num* : Size (use "n" for inner kerenls)
- old* : Previous value
- sum* : Sum
- tmp* : Temporary value
- vec* : Short vector type
Common keywords (postfix)
- *begin & *end (following STL)
- *send & *recv (following MPI)
- *displ & *count (following MPI)
- *global & *local (for distributed memory)
- *min & *max
- *key & *color
GPU memory keywords (postfix)
- *glob : Global memory
- *shrd : Shared memory
[C++ usage]
Use STL vectors but not iterators
- Reserve, resize, and size are useful
- Some compilers have difficulty parallelizing iterator loops
Use operator overloading for short vector types
- Avoids a lot of indexing errors for short vectors
- Makes the code cleaner
- Portability of intrinsics
Use static & const for inner kernels
- Prevents bugs
- Const-correctness propagates
[Application Features]
- Operation: {MatVec, MatMat, ULV, LU, QR, Det, Eig}
- Elements: {Vertex(FMM), Edge(2DBEM), Face(3DBEM,2DFEM), Volume(3DFEM)}
- Distribution: {uniform, adaptive}, {stationary, dynamic}
- Hardware: {CPU, GPU, MIC}