Skip to content

Commit

Permalink
Remove arch sync
Browse files Browse the repository at this point in the history
  • Loading branch information
luraess committed Nov 11, 2023
1 parent b262aeb commit a607dc6
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion scripts_future_API/benchmark_diffusion_2D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function diffusion_2D(ka_backend=CPU())
(global_rank(topo) == 0) && println("it = $it")
launch!(arch, grid, update_qC! => (qC, C, dc, Δ); location=Vertex(), hide_boundaries, boundary_conditions=bc_q, outer_width)
launch!(arch, grid, update_C! => (C, qC, dt, Δ); location=Center(), expand=1)
Architectures.synchronize(arch)
synchronize(arch.backend)
if it % 5 == 0
gather!(arch, C_g, C)
if global_rank(topo) == 0
Expand Down
2 changes: 1 addition & 1 deletion scripts_future_API/benchmark_diffusion_3D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function diffusion_3D(ka_backend=CPU())
(global_rank(topo) == 0) && println("it = $it")
launch!(arch, grid, update_qC! => (qC, C, dc, Δ); location=Vertex(), hide_boundaries, boundary_conditions=bc_q, outer_width)
launch!(arch, grid, update_C! => (C, qC, dt, Δ); location=Center(), hide_boundaries, boundary_conditions=bc_c, outer_width)
Architectures.synchronize(arch)
synchronize(arch.backend)
end

gather!(arch, C_g, C)
Expand Down
4 changes: 1 addition & 3 deletions src/Architectures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Architectures
export Architecture

export launch!, set_device!, get_device, set_device_and_priority!, heuristic_groupsize
export synchronize, backend, device, details
export backend, device, details

using FastIce.Grids

Expand All @@ -26,8 +26,6 @@ device(arch::Architecture) = arch.device
backend(arch::Architecture) = arch.backend
details(arch::Architecture) = arch.details

synchronize(arch::Architecture) = KernelAbstractions.synchronize(arch.backend)

set_device!(arch::Architecture) = set_device!(arch.device)

function set_device_and_priority!(arch::Architecture, prio::Symbol)
Expand Down
2 changes: 1 addition & 1 deletion src/BoundaryConditions/field_boundary_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function apply_boundary_conditions!(::Val{S}, ::Val{D},
end
worksize = maximum(sizes)
_apply_boundary_conditions!(backend(arch), 256, worksize)(Val(S), Val(D), grid, sizes, offsets, fields, conditions)
async || Architectures.synchronize(arch)
async || KernelAbstractions.synchronize(arch.backend)
return
end

Expand Down
2 changes: 1 addition & 1 deletion src/BoundaryConditions/hide_boundaries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function hide(fun::F, hb::HideBoundaries{N}, arch::Architecture, grid::Cartesian
put!(pipe) do
fun(range)
apply_boundary_conditions!(Val(side), Val(dim), arch, grid, batch)
Architectures.synchronize(arch)
KernelAbstractions.synchronize(arch.backend)
end
end
wait.(hb.pipelines[dim]) # synchronize spatial dimension
Expand Down
4 changes: 2 additions & 2 deletions src/Distributed/boundary_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function apply_boundary_conditions!(::Val{S}, ::Val{D},
send_view = get_send_view(Val(S), Val(D), fields[idx])
copyto!(info.send_buffer, send_view)
end
Architectures.synchronize(arch)
KernelAbstractions.synchronize(arch.backend)

# initiate non-blocking MPI send
for idx in eachindex(fields)
Expand All @@ -54,7 +54,7 @@ function apply_boundary_conditions!(::Val{S}, ::Val{D},
end
yield()
end
async || Architectures.synchronize(arch)
async || KernelAbstractions.synchronize(arch.backend)

return
end
Expand Down
2 changes: 1 addition & 1 deletion src/KernelLaunch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function launch!(arch::Architecture, grid::CartesianGrid, kernel::Pair{K,Args};
end
end

async || Architectures.synchronize(arch)
async || KernelAbstractions.synchronize(arch.backend)
return
end

Expand Down

0 comments on commit a607dc6

Please sign in to comment.