Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distributed tridiagonal Fourier solver #3689

Merged
merged 834 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
834 commits
Select commit Hold shift + click to select a range
1db41bb
some changes
simone-silvestri Sep 12, 2023
f2bc008
bugfix
simone-silvestri Sep 12, 2023
0911063
bugfix
simone-silvestri Sep 12, 2023
e6608a6
bugfixxed
simone-silvestri Sep 18, 2023
38f2b87
another bugfix
simone-silvestri Sep 18, 2023
4ed8333
Merge branch 'main' into ss/load-balance-and-corners
simone-silvestri Sep 18, 2023
7da9b59
compute_diffusivities!
simone-silvestri Sep 18, 2023
dafa13c
required halo size
simone-silvestri Sep 18, 2023
56892eb
all fixed
simone-silvestri Sep 18, 2023
bf927ae
shorten line
simone-silvestri Sep 19, 2023
bac7f4e
fix comment
simone-silvestri Sep 19, 2023
d48d1c9
remove abbreviation
simone-silvestri Sep 19, 2023
3679421
remove unused functions
simone-silvestri Sep 19, 2023
92739b0
better explanation of the MPI tag
simone-silvestri Sep 19, 2023
eab6dde
Update src/ImmersedBoundaries/active_cells_map.jl
simone-silvestri Sep 19, 2023
3bbcdcd
Update src/Solvers/batched_tridiagonal_solver.jl
simone-silvestri Sep 19, 2023
4259130
change name
simone-silvestri Sep 19, 2023
c118bf0
Merge branch 'ss/load-balance-and-corners' of github.com:CliMA/Oceana…
simone-silvestri Sep 19, 2023
d5e75a3
docstring
simone-silvestri Sep 19, 2023
256de76
name change on rank
simone-silvestri Sep 19, 2023
0bfeb97
interior active cells
simone-silvestri Sep 19, 2023
1b96804
calculate -> compute
simone-silvestri Sep 19, 2023
8f6fc68
fixed tests
simone-silvestri Sep 19, 2023
de64e92
do not compute momentum in prescribed velocities
simone-silvestri Sep 19, 2023
58d92ec
DistributedComputations
simone-silvestri Sep 19, 2023
cab51e5
DistributedComputations part #2
simone-silvestri Sep 19, 2023
dfbc048
bugfix
simone-silvestri Sep 19, 2023
d0c0e0a
Merge remote-tracking branch 'origin/ss/load-balance-and-corners' int…
simone-silvestri Sep 19, 2023
4e7c250
comment
simone-silvestri Sep 19, 2023
fdbc6db
Merge remote-tracking branch 'origin/main' into ss/distributed-fft
simone-silvestri Sep 20, 2023
e5219b3
starting tests
simone-silvestri Sep 20, 2023
1df315e
test the ffts
simone-silvestri Sep 20, 2023
903f8c8
bugfix
simone-silvestri Sep 20, 2023
058a721
small change
simone-silvestri Sep 20, 2023
632c081
add transpose test
simone-silvestri Sep 22, 2023
1e92971
MPI.VBuffer
simone-silvestri Sep 22, 2023
e830ef0
fixed these tests for the moment
simone-silvestri Sep 22, 2023
4ad0477
using
simone-silvestri Sep 22, 2023
937a3e3
transpose
simone-silvestri Sep 22, 2023
27bda75
fixed the distributed FFT tests
simone-silvestri Sep 22, 2023
794edf2
Merge branch 'ss/distributed-fft' of github.com:CliMA/Oceananigans.jl…
simone-silvestri Sep 22, 2023
50e10c5
not yet tridiagonal
simone-silvestri Sep 22, 2023
2a38c94
fulfill requirements
simone-silvestri Sep 22, 2023
12b7752
Merge branch 'main' into ss/distributed-fft
navidcy Oct 5, 2023
a7984cf
fix doctest
navidcy Oct 5, 2023
49e9706
Merge remote-tracking branch 'origin/main' into ss/distributed-fft
simone-silvestri Nov 5, 2023
7e7b6f4
Merge branch 'ss/distributed-fft' of github.com:CliMA/Oceananigans.jl…
simone-silvestri Nov 5, 2023
04674d9
add distributed script
simone-silvestri Nov 5, 2023
da57837
bugfix
simone-silvestri Nov 5, 2023
6b024a3
update to current syntax
simone-silvestri Nov 5, 2023
fd1f4ac
couple of changes
simone-silvestri Nov 5, 2023
1346ffd
more instructions
simone-silvestri Nov 5, 2023
51f206a
remove pencilstuff
simone-silvestri Nov 5, 2023
1bb9fe9
at least precompiles
simone-silvestri Nov 5, 2023
9de7aba
modify test
simone-silvestri Nov 5, 2023
bcb0c4d
simplify
simone-silvestri Nov 5, 2023
9999ff2
run test
simone-silvestri Nov 5, 2023
e059083
correct comment
simone-silvestri Nov 5, 2023
0eded67
bugfix
simone-silvestri Nov 5, 2023
6107240
grammar
simone-silvestri Nov 5, 2023
fe7cc6f
more comments
simone-silvestri Nov 5, 2023
d4deaea
fix tests
simone-silvestri Nov 6, 2023
557b27f
new commit
simone-silvestri Nov 6, 2023
9a21837
fixing the injection
simone-silvestri Nov 6, 2023
21a2cf2
bugfix distributed
simone-silvestri Nov 6, 2023
0e79ef4
new syntax
simone-silvestri Nov 6, 2023
14ee8d2
comment
simone-silvestri Nov 6, 2023
3dc3c4f
comment
simone-silvestri Nov 6, 2023
3de135e
couple of TODOs
simone-silvestri Nov 6, 2023
ce260a5
comment
simone-silvestri Nov 6, 2023
9cad0d3
distributed hydrostatic
simone-silvestri Nov 6, 2023
f724b53
added hydrostatic simulation
simone-silvestri Nov 6, 2023
c0a5d1d
fixed tests
simone-silvestri Nov 6, 2023
6c57b14
small change
simone-silvestri Nov 6, 2023
3a0f4a8
Merge remote-tracking branch 'origin/main' into ss/distributed-fft
simone-silvestri Mar 7, 2024
8978f75
testing also regression on nonhydrostatic
simone-silvestri Mar 7, 2024
33feb20
remove pencilarrays
simone-silvestri Mar 7, 2024
d71a66b
some small, bugfixes
simone-silvestri Mar 8, 2024
44e354c
small bugfix
simone-silvestri Mar 8, 2024
52a6b15
Merge remote-tracking branch 'origin/main' into ss/distributed-fft
simone-silvestri Jun 19, 2024
a9eb4ba
new manifest
simone-silvestri Jun 19, 2024
86a74e7
switch to on_architecture
simone-silvestri Jun 19, 2024
99f8dac
test an hypothesis
simone-silvestri Jun 19, 2024
9157a59
update the ocean large eddy regression test
simone-silvestri Jun 19, 2024
069b3c5
correct rayleigh benard regression
simone-silvestri Jun 19, 2024
955c548
correct thermal regression test
simone-silvestri Jun 19, 2024
b031f7d
more bugfixes
simone-silvestri Jun 19, 2024
35a3c80
bugfixes for the regression tests
simone-silvestri Jun 19, 2024
9ee487c
some corrections
simone-silvestri Jun 19, 2024
de3e7ff
another bugfix for regression
simone-silvestri Jun 19, 2024
e3f0590
test quickly on gpus
simone-silvestri Jun 19, 2024
78933b9
define fallback for reconstruct_global_grid
simone-silvestri Jun 19, 2024
dcd37f0
gpu tests
simone-silvestri Jun 19, 2024
8268307
last bugfix to distribute regression tests
simone-silvestri Jun 20, 2024
daca24e
do not do the thermal bubble for the moment
simone-silvestri Jun 20, 2024
ae8be0a
adding gpu distributed solvers tests
simone-silvestri Jun 20, 2024
12242f2
finally it works for bounded
simone-silvestri Jun 20, 2024
7245066
make sure everything is on the CPU
simone-silvestri Jun 20, 2024
097ce66
make sure everything is on the CPU
simone-silvestri Jun 20, 2024
a94d68f
test distributed poisson also on the GPU
simone-silvestri Jun 20, 2024
f419c2b
at least the poisson solve works, next the regression tests
simone-silvestri Jun 20, 2024
bd71182
another bug in the tests
simone-silvestri Jun 20, 2024
83a7eff
Merge branch 'main' into ss/distributed-fft
simone-silvestri Jun 20, 2024
6ecac2c
some docs
simone-silvestri Jun 20, 2024
49ee120
some naming changes
simone-silvestri Jun 20, 2024
06ad085
change file naming
simone-silvestri Jun 20, 2024
c7c4d6b
bugfix
simone-silvestri Jun 20, 2024
d5fd2f0
bugfix distributed regression
simone-silvestri Jun 20, 2024
aee49c5
wrong indices
simone-silvestri Jun 20, 2024
1c15059
leave out other tests for the moment
simone-silvestri Jun 20, 2024
c99d05f
make sure we use correct archs for regression
simone-silvestri Jun 20, 2024
8787b9d
non hydrostatic regression archs
simone-silvestri Jun 20, 2024
78c4401
Merge branch 'main' into ss/distributed-fft
simone-silvestri Jun 20, 2024
c6f52ee
remove test file
simone-silvestri Jun 20, 2024
e06a47d
Merge branch 'ss/distributed-fft' of github.com:CliMA/Oceananigans.jl…
simone-silvestri Jun 20, 2024
5599fc1
this should make all test pass
simone-silvestri Jun 21, 2024
a3579a9
archs outside
simone-silvestri Jun 21, 2024
eb0efd2
move `archs` to the right position
simone-silvestri Jun 21, 2024
c651977
add comments
simone-silvestri Jun 21, 2024
15de8e9
Merge branch 'main' into ss/distributed-fft
simone-silvestri Jun 21, 2024
5c650cc
fix doctests
simone-silvestri Jun 21, 2024
b5c46e1
Merge branch 'ss/distributed-fft' of github.com:CliMA/Oceananigans.jl…
simone-silvestri Jun 21, 2024
5ac70e4
small name change
simone-silvestri Jun 26, 2024
88a29b7
Update src/DistributedComputations/distributed_fft_based_poisson_solv…
simone-silvestri Jun 28, 2024
e3e4aa0
change to named tuple
simone-silvestri Jun 28, 2024
0cfedb5
Merge branch 'ss/distributed-fft' of github.com:CliMA/Oceananigans.jl…
simone-silvestri Jun 28, 2024
6144d5a
try it out
simone-silvestri Jun 28, 2024
0f6ebdb
allow Flat directions and FieldTimeSeries
simone-silvestri Jul 2, 2024
5a19ff2
Merge branch 'main' into ss/distributed-fft
simone-silvestri Jul 16, 2024
db90097
implementing child architecture for grids
simone-silvestri Jul 17, 2024
b0d8e90
Merge branch 'ss/distributed-fft' of github.com:CliMA/Oceananigans.jl…
simone-silvestri Jul 17, 2024
b25edf5
solve_poisson_in_spectral_space!
simone-silvestri Jul 17, 2024
442c59c
adding some docs
simone-silvestri Jul 17, 2024
a24afe7
docs formatting
navidcy Jul 21, 2024
20280c3
use julia v1.10.4
navidcy Jul 21, 2024
084d410
resolve deps
navidcy Jul 21, 2024
433304a
use julia v1.10.4
navidcy Jul 21, 2024
f4d7657
bump patch release
navidcy Jul 21, 2024
61c0bb8
formatting
navidcy Jul 21, 2024
072d39b
formatting
navidcy Jul 21, 2024
9ad40c6
formatting
navidcy Jul 21, 2024
6ced66e
Merge branch 'main' into ss/distributed-fft
simone-silvestri Jul 22, 2024
6556b5e
Merge branch 'main' into ss/distributed-fft
simone-silvestri Jul 23, 2024
ad3b991
adapting manifest
simone-silvestri Jul 23, 2024
187cad7
Merge branch 'main' into ss/distributed-fft
navidcy Jul 25, 2024
c44dbf7
Merge remote-tracking branch 'origin/ss/distributed-fft' into ss/dist…
simone-silvestri Jul 26, 2024
c4aafb9
should run
simone-silvestri Jul 26, 2024
d337644
test all
simone-silvestri Jul 26, 2024
c252aeb
bugfix
simone-silvestri Jul 26, 2024
376b0c7
bugfix
simone-silvestri Jul 26, 2024
369896c
some progress
simone-silvestri Jul 26, 2024
dc62e42
bugfix
simone-silvestri Jul 26, 2024
154ce1e
Merge branch 'ss/distributed-fft' of github.com:CliMA/Oceananigans.jl…
simone-silvestri Jul 26, 2024
2db0d65
fix assemble coordinate
simone-silvestri Jul 26, 2024
e61b25b
loos like it's working!
simone-silvestri Jul 26, 2024
55ca17e
fix docs
simone-silvestri Jul 26, 2024
5ebeb9c
comments
simone-silvestri Jul 26, 2024
5e818bb
comments
simone-silvestri Jul 26, 2024
69a25ed
rayeigh benard stretched test
simone-silvestri Jul 28, 2024
9baabec
somoe validation
simone-silvestri Jul 28, 2024
87b2f7a
Merge branch 'main' into ss/distributed-fft
simone-silvestri Jul 30, 2024
77402d0
fix `partition_coordinate`
simone-silvestri Jul 30, 2024
9841f93
spit out error + fixes to docs
simone-silvestri Jul 30, 2024
a323136
more docfixes
simone-silvestri Jul 30, 2024
7235a7b
yet another docfix
simone-silvestri Jul 31, 2024
33be303
Merge remote-tracking branch 'origin/ss/distributed-fft' into ss/dist…
simone-silvestri Jul 31, 2024
84be51c
make sure validation example works
simone-silvestri Aug 2, 2024
a1a3bfd
add a couple of comments
simone-silvestri Aug 2, 2024
6a3c2e6
Update validation/distributed_simulations/distributed_nonhydrostatic_…
simone-silvestri Aug 2, 2024
284798a
Merge branch 'main' into ss/distributed-fft
simone-silvestri Aug 3, 2024
ddbdbfb
retry the build
simone-silvestri Aug 3, 2024
c3e21ba
Merge branch 'ss/distributed-fft' of github.com:CliMA/Oceananigans.jl…
simone-silvestri Aug 3, 2024
53851d5
Merge branch 'main' into ss/distributed-fft
simone-silvestri Aug 3, 2024
29b0356
Update src/DistributedComputations/distributed_fft_based_poisson_solv…
simone-silvestri Aug 4, 2024
015f76a
Update src/DistributedComputations/distributed_fft_based_poisson_solv…
simone-silvestri Aug 4, 2024
733afe1
Update src/DistributedComputations/distributed_transpose.jl
simone-silvestri Aug 4, 2024
6bbfab4
Update test/test_distributed_transpose.jl
simone-silvestri Aug 4, 2024
09c267f
docs changes
simone-silvestri Aug 4, 2024
fcdb091
Merge branch 'ss/distributed-fft' of github.com:CliMA/Oceananigans.jl…
simone-silvestri Aug 4, 2024
728e144
adding a validation to the configuration
simone-silvestri Aug 4, 2024
f8c08c1
add a configuration validation
simone-silvestri Aug 4, 2024
cc25af1
remove the `ArgumentError`
simone-silvestri Aug 4, 2024
a008267
Merge remote-tracking branch 'origin/ss/distributed-fft' into ss/dist…
simone-silvestri Aug 4, 2024
17803d7
alignment
simone-silvestri Aug 4, 2024
8e970fa
clarify a bit the sizes in `TransposableField`
simone-silvestri Aug 4, 2024
f7366b0
fixed tests
simone-silvestri Aug 4, 2024
7143e1e
fix tests
simone-silvestri Aug 4, 2024
abc4065
make names very explicit
simone-silvestri Aug 4, 2024
1f246e6
some more explanation
simone-silvestri Aug 4, 2024
0300afb
add more docstring
simone-silvestri Aug 4, 2024
7c1a896
bugfix
simone-silvestri Aug 4, 2024
e8be1e1
Merge branch 'main' into ss/distributed-fft
simone-silvestri Aug 5, 2024
93026f7
address a couple of comments
simone-silvestri Aug 5, 2024
6e80fc6
add link to MPI docs
simone-silvestri Aug 5, 2024
947a2d6
Merge branch 'main' into ss/distributed-fft
simone-silvestri Aug 5, 2024
bb89de8
Merge branch 'main' into ss/distributed-fft
simone-silvestri Aug 5, 2024
fbd889b
bump to 0.92
simone-silvestri Aug 5, 2024
00617c8
Merge branch 'ss/distributed-fft' of github.com:CliMA/Oceananigans.jl…
simone-silvestri Aug 5, 2024
0f76e87
version 91.6
simone-silvestri Aug 5, 2024
e9af320
retry the tests
simone-silvestri Aug 6, 2024
5e19f1d
Merge branch 'main' into ss/distributed-fft
simone-silvestri Aug 6, 2024
b36f2c0
few tweaks in the docstring
navidcy Aug 6, 2024
aef0aaa
Update distributed_fft_based_poisson_solver.jl
navidcy Aug 6, 2024
6541e10
Merge remote-tracking branch 'origin/ss/distributed-fft' into ss/dist…
simone-silvestri Aug 6, 2024
ae97423
some comments to the tridiagonal solver
simone-silvestri Aug 6, 2024
b1c3278
Merge remote-tracking branch 'origin/main' into ss/distributed-tridia…
simone-silvestri Aug 7, 2024
bf6c70e
test the new solver
simone-silvestri Aug 7, 2024
c79459a
bugfix
simone-silvestri Aug 7, 2024
cb5a568
add configuration validation
simone-silvestri Aug 7, 2024
f8cd091
change order of operations
simone-silvestri Aug 7, 2024
e7f62b1
formatting
simone-silvestri Aug 7, 2024
c26a77b
Update src/DistributedComputations/distributed_fft_tridiagonal_solver.jl
simone-silvestri Aug 7, 2024
9fa3243
changed error message
simone-silvestri Aug 7, 2024
68502e4
add new comments
simone-silvestri Aug 7, 2024
30bc3f7
Merge branch 'ss/distributed-tridiagonal-solve' of github.com:CliMA/O…
simone-silvestri Aug 7, 2024
2b36cf1
better explanation
simone-silvestri Aug 7, 2024
3bf38b6
Merge branch 'main' into ss/distributed-tridiagonal-solve
simone-silvestri Aug 7, 2024
3920031
Update src/DistributedComputations/distributed_fft_based_poisson_solv…
simone-silvestri Aug 7, 2024
9a4ab32
some typo
simone-silvestri Aug 7, 2024
d7ecedf
typo
simone-silvestri Aug 7, 2024
fe12bb7
Merge branch 'ss/distributed-tridiagonal-solve' of github.com:CliMA/O…
simone-silvestri Aug 7, 2024
107cea0
Merge branch 'main' into ss/distributed-tridiagonal-solve
simone-silvestri Aug 7, 2024
b720636
retry build
simone-silvestri Aug 7, 2024
0bb8da9
Merge branch 'ss/distributed-tridiagonal-solve' of github.com:CliMA/O…
simone-silvestri Aug 7, 2024
b251b6f
Update src/DistributedComputations/distributed_fft_tridiagonal_solver.jl
simone-silvestri Aug 8, 2024
82270da
Update src/DistributedComputations/distributed_fft_tridiagonal_solver.jl
simone-silvestri Aug 8, 2024
57919e8
Update src/DistributedComputations/distributed_fft_tridiagonal_solver.jl
simone-silvestri Aug 8, 2024
b25ea8c
Update src/DistributedComputations/distributed_fft_tridiagonal_solver.jl
simone-silvestri Aug 8, 2024
b206484
address comments
simone-silvestri Aug 8, 2024
9fc5a35
Merge branch 'ss/distributed-tridiagonal-solve' of github.com:CliMA/O…
simone-silvestri Aug 8, 2024
b28539a
add functionality for unstretched solver
simone-silvestri Aug 8, 2024
404933a
Merge branch 'main' into ss/distributed-tridiagonal-solve
simone-silvestri Aug 8, 2024
4cb3a14
other additions
simone-silvestri Aug 8, 2024
3f719ea
Merge branch 'ss/distributed-tridiagonal-solve' of github.com:CliMA/O…
simone-silvestri Aug 8, 2024
cf891bf
no more need for `XYRegularGrid` and so on!
simone-silvestri Aug 8, 2024
8bb2a84
some bugfixes
simone-silvestri Aug 8, 2024
dda8055
another bugfix
simone-silvestri Aug 8, 2024
e1e21eb
bugfixes
simone-silvestri Aug 8, 2024
3714d04
formatting
simone-silvestri Aug 8, 2024
7046218
fix tests
simone-silvestri Aug 8, 2024
0571cdd
Update src/DistributedComputations/distributed_fft_tridiagonal_solver.jl
simone-silvestri Aug 8, 2024
2b38399
Update src/DistributedComputations/distributed_fft_tridiagonal_solver.jl
simone-silvestri Aug 8, 2024
dddff8a
Update src/DistributedComputations/distributed_grids.jl
simone-silvestri Aug 8, 2024
accd7b4
Update src/DistributedComputations/partition_assemble.jl
simone-silvestri Aug 8, 2024
5e7543e
Update src/DistributedComputations/partition_assemble.jl
simone-silvestri Aug 8, 2024
3166229
another bugfix
simone-silvestri Aug 8, 2024
ca49ee7
Merge branch 'ss/distributed-tridiagonal-solve' of github.com:CliMA/O…
simone-silvestri Aug 8, 2024
8b9f99c
change emojii for distributed pipeline
simone-silvestri Aug 8, 2024
8c85332
another bugfix
simone-silvestri Aug 8, 2024
3023b2e
another typo fix
simone-silvestri Aug 8, 2024
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
1 change: 1 addition & 0 deletions src/DistributedComputations/DistributedComputations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ include("transposable_field.jl")
include("distributed_transpose.jl")
include("plan_distributed_transforms.jl")
include("distributed_fft_based_poisson_solver.jl")
include("distributed_fft_tridiagonal_solver.jl")

end # module
2 changes: 1 addition & 1 deletion src/DistributedComputations/distributed_architectures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ end
Return `Partition` representing the division of a domain in
the `x` (first), `y` (second) and `z` (third) dimension
Keyword arguments:
Keyword arguments:
==================
- `x`: partitioning of the first dimension
Expand Down
40 changes: 22 additions & 18 deletions src/DistributedComputations/distributed_fft_based_poisson_solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import FFTW

using CUDA: @allowscalar
using Oceananigans.Grids: XYZRegularRG
using Oceananigans.Solvers: stretched_dimensions, stretched_direction

import Oceananigans.Solvers: poisson_eigenvalues, solve!
import Oceananigans.Architectures: architecture
Expand Down Expand Up @@ -60,9 +61,9 @@ In the algorithm below, the first dimension is always the local dimension. In ou

1. `storage.zfield`, partitioned over ``(x, y)`` is initialized with the `rhs` that is ``b``.
2. Transform along ``z``.
3 Transpose + communicate to `storage.yfield` partitioned into `(Rx, Ry)` processes in ``(x, z)``.
3 Transpose `storage.zfield` + communicate to `storage.yfield` partitioned into `(Rx, Ry)` processes in ``(x, z)``.
4. Transform along ``y``.
5. Transpose + communicate to `storage.xfield` partitioned into `(Rx, Ry)` processes in ``(y, z)``.
5. Transpose `storage.yfield` + communicate to `storage.xfield` partitioned into `(Rx, Ry)` processes in ``(y, z)``.
6. Transform in ``x``.

