Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
e30f1ea
add note about field types in parallel and extend node in data
omlins Jul 14, 2026
c8639df
add documentation for fields
omlins Jul 14, 2026
a15b7b5
add documentation for fields
omlins Jul 14, 2026
84b4f58
extend data and field allocation unit tests
omlins Jul 16, 2026
7ebbeb3
update the data module and parallel regarding allocation
omlins Jul 19, 2026
945cda3
enable translation to device type of used field types
omlins Jul 20, 2026
510ceec
enable translation to device type of used field types
omlins Jul 20, 2026
0c99ce6
enable translation to device type of used field types
omlins Jul 20, 2026
8e9bc91
make parallel calls CPU work for launch false non-interactively
omlins Jul 20, 2026
0a06c74
update data and allocation tests for padding
omlins Jul 20, 2026
1ed4c87
support padding in Data
omlins Jul 21, 2026
9c3a7ef
set PK tests to padding false and PS tests to padding true and update…
omlins Jul 22, 2026
d444747
set PK tests to padding false and PS tests to padding true and update…
omlins Jul 22, 2026
8eadcd7
update unit tests to test 2nd block with GPU backend when available
omlins Jul 23, 2026
ea82dbf
introduce undocumented _cpu macro allocators
omlins Jul 23, 2026
762cd26
generalize optvars for expr and convert dotted for keys in optranges/…
omlins Jul 25, 2026
84a74dd
add unit tests for dotted keys in optranges
omlins Jul 25, 2026
f8d2923
generalize optvars for expr and convert dotted for keys in optranges/…
omlins Jul 25, 2026
c17daf5
generalize optvars for expr and convert dotted for keys in optranges/…
omlins Jul 25, 2026
46960a0
create kernel launching unit tests
omlins Jul 25, 2026
4cd717d
make padding memopt tests fail the same way as script
omlins Jul 28, 2026
d5772f3
comment memopt test for padding=true
omlins Jul 31, 2026
18daf0f
introduce double-buffered data types and allocators
omlins Aug 2, 2026
c5379e7
introduce double-buffered data types and allocators in basic allocato…
omlins Aug 2, 2026
6f1b092
introduce double-buffer opt
omlins Aug 2, 2026
8471a97
introduce double-buffer swap
omlins Aug 2, 2026
9df3035
error for AD when double buffering
omlins Aug 2, 2026
5a8a7e6
update Doc strings for double-buffering
omlins Aug 2, 2026
11aa363
remove again fully official padding
omlins Aug 2, 2026
b0bceb1
fix double buffering aliases and give error for incoherent kernels
omlins Aug 3, 2026
61300ea
update existing tests to pass with new double buffering implementation
omlins Aug 3, 2026
16be5c9
fix double buffering keyword argument issue
omlins Aug 3, 2026
0135939
enable support for any keys in memopt
omlins Aug 4, 2026
f39be07
solve swap issues
omlins Aug 4, 2026
8315940
add unit tests for field allocators
omlins Aug 4, 2026
f317145
add unit tests for field allocators
omlins Aug 4, 2026
43ad593
add unit tests for field allocators
omlins Aug 5, 2026
443a6ee
fixed evaluation of topal
omlins Aug 5, 2026
d0e22ad
add unit tests for field allocators
omlins Aug 5, 2026
ff2ed99
add field allocator unit test
omlins Aug 31, 2026
3ce14ea
add swap unit tests
omlins Aug 31, 2026
b4b5c54
add Double Buffer argument unit tests
omlins Sep 2, 2026
2d68a41
bump CUDA and CellArrays
omlins Sep 2, 2026
7ba8bdf
add AbstractArray2B
omlins Sep 4, 2026
ed323fe
add AbstractArray2B
omlins Sep 4, 2026
f881fe1
extend unit tests for double buffering
omlins Sep 4, 2026
711f71e
remove explicit line breaks in comments
omlins Sep 7, 2026
0524f61
remove explicit line breaks in comments
omlins Sep 7, 2026
768a9a2
improve documentation
omlins Sep 7, 2026
d371df3
update docstrings
omlins Sep 8, 2026
98e6c3f
fix hide communication unit test
omlins Sep 8, 2026
b21c8ae
fix PS compute capability for tests to 7
omlins Sep 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ ParallelStencil_OneAPIExt = "oneAPI"

