-
Notifications
You must be signed in to change notification settings - Fork 20
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
Improve obj and grad! #375
Improve obj and grad! #375
Conversation
8f530f5
to
3805079
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #375 +/- ##
===========================================
- Coverage 89.11% 77.49% -11.63%
===========================================
Files 5 8 +3
Lines 790 1524 +734
===========================================
+ Hits 704 1181 +477
- Misses 86 343 +257 ☔ View full report in Codecov by Sentry. |
Memory leak in Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x6c301825 -- .text at D:\a\CUTEst.jl\CUTEst.jl\deps\files\libHS6_double.DLL (unknown line)
in expression starting at D:\a\CUTEst.jl\CUTEst.jl\test\nlpmodelstest.jl:1
.text at D:\a\CUTEst.jl\CUTEst.jl\deps\files\libHS6_double.DLL (unknown line)
.text at D:\a\CUTEst.jl\CUTEst.jl\deps\files\libHS6_double.DLL (unknown line)
cutest_cigr_ at D:\a\CUTEst.jl\CUTEst.jl\deps\files\libHS6_double.DLL (unknown line)
cutest_cigr_ at D:\a\CUTEst.jl\CUTEst.jl\src\libcutest.jl:411
cigr at D:\a\CUTEst.jl\CUTEst.jl\src\core_interface.jl:3312 [inlined]
grad! at D:\a\CUTEst.jl\CUTEst.jl\src\julia_interface.jl:32 |
|
||
function NLPModels.obj(nlp::CUTEstModel{T}, x::AbstractVector) where T | ||
@lencheck nlp.meta.nvar x | ||
x_ = Vector{T}(x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this could be preallocated in the problem structure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we could but it's the same issue with all routines.
I'm wondering if we should not remove the dispatch for input vectors of wrong type.
If the CUTEstModel
is in double precision, the user should provide input arrays in double precision.
What do you think?
Otherwise, we need to duplicate storage in the CUTEstModel
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of Julia dispatches in that way. It’s useful because we routinely call problem functions with views.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Views are handled by the other method with x::StrideOneVector{T}
.
This kind of method is only used if x
is a Vector{Float32}
or a CuVector{Float64}
and nlp is a CUTEstModel{Float64}
.
But should we handle that?
function NLPModels.grad!(nlp::CUTEstModel{T}, x::AbstractVector, g::AbstractVector) where T | ||
@lencheck nlp.meta.nvar x g | ||
x_ = Vector{T}(x) | ||
g_ = Vector{T}(g) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preallocate this too?
3805079
to
54c2cae
Compare
217a575
into
JuliaSmoothOptimizers:main
No description provided.