Skip to content

Commit

Permalink
Remove ineffective unrolls (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
glwagner committed Jun 28, 2024
1 parent 9b947bb commit f71d568
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/DataWrangling/inpaint_mask.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ using Oceananigans.Fields: instantiated_location, interior, CenterField
using Oceananigans.Architectures: architecture, device, GPU

using KernelAbstractions: @kernel, @index
using KernelAbstractions.Extras.LoopInfo: @unroll

# Maybe we can remove this propagate field in lieu of a diffusion,
# Still we'll need to do this a couple of steps on the original grid
Expand All @@ -25,7 +24,7 @@ using KernelAbstractions.Extras.LoopInfo: @unroll
counter = 0
cumsum = zero(eltype(field))

@unroll for n in nb
for n in nb
counter += ifelse(isnan(n), 0, 1)
cumsum += ifelse(isnan(n), 0, n)
end
Expand Down Expand Up @@ -100,7 +99,7 @@ end
i, j = @index(Global, NTuple)
Nz = size(grid, 3)

@unroll for k = Nz-1 : -1 : 1
for k = Nz-1 : -1 : 1
@inbounds field[i, j, k] = ifelse(mask[i, j, k], field[i, j, k+1], field[i, j, k])
end
end
Expand Down

0 comments on commit f71d568

Please sign in to comment.