-
Notifications
You must be signed in to change notification settings - Fork 0
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
Performance in Julia 0.5 #30
Comments
Looks like all of the time is spent on the |
Oh dear. Do you have a simple repro? When I try this: julia> using Unitful, AxisArrays, ImageFiltering
julia> const μm = u"μm"
julia> A = rand(Float32, 1000, 1000, 60);
julia> AA = AxisArray(A, (:x, :l, :z), (0.771μm, 0.771μm, 5μm));
julia> imfilter(A, Kernel.gaussian((3,3,1))); I see it uses an FFT-based algorithm. So I don't think I'm looking at the same thing as you. |
OK, this seems to do it: julia> using Images, BlockRegistrationScheduler
julia> ps = pixelspacing(AA)
(0.771 μm,0.771 μm,5 μm)
julia> sigmahp = Float64[25μm/x for x in ps]
julia> pp = PreprocessSNF(0.01, zeros(3), sigmahp)
RegisterDriver.PreprocessSNF(0.01f0,Float32[0.0,0.0,0.0],Float32[32.4254,32.4254,5.0])
julia> pp(AA) I'll investigate. Also, is 100 the proper setting for the bias anymore? Remember that the output of |
Try this diff (adds an $ git diff
diff --git a/src/OffsetArrays.jl b/src/OffsetArrays.jl
index 10e5f0c..2d85db2 100644
--- a/src/OffsetArrays.jl
+++ b/src/OffsetArrays.jl
@@ -125,7 +125,7 @@ Base.fill(x, inds::Tuple{UnitRange,Vararg{UnitRange}}) =
### Low-level utilities ###
# Computing a shifted index (subtracting the offset)
-offset{N}(offsets::NTuple{N,Int}, inds::NTuple{N,Int}) = _offset((), offsets, inds)
+@inline offset{N}(offsets::NTuple{N,Int}, inds::NTuple{N,Int}) = _offset((), offsets, inds)
_offset(out, ::Tuple{}, ::Tuple{}) = out
@inline _offset(out, offsets, inds) =
_offset((out..., inds[1]-offsets[1]), Base.tail(offsets), Base.tail(inds)) |
Also, if you're desperate for more performance, try annotating the bounds-checks in OffsetArrays with |
Did this fix your performance problem? |
I got by without filtering for now, and I'm working on segmentation for my upcoming department talk. Hoping I can return to this soon. |
Gotcha. If you don't need filtering, better not to do it anyway. |
OK that definitely solved the problem! |
Awesome! I'll make the fix in OffsetArrays. |
Should the change be merged? |
It's merged in JuliaArrays/OffsetArrays.jl#26, but a new release hasn't been tagged yet. |
New release has been merged into METADATA. |
I'm getting slow performance with
RegisterWorkerApertures.PreprocessSNF
in Julia 0.5. It now takes a couple of minutes to filter an image when it used to take a couple of seconds. I'm still not great at reading the output ofcode_warntype
but I think theAny
types at the end may reflect a type inference problem? I'm profiling it now, will post the result.The text was updated successfully, but these errors were encountered: