From 610b57b35c07727cf7e7bc0334c7591a7179162f Mon Sep 17 00:00:00 2001 From: Boris Kaus Date: Thu, 10 Oct 2024 09:13:30 +0200 Subject: [PATCH] more tutorial corrections --- docs/src/man/Tutorial_Chmy_MPI.md | 10 ++++++---- tutorials/Tutorial_Chmy_MPI.jl | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/src/man/Tutorial_Chmy_MPI.md b/docs/src/man/Tutorial_Chmy_MPI.md index e660ea5c..fc078bfd 100644 --- a/docs/src/man/Tutorial_Chmy_MPI.md +++ b/docs/src/man/Tutorial_Chmy_MPI.md @@ -7,7 +7,8 @@ EditURL = "../../../tutorials/Tutorial_Chmy_MPI.jl" ## Aim In this tutorial, your will learn how to use [Chmy](https://github.com/PTsolvers/Chmy.jl) to perform a 2D diffusion simulation on one or multiple CPU's or GPU's. -`Chmy` is a package that allows you to specify grids and fields and create finite difference simulations +`Chmy` is a package that allows you to specify grids and fields and create finite difference simulations, by +applying stencil-based kernels in an efficient manner. ## 1. Load Chmy and required packages @@ -46,7 +47,7 @@ You need to specify compute kernel for the gradients: end ``` -You need to specify compute kernel to update the concentration +You need to specify a compute kernel to update the concentration ```julia @kernel inbounds = true function update_C!(C, q, Δt, g::StructuredGrid, O) @@ -56,7 +57,7 @@ You need to specify compute kernel to update the concentration end ``` -And a main function is required: +And the main function is: ```julia @views function main(backend=CPU(); nxy_l=(126, 126)) @@ -121,7 +122,8 @@ In the code above, the part that calls `GMG` is: ```julia add_box!(P,C,grid, xlim=(-1.0,1.0), zlim=(-1.0,1.0), phase=ConstantPhase(4), T=ConstantTemp(400)) ``` -which works just like any of the other GMG function. +which works just like any of the other GMG function, except that you pass Chmy Scalar Fields and a Chmy grid object. +Note that this also works in MPI-parallel. ## 3. Run the simulation on one CPU machine or GPU card: diff --git a/tutorials/Tutorial_Chmy_MPI.jl b/tutorials/Tutorial_Chmy_MPI.jl index 01ef1c2c..6e6de8b2 100644 --- a/tutorials/Tutorial_Chmy_MPI.jl +++ b/tutorials/Tutorial_Chmy_MPI.jl @@ -3,7 +3,8 @@ # ## Aim # In this tutorial, your will learn how to use [Chmy](https://github.com/PTsolvers/Chmy.jl) to perform a 2D diffusion simulation # on one or multiple CPU's or GPU's. -# `Chmy` is a package that allows you to specify grids and fields and create finite difference simulations +# `Chmy` is a package that allows you to specify grids and fields and create finite difference simulations, by +# applying stencil-based kernels in an efficient manner. # # ## 1. Load Chmy and required packages using Chmy, Chmy.Architectures, Chmy.Grids, Chmy.Fields, Chmy.BoundaryConditions, Chmy.GridOperators, Chmy.KernelLaunch @@ -35,14 +36,14 @@ MPI.Init() q.y[I...] = -χ * ∂y(C, g, I...) end -# You need to specify compute kernel to update the concentration +# You need to specify a compute kernel to update the concentration @kernel inbounds = true function update_C!(C, q, Δt, g::StructuredGrid, O) I = @index(Global, NTuple) I = I + O C[I...] -= Δt * divg(q, g, I...) end -# And a main function is required: +# And the main function is: @views function main(backend=CPU(); nxy_l=(126, 126)) arch = Arch(backend, MPI.COMM_WORLD, (0, 0)) topo = topology(arch) @@ -104,7 +105,8 @@ end # ```julia # add_box!(P,C,grid, xlim=(-1.0,1.0), zlim=(-1.0,1.0), phase=ConstantPhase(4), T=ConstantTemp(400)) # ``` -# which works just like any of the other GMG function. +# which works just like any of the other GMG function, except that you pass Chmy Scalar Fields and a Chmy grid object. +# Note that this also works in MPI-parallel. # ## 3. Run the simulation on one CPU machine or GPU card: