ralna / CUTEst

The Constrained and Unconstrained Testing Environment with safe threads (CUTEst) for optimization software
Other
83 stars 18 forks source link

Test the shared libraries of CUTEst #50

Open amontoison opened 3 weeks ago

amontoison commented 3 weeks ago

The new Meson build system, introduced with release 2.1.0, compiles static libraries (libcutest_single.a, libcutest_double.a) by default. These libraries are incomplete by design and require linking with other object files that are problem-dependent in practice.

But the compilation of shared libraries is now functional. I have added an additional file, cutest_delegate.f90, which is compiled only when shared libraries are requested to Meson. This approach proves beneficial when using CUTEst through high-level languages like Python or Julia.

With functions such as load_routines_s, load_routines, and load_routines_q, we can dynamically switch the shared library used for a particular problem.

cc @jfowkes

nimgould commented 3 weeks ago

Very good. Of course the makefile build provides more than just the cutest library, it also gives interfaces to many external packages, and provides scripts to run a particular problem with a particular external package.

amontoison commented 3 weeks ago

I completely agree, Nick. The makefile build system is more comprehensive than Meson and offers additional features (support more interfaces). Meson just simplifies the compilation of libcutest_single and libcutest_double across all platforms.

I discovered that dlopen and dlsym are not available on Windows when I tested CUTEst in GALAHAD. Windows uses LoadLibrary and GetProcAddress... I need to update cutest_delegate.f90.

#ifdef _WIN32
// Windows-specific code using LoadLibrary, GetProcAddress
#else
// Unix-specific code using dlopen, dlsym
#endif