GALAHAD icon indicating copy to clipboard operation
GALAHAD copied to clipboard

[documentation] Add a note about precompiled libHSL

Open amontoison opened this issue 4 months ago • 9 comments

GALAHAD is precompiled with GitHub is a way that allows dynamic swaping of the dummy libhsl_subset/$dlext / libhsl_subset_64.$dlext from https://github.com/ralna/libHSL by the official libraries available at https://licences.stfc.ac.uk/products/Software/HSL/libhsl.

It should work with the releases >= 5.3.0 now and we should probably explain that to the C / Fortran users. It is already documented for the Julia users.

Dominique asked me a few questions about it because it is not documented.

amontoison avatar Sep 11 '25 12:09 amontoison

Good, I presume you will do this as you know how it works. Under the makefile build, we have a default environment variable HSL=-lhsl, so I presume it is simply a case of changing this to HSL="-lhsl_subset -L(somepath)" or something. I looked at the links you/HSL provides above, and it isn't immediately clear what to do for the HSL subset, but I presume it is trivial. It is simply

C

-I${prefix}/include -L${prefix}/lib -lhsl_subet

Fortran

-I${prefix}/modules -I${prefix}/include -L${prefix}/lib -lhsl_subset and can you pull in both the 32 and 64 bit libraries at the same time?

nimgould avatar Sep 11 '25 12:09 nimgould

It is the step just after that Nick. We already take care of the compilation / linking for the user.

What we can do now is to replaced the shared library libhsl_subset.so (dependency of libgalahad_double.so) dynamically without recompilation. It allows to plug-in the official precompiled libHSL libraries in precompiled GALAHAD libraries with very limited work (which is great for windows users that don't have compiler / linker installed).

amontoison avatar Sep 11 '25 12:09 amontoison

OK, I've ordered HSL, and presumably I'll get the code sometime soon. Then I will try. I'll add this to the docs for the makefile install, but you better do this for the meson one (presumably in the visible README on the website)

nimgould avatar Sep 11 '25 12:09 nimgould

To be clear, I was asking if it's possible to

  1. compile GALAHAD with the dummy libHSL
  2. instruct GALAHAD to use the full libHSL if it becomes available after the fact without recompiling GALAHAD and without overwriting the dummy shared libraries.

Requirement 2 is necessary when GALAHAD and dummy libHSL are installed in system locations (as opposed to a user's home), as would occur when a user doesn't have superuser privileges, and as does occur when you installed precompiled "bottles" with Homebrew.

dpo avatar Sep 11 '25 14:09 dpo

This is trivial for the makefile install, indeed what happens automatically there; all the dummy hsl files are compiled into libgalahad_hsl.a, the link stage compiles using the environment variable $HSL (which is set by default to -lgalahad_hsl), and this allows the user (indeed galahad itself if so configured via the HSLSUBSET environment variable) to override this with the proper libhsl.a. But, of course, this is a static library thing where things can easily be juggled at link and go time.

nimgould avatar Sep 11 '25 14:09 nimgould

I’m only talking about the meson system, which is what users read about in the README.

dpo avatar Sep 11 '25 15:09 dpo

I'll defer to the experts in that case

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: Dominique @.> Sent: Thursday, September 11, 2025 4:16:54 PM To: ralna/GALAHAD @.> Cc: Gould, Nick (STFC,RAL,SC) @.>; Comment @.> Subject: Re: [ralna/GALAHAD] [documentation] Add a note about precompiled libHSL (Issue #512)

[https://avatars.githubusercontent.com/u/38760?s=20&v=4]dpo left a comment (ralna/GALAHAD#512)https://github.com/ralna/GALAHAD/issues/512#issuecomment-3281356633

I’m only talking about the meson system, which is what users read about in the README.

— Reply to this email directly, view it on GitHubhttps://github.com/ralna/GALAHAD/issues/512#issuecomment-3281356633, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACW4A6XOY3HGE63QTCCK6AT3SGG6NAVCNFSM6AAAAACGHOZ6WWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEOBRGM2TMNRTGM. You are receiving this because you commented.Message ID: @.***>

nimgould avatar Sep 11 '25 15:09 nimgould

@dpo It will require a demuxer of the HSL libraries like I did in CUTEst for the SIF libraries ("trampoline"). It may be possible in theory but it is a lot of work because Nick also relies on the Fortran modules for HSL. For CUTEst / SIF we only need some symbols in a shared library and we call directly call them with libdl.

It requires a redesign of GALAHAD for the interface of HSL packages. It is not on our roadmap.

amontoison avatar Sep 11 '25 22:09 amontoison

Ok. I thought that was how things worked already, but apparently not. Nevermind. I guess Homebrew will not have libHSL.

dpo avatar Sep 12 '25 11:09 dpo