-
Notifications
You must be signed in to change notification settings - Fork 66
add scripts to set up minimal EESSI environment and configure EasyBuild, use init/* scripts in install script, inject RPATH override directory via prepare hook to allow for overriding MPI library #116
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
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
626097e
Allow overriding OpenMPI via rpath
b62e0f2
Make it general enough for any MPI
270a533
Tidy up
b783ad0
Tidy up
5176a24
Was targetting wrong stepgit add .
6aaf63d
Be more careful when we set/unset an attribute
15da2a6
Tidy up
9e96fa5
Use explicit getattr
0b1861d
Update eb_hooks.py
1bc594b
let build script also define $EESSI_SOFTWAREPATH, so it can be used b…
boegel fd46408
Merge pull request #2 from boegel/openmpi_hook
790e1c5
Tidy-up and deduplication
42fb84c
Merge branch 'openmpi_hook' of github.com:ocaisa/software-layer into …
053073a
EESSI_SOFTWARE_PATH already set
fbe342e
Search in a lib subdirectory
577545e
Check in both lib and lib64 for overrides
b93c859
Merge branch 'main' into openmpi_hook
boegel 2d122ec
bump EESSI pilot version in init script, print output message rather …
boegel 5f073de
cosmetic changes to eb_hooks.py
boegel fc7d444
rename 'error' to 'fatal_error' in install script, to avoid clash wit…
boegel bfc615a
split of script to define minimal EESSI environment + avoid relying o…
boegel d0e0706
source script to set minimal EESSI environment + check early whether …
boegel 44f0fee
add check to see whether EESSI CernVM-FS repository is mounted
boegel 4ce9cca
split off script to configure EasyBuild from install script
boegel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| export EASYBUILD_PREFIX=${WORKDIR}/easybuild | ||
| export EASYBUILD_INSTALLPATH=${EESSI_PREFIX}/software/${EESSI_OS_TYPE}/${EESSI_SOFTWARE_SUBDIR} | ||
| export EASYBUILD_SOURCEPATH=${WORKDIR}/easybuild/sources:${EESSI_SOURCEPATH} | ||
|
|
||
| # just ignore OS dependencies for now, see https://github.com/easybuilders/easybuild-framework/issues/3430 | ||
| export EASYBUILD_IGNORE_OSDEPS=1 | ||
|
|
||
| export EASYBUILD_SYSROOT=${EPREFIX} | ||
|
|
||
| export EASYBUILD_DEBUG=1 | ||
| export EASYBUILD_TRACE=1 | ||
| export EASYBUILD_ZIP_LOGS=bzip2 | ||
|
|
||
| export EASYBUILD_RPATH=1 | ||
| export EASYBUILD_FILTER_ENV_VARS=LD_LIBRARY_PATH | ||
|
|
||
| export EASYBUILD_HOOKS=$(realpath eb_hooks.py) | ||
| # make sure hooks are available, so we can produce a clear error message | ||
| if [ ! -f $EASYBUILD_HOOKS ]; then | ||
| fatal_error "$EASYBUILD_HOOKS does not exist!" | ||
| fi | ||
|
|
||
| # note: filtering Bison may break some installations, like Qt5 (see https://github.com/EESSI/software-layer/issues/49) | ||
| # filtering pkg-config breaks R-bundle-Bioconductor installation (see also https://github.com/easybuilders/easybuild-easyconfigs/pull/11104) | ||
| # problems occur when filtering pkg-config with gnuplot too (picks up Lua 5.1 from $EPREFIX rather than from Lua 5.3 dependency) | ||
| DEPS_TO_FILTER=Autoconf,Automake,Autotools,binutils,bzip2,cURL,DBus,flex,gettext,gperf,help2man,intltool,libreadline,libtool,Lua,M4,makeinfo,ncurses,util-linux,XZ,zlib | ||
| # For aarch64 we need to also filter out Yasm. | ||
| # See https://github.com/easybuilders/easybuild-easyconfigs/issues/11190 | ||
| if [[ "$EESSI_CPU_FAMILY" == "aarch64" ]]; then | ||
| DEPS_TO_FILTER="${DEPS_TO_FILTER},Yasm" | ||
| fi | ||
|
|
||
| export EASYBUILD_FILTER_DEPS=$DEPS_TO_FILTER | ||
|
|
||
| export EASYBUILD_MODULE_EXTENSIONS=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,21 +3,93 @@ | |
| import os | ||
|
|
||
| from easybuild.tools.build_log import EasyBuildError, print_msg | ||
| from easybuild.tools.config import build_option, update_build_option | ||
| from easybuild.tools.systemtools import POWER, get_cpu_architecture | ||
|
|
||
| EESSI_RPATH_OVERRIDE_ATTR = 'orig_rpath_override_dirs' | ||
|
|
||
|
|
||
| def get_eessi_envvar(eessi_envvar): | ||
| """Get an EESSI environment variable from the environment""" | ||
|
|
||
| eessi_envvar_value = os.getenv(eessi_envvar) | ||
| if eessi_envvar_value is None: | ||
| raise EasyBuildError("$%s is not defined!", eessi_envvar) | ||
|
|
||
| return eessi_envvar_value | ||
|
|
||
|
|
||
| def get_rpath_override_dirs(software_name): | ||
| # determine path to installations in software layer via $EESSI_SOFTWARE_PATH | ||
| eessi_software_path = get_eessi_envvar('EESSI_SOFTWARE_PATH') | ||
| eessi_pilot_version = get_eessi_envvar('EESSI_PILOT_VERSION') | ||
|
|
||
| # construct the rpath override directory stub | ||
| rpath_injection_stub = os.path.join( | ||
| # Make sure we are looking inside the `host_injections` directory | ||
| eessi_software_path.replace(eessi_pilot_version, os.path.join('host_injections', eessi_pilot_version), 1), | ||
| # Add the subdirectory for the specific software | ||
| 'rpath_overrides', | ||
| software_name, | ||
| # We can't know the version, but this allows the use of a symlink | ||
| # to facilitate version upgrades without removing files | ||
| 'system', | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This approach means that you can symlink to a host MPI installation directly (but you'd still need a module to pick up |
||
| ) | ||
|
|
||
| # Allow for libraries in lib or lib64 | ||
| rpath_injection_dirs = [os.path.join(rpath_injection_stub, x) for x in ('lib', 'lib64')] | ||
|
|
||
| return rpath_injection_dirs | ||
|
|
||
|
|
||
| def parse_hook(ec, *args, **kwargs): | ||
| """Main parse hook: trigger custom functions based on software name.""" | ||
|
|
||
| # determine path to Prefix installation in compat layer via $EPREFIX | ||
| eprefix = os.getenv('EPREFIX') | ||
| if eprefix is None: | ||
| raise EasyBuildError("$EPREFIX is not defined!") | ||
| eprefix = get_eessi_envvar('EPREFIX') | ||
|
|
||
| if ec.name in PARSE_HOOKS: | ||
| PARSE_HOOKS[ec.name](ec, eprefix) | ||
|
|
||
|
|
||
| def pre_prepare_hook(self, *args, **kwargs): | ||
| """Main pre-prepare hook: trigger custom functions.""" | ||
|
|
||
| # Check if we have an MPI family in the toolchain (returns None if there is not) | ||
| mpi_family = self.toolchain.mpi_family() | ||
boegel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Inject an RPATH override for MPI (if needed) | ||
| if mpi_family: | ||
| # Get list of override directories | ||
| mpi_rpath_override_dirs = get_rpath_override_dirs(mpi_family) | ||
|
|
||
| # update the relevant option (but keep the original value so we can reset it later) | ||
| if hasattr(self, EESSI_RPATH_OVERRIDE_ATTR): | ||
| raise EasyBuildError("'self' already has attribute %s! Can't use pre_prepare hook.", | ||
| EESSI_RPATH_OVERRIDE_ATTR) | ||
|
|
||
| setattr(self, EESSI_RPATH_OVERRIDE_ATTR, build_option('rpath_override_dirs')) | ||
| if getattr(self, EESSI_RPATH_OVERRIDE_ATTR): | ||
| # self.EESSI_RPATH_OVERRIDE_ATTR is (already) a colon separated string, let's make it a list | ||
| orig_rpath_override_dirs = [getattr(self, EESSI_RPATH_OVERRIDE_ATTR)] | ||
| rpath_override_dirs = ':'.join(orig_rpath_override_dirs + mpi_rpath_override_dirs) | ||
| else: | ||
| rpath_override_dirs = ':'.join(mpi_rpath_override_dirs) | ||
| update_build_option('rpath_override_dirs', rpath_override_dirs) | ||
| print_msg("Updated rpath_override_dirs (to allow overriding MPI family %s): %s", | ||
| mpi_family, rpath_override_dirs) | ||
|
|
||
|
|
||
| def post_prepare_hook(self, *args, **kwargs): | ||
| """Main post-prepare hook: trigger custom functions.""" | ||
|
|
||
| if hasattr(self, EESSI_RPATH_OVERRIDE_ATTR): | ||
| # Reset the value of 'rpath_override_dirs' now that we are finished with it | ||
| update_build_option('rpath_override_dirs', getattr(self, EESSI_RPATH_OVERRIDE_ATTR)) | ||
| print_msg("Resetting rpath_override_dirs to original value: %s", getattr(self, EESSI_RPATH_OVERRIDE_ATTR)) | ||
| delattr(self, EESSI_RPATH_OVERRIDE_ATTR) | ||
|
|
||
|
|
||
| def cgal_toolchainopts_precise(ec, eprefix): | ||
| """Enable 'precise' rather than 'strict' toolchain option for CGAL on POWER.""" | ||
| if ec.name == 'CGAL': | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.