At this point the three in-place forward transforms are complete, and we
Expand Down Expand Up @@ -91,8 +92,8 @@ Restrictions
"""
function DistributedFFTBasedPoissonSolver(global_grid, local_grid, planner_flag=FFTW.PATIENT)

validate_global_grid(global_grid)
validate_configuration(global_grid, local_grid)
validate_poisson_solver_distributed_grid(global_grid)
validate_poisson_solver_configuration(global_grid, local_grid)

FT = Complex{eltype(local_grid)}

Expand Down Expand Up @@ -188,38 +189,41 @@ end
end

# TODO: bring up to speed the PCG to remove this error
validate_global_grid(global_grid) =
validate_poisson_solver_distributed_grid(global_grid) =
throw("Grids other than the RectilinearGrid are not supported in the Distributed NonhydrostaticModels")

function validate_global_grid(global_grid::RectilinearGrid)
function validate_poisson_solver_distributed_grid(global_grid::RectilinearGrid)
TX, TY, TZ = topology(global_grid)

if (TY == Bounded && TZ == Periodic) || (TX == Bounded && TY == Periodic) || (TX == Bounded && TZ == Periodic)
throw("NonhydrostaticModels on Distributed grids do not support topology ($TX, $TY, $TZ) at the moment.
TZ Periodic requires also TY and TX to be Periodic, while TY Periodic requires also TX to be Periodic.
Please rotate the domain to obtain the required topology")
throw("Distributed Poisson solvers do not support grids with topology ($TX, $TY, $TZ) at the moment.
A Periodic z-direction requires also the y- and and x-directions to be Periodic, while a Periodic y-direction requires also
the x-direction to be Periodic.")
end

if !(global_grid isa XYZRegularRG)
throw("Stretched directions are not supported with distributed grids at the moment.")
if !(global_grid isa YZRegularRG) && !(global_grid isa XYRegularRG) && !(global_grid isa XZRegularRG)
throw("The provided grid is stretched in directions $(stretched_dimensions(global_grid)).
A distributed Poisson solver supports only RectilinearGrids that have variably-spaced cells in at most one direction.")
end

return nothing
end

function validate_configuration(global_grid, local_grid)
function validate_poisson_solver_configuration(global_grid, local_grid)

# We don't support distributing anything in z.
Rz = architecture(local_grid).ranks[3]
Rz == 1 || throw("Non-singleton ranks in the vertical are not supported by DistributedFFTBasedPoissonSolver.")
Rx, Ry, Rz = architecture(local_grid).ranks
Rz == 1 || throw("Non-singleton ranks in the vertical are not supported by distributed Poisson solvers.")

# Limitation of the current implementation (see the docstring)
if global_grid.Nz % architecture(local_grid).ranks[2] != 0
throw("The number of ranks in the y direction must divide Nz. See the docstring for more information.")
if global_grid.Nz % Ry != 0
throw("The number of ranks in the y-direction are $(Ry) with Nz = $(global_grid.Nz) cells in the z-direction.
The distributed Poisson solver requires that the number of ranks in the y-direction divide Nz.")
end

if global_grid.Ny % architecture(local_grid).ranks[1] != 0
throw("The number of ranks in the x direction must divide Ny. See the docstring for more information.")
if global_grid.Ny % Rx != 0
throw("The number of ranks in the y-direction are $(Rx) with Ny = $(global_grid.Ny) cells in the y-direction.
The distributed Poisson solver requires that the number of ranks in the x-direction divide Ny.")
end

return nothing
Expand Down
Loading