JuliaSmoothOptimizers / CUTEst.jl

Julia's CUTEst Interface
GNU Lesser General Public License v3.0
48 stars 20 forks source link

Multiple instances of CUTEstModel can now coexist #389

Closed amontoison closed 2 months ago

amontoison commented 2 months ago

Each shared library dedicated to a SIF problem in a given precision is no longer linked to the same libcutest_$precision.$dlext. This previously caused issues when attempting to use multiple CUTEstModel instances for the same precision simultaneously.

By using static libraries instead, multiple problems can now be used simultaneously without conflict, as each library is independent from the others due to static linking.

I have modified the wrapper generator to add a libsif argument, which is of type Ptr{Cvoid}, returned by Libdl.dlopen. Each CUTEstModel now has a libsif field.

Users no longer need to manually call finalizer(nlp); the garbage collector will handle it automatically. The only scenario where it might be necessary is if the user recreates a model with the same problem:

nlp1 = CUTEstModel{Float64}("HS1")
finalize(nlp1)
nlp2 = CUTEstModel{Float64}("HS1")

It could be relevant in the case that the dimension of the problem is modified.

I have removed all global variables related to paths and the number of instantiated problems for a given precision.

I also updated the README.md to remove the @everywhere trick, as it is no longer necessary.

Note that we can't do this on macOS/Linux with Julia 1.6 because the Fortran compilers used to cross-compile binaries / Julia are incompatible with the libgfortran provided by the user's compiler. Fortunately, Julia 1.10 will soon become the new LTS version.

cc @tmigot

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 92.12598% with 10 lines in your changes missing coverage. Please review.

Project coverage is 78.12%. Comparing base (f2ad6a4) to head (72da31f). Report is 70 commits behind head on main.

Files Patch % Lines
src/core_interface.jl 87.32% 9 Missing :warning:
src/julia_interface.jl 93.75% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #389 +/- ## =========================================== - Coverage 89.11% 78.12% -11.00% =========================================== Files 5 8 +3 Lines 790 1545 +755 =========================================== + Hits 704 1207 +503 - Misses 86 338 +252 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.