-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add a keyword argument iostream for all Krylov methods #677
Conversation
Good idea! Next best thing to a logger! |
Codecov ReportBase: 98.19% // Head: 98.24% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #677 +/- ##
==========================================
+ Coverage 98.19% 98.24% +0.04%
==========================================
Files 37 37
Lines 6601 6599 -2
==========================================
+ Hits 6482 6483 +1
+ Misses 119 116 -3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I don't understand why I have allocations when I use a sparse matrix and not when I use a dense one. 🤔 using Printf
function krylov(A, b::AbstractVector{T}; verbose::Int=0, iostream::IO=stdout) where {T}
verbose > 0 && @printf(iostream, "%3d\n", 42)
return nothing
end
A = rand(10, 10)
b = rand(10)
krylov(A, b) # warm up
@allocated krylov(A, b) # 0 byte
krylov(A, b, iostream=stdout) # warm up
@allocated krylov(A, b, iostream=stdout) # 32 bytes
A2 = sprand(10, 10, 0.5)
b2 = rand(10)
krylov(A2, b2) # warm up
@allocated krylov(A2, b2) # 48 bytes
krylov(A2, b2, iostream=stdout) # warm up
@allocated krylov(A2, b2, iostream=stdout) # 32 bytes
const kstdout = stdout
function krylov2(A, b::AbstractVector{T}; verbose::Int=0, iostream::IO=kstdout) where {T}
verbose > 0 && @printf(iostream, "%3d\n", 42)
return nothing
end
A = rand(10, 10)
b = rand(10)
krylov2(A, b) # warm up
@allocated krylov2(A, b) # 0 byte
krylov2(A, b, iostream=kstdout) # warm up
@allocated krylov2(A, b, iostream=kstdout) # 16 bytes
A2 = sprand(10, 10, 0.5)
b2 = rand(10)
krylov2(A2, b2) # warm up
@allocated krylov2(A2, b2) # 0 byte
krylov2(A2, b2, iostream=kstdout) # warm up
@allocated krylov2(A2, b2, iostream=kstdout) # 16 bytes |
What does the |
I checked with I will open an issue in the GitHub repository of Julia. |
@dpo I don't have allocations with |
great that it was not a bug! |
358ee40
to
afc70af
Compare
https://juliasmoothoptimizers.github.io/Krylov.jl/previews/PR677/
We will be able to store the outputs of verbose mode with this modification.