You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/sphinx/source/libCEEDdev.md
+48Lines changed: 48 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
# Developer Notes
2
2
3
+
3
4
## Library Design
4
5
5
6
LibCEED has a single user facing API for creating and using the libCEED objects ({ref}`CeedVector`, {ref}`CeedBasis`, etc).
@@ -19,6 +20,7 @@ If there are no performance specific considerations, it is generally recommended
19
20
Any new functions must be well documented and tested.
20
21
Once the user facing API and the default implementation are in place and verified correct via tests, then the developer can focus on hardware specific implementations (AVX, CUDA, HIP, etc.) as necessary.
21
22
23
+
22
24
## Backend Inheritance
23
25
24
26
A Ceed backend is not required to implement all libCEED objects or {ref}`CeedOperator` methods.
@@ -40,11 +42,13 @@ There are three mechanisms by which a Ceed backend can inherit implementations f
40
42
If an unimplemented method is called, then the parent `/gpu/cuda/gen` {ref}`Ceed` object uses its fallback `/gpu/cuda/ref` {ref}`Ceed` object to create a clone of the {ref}`CeedOperator`.
41
43
This clone {ref}`CeedOperator` is then used for the unimplemented preconditioning support methods.
42
44
45
+
43
46
## Backend Families
44
47
45
48
There are 4 general 'families' of backend implementations.
46
49
As internal data layouts are specific to backend families, it is generally not possible to delegate between backend families.
47
50
51
+
48
52
### CPU Backends
49
53
50
54
The basic CPU with the simplest implementation is `/cpu/self/ref/serial`.
@@ -63,6 +67,7 @@ The `/cpu/self/memcheck/*` backends delegate to the `/cpu/self/ref/*` backends.
63
67
These backends replace many of the implementations with methods that include more verification checks and a memory management model that more closely matches the memory management for GPU backends.
64
68
These backends rely upon the [Valgrind](https://valgrind.org/) Memcheck tool and Valgrind headers.
65
69
70
+
66
71
### GPU Backends
67
72
68
73
The CUDA, HIP, and SYCL backend families all follow similar designs.
@@ -86,6 +91,7 @@ This kernel is compiled at runtime via NVRTC, HIPRTC, or OpenCL RTC.
86
91
The `/gpu/*/magma` backends delegate to the corresponding `/gpu/cuda/ref` and `/gpu/hip/ref` backends.
87
92
These backends provide better performance for {ref}`CeedBasis` kernels but do not have the improvements from the `/gpu/*/gen` backends for {ref}`CeedOperator`.
88
93
94
+
89
95
## Internal Layouts
90
96
91
97
Ceed backends are free to use any E-vector and Q-vector data layout (including never fully forming these vectors) so long as the backend passes the `t5**` series tests and all examples.
@@ -111,6 +117,7 @@ There are several common layouts for L-vectors, E-vectors, and Q-vectors, detail
111
117
- When the {ref}`CeedQFunction` field has `emode``CEED_EVAL_GRAD`, data for quadrature point `i`, component `j`, derivative `k` can be found in the Q-vector at index `i + Q*j + Q*num_comp*k`.
112
118
- Backend developers must take special care to ensure that the data in the Q-vectors for a field with `emode``CEED_EVAL_NONE` is properly ordered when the backend uses different layouts for E-vectors and Q-vectors.
113
119
120
+
114
121
## CeedVector Array Access
115
122
116
123
Backend implementations are expected to separately track 'owned' and 'borrowed' memory locations.
@@ -146,6 +153,7 @@ All backends may assume that array access will conform to these guidelines:
146
153
Data synchronization is not required for the memory location returned by {c:func}`CeedVectorGetArrayWrite`.
147
154
The caller should assume that all data at the memory location returned by {c:func}`CeedVectorGetArrayWrite` is *invalid*.
148
155
156
+
149
157
## Shape
150
158
151
159
Backends often manipulate tensors of dimension greater than 2.
@@ -182,11 +190,13 @@ and
182
190
183
191
are purely implicit -- one just indexes the same array using the appropriate convention.
184
192
193
+
185
194
## `restrict` Semantics
186
195
187
196
QFunction arguments can be assumed to have `restrict` semantics.
188
197
That is, each input and output array must reside in distinct memory without overlap.
189
198
199
+
190
200
## Style Guide
191
201
192
202
Please check your code for style issues by running
@@ -209,13 +219,18 @@ Single line `if` statements are acceptable, but if `clang-format` forces it to b
209
219
This is enforced automatically for all enabled backends via `make format`, with the exception of header files in the `include/ceed/jit-source` directory.
210
220
These files cannot be automatically formatted by `clang-tidy`, as they cannot be compiled as standalone sources.
211
221
222
+
212
223
## Function Conventions
213
224
225
+
214
226
### Naming
227
+
215
228
All functions in the libCEED library should be prefixed by `Ceed` and generally take a `Ceed` object as its first argument.
216
229
If a function takes, for example, a `CeedOperator` as its first argument, then it should be prefixed with `CeedOperator`.
217
230
231
+
218
232
### Style
233
+
219
234
Functions should adhere mostly to the PETSc function style, specifically:
220
235
221
236
1. All local variables of a particular type (for example, `CeedInt`) should be listed on the same line if possible; otherwise, they should be listed on adjacent lines. For example,
All other functions should have their *declarations* prefixed with `CEED_INTERN`.
266
281
Function *definitions* should have neither.
267
282
283
+
268
284
## Clang-tidy
269
285
270
286
Please check your code for common issues by running
@@ -280,6 +296,7 @@ To run on a single file, use
280
296
for example.
281
297
All issues reported by `make tidy` should be fixed.
282
298
299
+
283
300
## Include-What-You-Use
284
301
285
302
Header inclusion for source files should follow the principal of 'include what you use' rather than relying upon transitive `#include` to define all symbols.
@@ -299,3 +316,34 @@ The `ceed-f64.h` and `ceed-f32.h` headers should only be included in `ceed.h`.
299
316
#include <string.h>
300
317
#include "ceed-avx.h"
301
318
```
319
+
320
+
321
+
## Updating CI
322
+
323
+
There are two main types of CI for libCEED - GitHub Actions and GitLab Runners.
324
+
325
+
The GitHub Actions focus on CPU based tests without any external dependencies, for the C, Fortran, Rust, Python, and Julia interfaces.
326
+
The GitHub Actions can be updated as required by editing the appropriate `.yml` file in `.github/workflows`.
327
+
328
+
The GitLab Runners focus on GPU based tests and external dependencies.
329
+
The GitLab Runners can be updated as required by editing `.gitlab-ci.yml` and updating the dependencies installed on Noether.
330
+
331
+
The following dependencies are installed on Noether:
332
+
333
+
* MAGMA: `/projects/MAGMA` and `/projects/hipMAGMA`
334
+
335
+
* PETSc: `/projects/petsc`
336
+
337
+
* deal.II: `/projects/dealii`
338
+
339
+
The following dependencies are built on the fly and cached:
340
+
341
+
* LIBXSMM
342
+
343
+
* Nek5000
344
+
345
+
When managing the installed dependencies, use the `phypid` account.
346
+
347
+
Note: PETSc commit `7ada2a5134eeb4113b6693316dd2660902f08a96` must be reverted for libCEED fluid dynamics examples to pass (see [issue 1686](https://github.com/CEED/libCEED/issues/1686)).
0 commit comments