Skip to content

Commit

Permalink
Preallocate imfilter kernel memory (#45)
Browse files Browse the repository at this point in the history
* Preallocate imfilter kernel memory in GPU

* Update tests

* Refact krn buffer optimization

* Revert preallocate imfilter kernel

* Add CUDA.zeros to pad kernel
  • Loading branch information
ClaroHenrique authored Aug 26, 2022
1 parent 522472a commit d55da6c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/imfilter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ function imfilter_gpu(img, krn)
T = eltype(img)

# pad kernel to common size with image
padsize = size(img) .- size(krn)
padkrn = padarray(krn, Fill(zero(T), ntuple(i->0, N), padsize))
padkrn = CUDA.zeros(size(img))
copyto!(padkrn, CartesianIndices(krn), CuArray(krn), CartesianIndices(krn))

# perform ifft(fft(img) .* conj.(fft(krn)))
fftimg = img |> CUFFT.fft
Expand Down

0 comments on commit d55da6c

Please sign in to comment.