From a607dc6e5b913898282f56ffdd8f2b27cdc15dfb Mon Sep 17 00:00:00 2001 From: Ludovic Raess Date: Sat, 11 Nov 2023 10:16:52 +0100 Subject: [PATCH] Remove arch sync --- scripts_future_API/benchmark_diffusion_2D.jl | 2 +- scripts_future_API/benchmark_diffusion_3D.jl | 2 +- src/Architectures.jl | 4 +--- src/BoundaryConditions/field_boundary_conditions.jl | 2 +- src/BoundaryConditions/hide_boundaries.jl | 2 +- src/Distributed/boundary_conditions.jl | 4 ++-- src/KernelLaunch.jl | 2 +- 7 files changed, 8 insertions(+), 10 deletions(-) diff --git a/scripts_future_API/benchmark_diffusion_2D.jl b/scripts_future_API/benchmark_diffusion_2D.jl index 45dcccff..5c653f29 100644 --- a/scripts_future_API/benchmark_diffusion_2D.jl +++ b/scripts_future_API/benchmark_diffusion_2D.jl @@ -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 diff --git a/scripts_future_API/benchmark_diffusion_3D.jl b/scripts_future_API/benchmark_diffusion_3D.jl index 59fbc2f4..4e83aa43 100644 --- a/scripts_future_API/benchmark_diffusion_3D.jl +++ b/scripts_future_API/benchmark_diffusion_3D.jl @@ -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) diff --git a/src/Architectures.jl b/src/Architectures.jl index 77ac5407..c0455405 100644 --- a/src/Architectures.jl +++ b/src/Architectures.jl @@ -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 @@ -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) diff --git a/src/BoundaryConditions/field_boundary_conditions.jl b/src/BoundaryConditions/field_boundary_conditions.jl index d3d1fe65..158d8092 100644 --- a/src/BoundaryConditions/field_boundary_conditions.jl +++ b/src/BoundaryConditions/field_boundary_conditions.jl @@ -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 diff --git a/src/BoundaryConditions/hide_boundaries.jl b/src/BoundaryConditions/hide_boundaries.jl index 0173908f..3d7a5581 100644 --- a/src/BoundaryConditions/hide_boundaries.jl +++ b/src/BoundaryConditions/hide_boundaries.jl @@ -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 diff --git a/src/Distributed/boundary_conditions.jl b/src/Distributed/boundary_conditions.jl index 7cf4805d..951b5144 100644 --- a/src/Distributed/boundary_conditions.jl +++ b/src/Distributed/boundary_conditions.jl @@ -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) @@ -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 diff --git a/src/KernelLaunch.jl b/src/KernelLaunch.jl index 22c182c6..40329a18 100644 --- a/src/KernelLaunch.jl +++ b/src/KernelLaunch.jl @@ -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