[compat]
AMDGPU = "1, 2"
CUDA = "3.12, 4, 5"
CellArrays = "0.3.2"
CUDA = "3.12, 4, 5, 6"
CellArrays = "0.3.4"
Enzyme = "0.12, 0.13"
KernelAbstractions = "0.9"
MacroTools = "0.5"
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Beyond traditional high-performance computing, ParallelStencil supports automati
- [Seamless interoperability with communication packages and hiding communication](#seamless-interoperability-with-communication-packages-and-hiding-communication)
- [Support for architecture-agnostic low level kernel programming](#support-for-architecture-agnostic-low-level-kernel-programming)
- [Support for logical arrays of small arrays / structs](#support-for-logical-arrays-of-small-arrays--structs)
- [Support for scientific field types](#support-for-scientific-field-types)
- [Support for automatic differentiation of architecture-agnostic parallel kernels](#support-for-automatic-differentiation-of-architecture-agnostic-parallel-kernels)
- [Module documentation callable from the Julia REPL / IJulia](#module-documentation-callable-from-the-julia-repl--ijulia)
- [Concise single/multi-xPU miniapps](#concise-singlemulti-xpu-miniapps)
Expand Down Expand Up @@ -336,6 +337,25 @@ A = @zeros(nx, ny, nz, celltype=SymmetricTensor3D)
```
Details are found in the [Module documentation callable from the Julia REPL / IJulia](#module-documentation-callable-from-the-julia-repl--ijulia).

## Support for scientific field types
Building on the architecture-agnostic allocation macros earlier introduced (see [Parallelization and optimization with one macro call](#parallelization-and-optimization-with-one-macro-call)), ParallelStencil provides dedicated field allocation macros that allocate fields whose number of components and per-component array dimensionality follow the length of the passed `gridsize`; padding, when enabled at package initialization, applies uniformly to all of them. The scalar field macro `@Field` allocates a single array; the component field macros `@XField`/`@YField`/`@ZField`, `@BXField`/`@BYField`/`@BZField`, and `@XXField`/`@YYField`/`@ZZField`/`@XYField`/`@XZField`/`@YZField` allocate the individual components of a vector, vector with boundaries, or tensor field, respectively; `@VectorField` and `@BVectorField` allocate a whole vector field (optionally with boundaries) as a tuple of component arrays; `@TensorField` allocates a whole tensor field as a tuple of component arrays; and `@allocate` allocates multiple kinds of fields at once on a shared `gridsize` (and initializes them).
```julia
# Allocate one scalar field on a 2-D grid
T = @Field((nx, ny))

# Allocate component fields of a vector and a tensor field
Vx, Vy = @XField((nx, ny)), @YField((nx, ny))
Txx, Tyy, Tzz, Txy, Txz, Tyz = @XXField((nx, ny)), @YYField((nx, ny)), @ZZField((nx, ny)),
@XYField((nx, ny)), @XZField((nx, ny)), @YZField((nx, ny))

# Allocate a whole vector field (with boundaries) and a tensor field at once
V, T = @BVectorField((nx, ny)), @TensorField((nx, ny))

# Allocate multiple kinds of fields on a shared gridsize in one call
A, B = @allocate((nx, ny), A=@VectorField, B=@XField)
```
The aggregate field type aliases exposed by the generated `Data.Fields`/`TData.Fields` submodules reflect the component structure: `VectorField`/`BVectorField` keep a single shared parameter between the number of components and the per-component array dimensionality (for a `gridsize` of length `N`, the number of components always equals `N`), while `TensorField` takes a separate parameter for the number of components in addition to the per-component array dimensionality (its number of components `N*(N+1)/2` is always distinct from `N`). See `?@Field`, `?@VectorField`, `?@BVectorField`, `?@TensorField`, `?@allocate` and the generated `Data.Fields` module for the full reference.

## Support for automatic differentiation of architecture-agnostic parallel kernels
[Enzyme.jl]-powered automatic differentiation of architecture-agnostic parallel kernels is fully integrated into ParallelStencil's API and exposed both with high-level and generic syntax. The keyword argument `∇` is enough to trigger a parallel call to the gradient kernel instead of the kernel itself, e.g:
```julia
Expand Down
22 changes: 21 additions & 1 deletion src/FieldAllocators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ Provides macros for the allocation of different kind of fields on a grid of size
###### Tensor fields
- [`@TensorField`](@ref)

###### Double-buffered fields (2B suffix)
For every field allocator macro there is a corresponding double-buffered version with a `2B` suffix (e.g. [`@Field2B`](@ref), [`@VectorField2B`](@ref), [`@TensorField2B`](@ref)). A `2B` macro allocates a `NamedTuple{(:in, :out)}` of two single-buffer fields and is intended to enable ParallelStencil's automatic double-buffering optimization.

To see a description of a macro type `?<macroname>` (including the `@`).
"""
module FieldAllocators
Expand Down Expand Up @@ -61,5 +64,22 @@ module FieldAllocators
macro XYYZZField(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@XYYZZField($(args...)))); end
macro XXYZZField(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@XXYZZField($(args...)))); end

export @allocate, @Field, @VectorField, @BVectorField, @TensorField, @XField, @BXField, @YField, @BYField, @ZField, @BZField, @XXField, @YYField, @ZZField, @XYField, @XZField, @YZField
@doc replace(ParallelKernel.FieldAllocators.FIELD2B_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro Field2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@Field2B($(args...)))); end
@doc replace(ParallelKernel.FieldAllocators.VECTORFIELD2B_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro VectorField2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@VectorField2B($(args...)))); end
@doc replace(ParallelKernel.FieldAllocators.BVECTORFIELD2B_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro BVectorField2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@BVectorField2B($(args...)))); end
@doc replace(ParallelKernel.FieldAllocators.TENSORFIELD2B_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro TensorField2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@TensorField2B($(args...)))); end
@doc replace(ParallelKernel.FieldAllocators.FIELD2B_COMP_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro XField2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@XField2B($(args...)))); end
@doc replace(ParallelKernel.FieldAllocators.FIELD2B_COMP_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro BXField2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@BXField2B($(args...)))); end
@doc replace(ParallelKernel.FieldAllocators.FIELD2B_COMP_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro YField2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@YField2B($(args...)))); end
@doc replace(ParallelKernel.FieldAllocators.FIELD2B_COMP_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro BYField2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@BYField2B($(args...)))); end
@doc replace(ParallelKernel.FieldAllocators.FIELD2B_COMP_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro ZField2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@ZField2B($(args...)))); end
@doc replace(ParallelKernel.FieldAllocators.FIELD2B_COMP_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro BZField2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@BZField2B($(args...)))); end
@doc replace(ParallelKernel.FieldAllocators.FIELD2B_COMP_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro XXField2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@XXField2B($(args...)))); end
@doc replace(ParallelKernel.FieldAllocators.FIELD2B_COMP_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro YYField2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@YYField2B($(args...)))); end
@doc replace(ParallelKernel.FieldAllocators.FIELD2B_COMP_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro ZZField2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@ZZField2B($(args...)))); end
@doc replace(ParallelKernel.FieldAllocators.FIELD2B_COMP_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro XYField2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@XYField2B($(args...)))); end
@doc replace(ParallelKernel.FieldAllocators.FIELD2B_COMP_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro XZField2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@XZField2B($(args...)))); end
@doc replace(ParallelKernel.FieldAllocators.FIELD2B_COMP_DOC, "@init_parallel_kernel" => "@init_parallel_stencil") macro YZField2B(args...) check_initialized(__module__); esc(:(ParallelStencil.ParallelKernel.FieldAllocators.@YZField2B($(args...)))); end

export @allocate, @Field, @VectorField, @BVectorField, @TensorField, @XField, @BXField, @YField, @BYField, @ZField, @BZField, @XXField, @YYField, @ZZField, @XYField, @XZField, @YZField, @Field2B, @VectorField2B, @BVectorField2B, @TensorField2B, @XField2B, @BXField2B, @YField2B, @BYField2B, @ZField2B, @BZField2B, @XXField2B, @YYField2B, @ZZField2B, @XYField2B, @XZField2B, @YZField2B
end
Loading
Loading