-
Notifications
You must be signed in to change notification settings - Fork 104
Parallel simulations using MPI.jl #141
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
Draft
marinlauber
wants to merge
45
commits into
WaterLily-jl:master
Choose a base branch
from
marinlauber:MPI
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
c2b0db6
double ghost working and solver fix
07aca6f
working mpi Isend/Irecv! with WaterLily
ffad91a
add new WaterLily.BC! function
6d41236
update examples/Project.toml
c404a52
Merge branch 'weymouth:master' into MPI
marinlauber 66d485b
add BC! function for scalar and vector fields
ef3316a
update examples/Project.toml
e168ba2
working conv_diff! but not project!
8994832
fix loc function for double halos
054711e
add MPI functions and Poisson working
6977c1f
add MPI as extension
511cc44
try and fix extension, not working
2d4f4bf
merge master into MPI
cae2d1e
type dispatch for BC! functions
3294511
working mom_step! with Poisson solver
marinlauber 4d2cc50
running with MG solver, but no convegence
b94babe
start proper testing
marinlauber 23a96d9
proper tesing and psolver issue
2945552
fix solver inside/inside_u
cd1948f
fixed inside function for double halos
312b1b8
working parallel poisson solver
50c8695
add MPIArray type
a8abd84
Merge branch 'WaterLily-jl:master' into MPI
marinlauber 1ee9341
fix type dispatch for MPIArray
f09736d
fix type dispatch for MPIArray
4a5eb0e
AllReduce in residuals!(pois)
marinlauber 281818b
perBC! in Jacobi
marinlauber 7241d39
tidy solver and MPI
marinlauber ec72ec1
add exitBC! function
marinlauber 7fdbdd8
MPIArray working with sims
marinlauber b62cde4
clean MPIArray methods
marinlauber 13388de
add Parallel VTK function
marinlauber 883e17b
fix pvtk export with MPI
marinlauber 8bf893a
MPI as an extension running
283a46b
MPI in extension and remove old files
9af4ad2
move all write file to their extentions and tidy examples
marinlauber 0bd4e68
remove unused tests
marinlauber cdc1ba6
move some test into proper testing file
marinlauber 5b6de27
reduce mpi swaps in BC!
e84b638
fixed loc issue
b098083
merge master into MPI and add/updatels tests
f24199b
fix test VTK and MPI
dc2c90f
more elegant global_loc() function
3be8f8f
fix write vtk erro and convective exit
3153ee2
non-allocating halo swap for scalar fields and more tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| [deps] | ||
| CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" | ||
| FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" | ||
| ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" | ||
| GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a" | ||
| GR = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71" | ||
| GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326" | ||
| JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" | ||
| KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c" | ||
| MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" | ||
| Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" | ||
| Meshing = "e6723b4c-ebff-59f1-b4b7-d97aa5274f73" | ||
| Optim = "429524aa-4258-5aef-a3af-852621145aeb" | ||
| Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" | ||
| ReadVTK = "dc215faf-f008-4882-a9f7-a79a826fadc3" | ||
| StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" | ||
| UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228" | ||
| WaterLily = "ed894a53-35f9-47f1-b17f-85db9237eebd" | ||
| WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| #mpiexecjl --project=. -n 2 julia TwoD_CircleMPI.jl | ||
|
|
||
| using WaterLily | ||
| using WriteVTK | ||
| using MPI | ||
| using StaticArrays | ||
|
|
||
| # make a writer with some attributes, now we need to apply the BCs when writting | ||
| velocity(a::Simulation) = a.flow.u |> Array; | ||
| pressure(a::Simulation) = a.flow.p |> Array; | ||
| _body(a::Simulation) = (measure_sdf!(a.flow.σ, a.body); | ||
| a.flow.σ |> Array;) | ||
| vorticity(a::Simulation) = (@inside a.flow.σ[I] = | ||
| WaterLily.curl(3,I,a.flow.u)*a.L/a.U; | ||
| WaterLily.perBC!(a.flow.σ,()); | ||
| a.flow.σ |> Array;) | ||
| _vbody(a::Simulation) = a.flow.V |> Array; | ||
| mu0(a::Simulation) = a.flow.μ₀ |> Array; | ||
| ranks(a::Simulation) = (a.flow.σ.=0; | ||
| @inside a.flow.σ[I] = me()+1; | ||
| WaterLily.perBC!(a.flow.σ,()); | ||
| a.flow.σ |> Array;) | ||
|
|
||
| custom_attrib = Dict( | ||
| "u" => velocity, | ||
| "p" => pressure, | ||
| "d" => _body, | ||
| "ω" => vorticity, | ||
| "v" => _vbody, | ||
| "μ₀" => mu0, | ||
| "rank" => ranks | ||
| )# this maps what to write to the name in the file | ||
|
|
||
| """Flow around a circle""" | ||
| function circle(dims,center,radius;Re=250,U=1,psolver=MultiLevelPoisson,mem=Array) | ||
| body = AutoBody((x,t)->√sum(abs2, x .- center) - radius) | ||
| Simulation(dims, (U,0), radius; ν=U*radius/Re, body, exitBC=false, mem=mem, psolver=psolver) | ||
| end | ||
|
|
||
| # local grid size | ||
| L = 2^6 | ||
|
|
||
| # init the MPI grid and the simulation | ||
| r = init_mpi((L,2L)) | ||
| sim = circle((L,2L),SA[L/2,L+2],L/8;mem=MPIArray) #use MPIArray to use extension | ||
|
|
||
| wr = vtkWriter("WaterLily-MPI-circle";attrib=custom_attrib,dir="vtk_data", | ||
| extents=get_extents(sim.flow.p)) | ||
| for _ in 1:50 | ||
| sim_step!(sim,sim_time(sim)+1.0,verbose=true) | ||
| write!(wr,sim) | ||
| end | ||
| close(wr) | ||
| finalize_mpi() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| using WaterLily | ||
|
|
||
| # circle simulation | ||
| function circle(n,m;Re=250,U=1) | ||
| radius, center = m/8, m/2 | ||
| body = AutoBody((x,t)->√sum(abs2, x .- center) - radius) | ||
| Simulation((n,m), (U,0), radius; ν=U*radius/Re, body, mem=MPIArray) | ||
| end | ||
|
|
||
| # test on sim | ||
| include("/home/marin/Workspace/Tutorials-WaterLily/src/TwoD_plots.jl") | ||
| sim = circle(3*2^6,2^7) | ||
| sim_gif!(sim,duration=10,clims=(-5,5),plotbody=true) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.