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

Rework: Extensions #130

Merged
merged 97 commits into from
May 2, 2024
Merged

Rework: Extensions #130

merged 97 commits into from
May 2, 2024

Conversation

albert-de-montserrat
Copy link
Collaborator

@albert-de-montserrat albert-de-montserrat commented Apr 2, 2024

Major rework

This PR involves a decent full rework of the internal design of JustRelax.jl.

Main changes

  1. Two-step initialization has been deprecated in favour of using specialized two- and three-dimensional submodules. These submodules include essentially the same code, but they are compiled for the two and three dimensional backends of ParallelStencil. For example, the old initialization
using JustRelax # first stage
model = PS_Setup(:cpu, Float64, 2) 
environment!(model) # second compilation stage

is deprecated in favour of

using JustRelax, JustRelax.JustRelax2D

or

using JustRelax, JustRelax.JustRelax3D
  1. Extensions are used to switch from the CPU to supported GPU backends. This simplifies the setup of the package by removing lots of hacky and inefficient code, and improves pre-compilation. The user now just needs to choose between CPUBackend, CUDABackend,AMDGPUBackend to instantiate the basic JustRelax objects.

  2. To ease a bit the usage of JustRelax and improve readibility, all the functions that required the @parallel macro are not exported anymore. Instead, wrappers around them are exported. E.g.

compute_ρg!(ρg[2], phase_ratios, rheology, args)

substitutes the old

@parallel (@idx ni) compute_ρg!(ρg[2], phase_ratios.center, rheology, args)

@aelligp aelligp added enhancement New feature or request breaking labels Apr 2, 2024
Copy link
Collaborator Author

@albert-de-montserrat albert-de-montserrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2D shear heating benchmark, 64x64, 2 threads, 3 time steps. This branch:

t1 = 13.703740 seconds # (20.70 M allocations: 1.396 GiB, 4.58% gc time, 74.67% compilation time); warm up run (includes compilation)
t2 = 4.833359 seconds # (4.83 M allocations: 412.365 MiB, 0.33% gc time); second run (no compilation)

#main branch

t1 = 15.079457 seconds # (24.12 M allocations: 1.645 GiB, 6.54% gc time, 72.40% compilation time); warm up run (includes compilation) 
t2 = 5.245096 seconds # (5.15 M allocations: 449.310 MiB, 0.31% gc time); second run (no compilation)

@albert-de-montserrat albert-de-montserrat marked this pull request as ready for review April 30, 2024 13:30
@albert-de-montserrat albert-de-montserrat merged commit 8a2596d into main May 2, 2024
11 checks passed
@aelligp aelligp deleted the adm/extensions branch October 12, 2024 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants