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

Refactor Linker tool to be a CompilerWrapper #20

Closed
hiker opened this issue Aug 28, 2024 · 2 comments
Closed

Refactor Linker tool to be a CompilerWrapper #20

hiker opened this issue Aug 28, 2024 · 2 comments
Assignees

Comments

@hiker
Copy link
Owner

hiker commented Aug 28, 2024

I can't see a good use case that anyone would want to use a non-compiler as linker. So by making Linker a compiler wrapper we enforce that each linker is a compiler (and that we can always add compiler flags like openmp, ... to the link flags automatically).

@hiker
Copy link
Owner Author

hiker commented Sep 5, 2024

Important additional requirement:
Similar to the way compiler wrapper reuse flags of a compiler, we need the same feature for linker.
Use case: A non-MPI version might use gfortran as linker, so a user would specify all flags for gfortran. But if we then want to link with mpif90-gfortran, we need to specify the same flags again. It would be much more useful if the linker-mpif90-gfortran could inherit flags from linker-gfortran. Not sure atm how to do this best, but the decorator pattern might just work - a linker could be be using another linker-compiler-wrapper etc.

Additionally, it must then also be able to overwrite them! E.g. one infrastructure library comes in a MPI and non-MPI version (with slightly different names). So linker-gfortran would link dl_esm_inf using the non-mpi version of the lib, but linker-mpif90-gfortran would instead link the MPI-enabled version. If we stick with this pattern, a compiler wrapper would need to collect all library settings 'underneath' (which is only available if the wrapped tools is another linker, and not the compiler), but then update any settings with its own.

Am happy to discuss

@hiker
Copy link
Owner Author

hiker commented Nov 26, 2024

Migrated to MetOffice#357

@hiker hiker closed this as completed Nov 26, 2024
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

No branches or pull requests

2 participants