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

Fix parallel state equation for macOS ARM #308

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 src/neighborhood_search/grid_nhs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ function update!(neighborhood_search::GridNeighborhoodSearch, coords_fun)
end

# Use this function barrier and unpack inside to avoid passing closures to Polyester.jl
# with @batch (@threaded).
# Otherwise, @threaded does not work here with Julia ARM on macOS.
# with `@batch` (`@threaded`).
# Otherwise, `@threaded` does not work here with Julia ARM on macOS.
# See https://github.com/JuliaSIMD/Polyester.jl/issues/88.
@inline function mark_changed_cell!(neighborhood_search, cell, coords_fun)
(; hashtable, cell_buffer, cell_buffer_indices) = neighborhood_search
Expand Down
4 changes: 2 additions & 2 deletions src/neighborhood_search/neighborhood_search.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ end
end

# Use this function barrier and unpack inside to avoid passing closures to Polyester.jl
# with @batch (@threaded).
# Otherwise, @threaded does not work here with Julia ARM on macOS.
# with `@batch` (`@threaded`).
# Otherwise, `@threaded` does not work here with Julia ARM on macOS.
# See https://github.com/JuliaSIMD/Polyester.jl/issues/88.
@inline function for_particle_neighbor_inner(f, system_coords, neighbor_system_coords,
neighborhood_search, particle)
Expand Down
13 changes: 9 additions & 4 deletions src/schemes/fluid/weakly_compressible_sph/system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,18 @@ function reinit_density!(system, v, u, v_ode, u_ode, semi)
end

function compute_pressure!(system, v)
(; state_equation, pressure) = system

@trixi_timeit timer() "state equation" @threaded for particle in eachparticle(system)
pressure[particle] = state_equation(particle_density(v, system, particle))
@threaded for particle in eachparticle(system)
apply_state_equation!(system, particle_density(v, system, particle), particle)
end
end

# Use this function to avoid passing closures to Polyester.jl with `@batch` (`@threaded`).
# Otherwise, `@threaded` does not work here with Julia ARM on macOS.
# See https://github.com/JuliaSIMD/Polyester.jl/issues/88.
@inline function apply_state_equation!(system, density, particle)
system.pressure[particle] = system.state_equation(density)
end

function write_v0!(v0, system::WeaklyCompressibleSPHSystem)
(; initial_condition, density_calculator) = system

Expand Down