Skip to content
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

Multiple instances of CUTEstModel can now coexist #389

Merged
merged 5 commits into from
Aug 26, 2024

Conversation

amontoison
Copy link
Member

@amontoison amontoison commented Aug 26, 2024

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

Copy link

codecov bot commented Aug 26, 2024

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 ⚠️
src/julia_interface.jl 93.75% 1 Missing ⚠️
Additional details and impacted files
@@             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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@amontoison amontoison requested a review from tmigot August 26, 2024 04:18
@amontoison amontoison merged commit 526eb32 into JuliaSmoothOptimizers:main Aug 26, 2024
12 of 15 checks passed
@amontoison amontoison deleted the multiple_problems branch August 26, 2024 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant