Skip to content

Conversation

@ocaisa
Copy link
Member

@ocaisa ocaisa commented Jun 22, 2021

This will configure the relevant rpath override option whenever MPI is part of the toolchain being used to build the software

@ocaisa
Copy link
Member Author

ocaisa commented Jun 22, 2021

Addresses #108

@ocaisa
Copy link
Member Author

ocaisa commented Jun 22, 2021

@boegel I'm not sure how this file should be organised. It looks like it is going to get messy.

@ocaisa
Copy link
Member Author

ocaisa commented Jun 22, 2021

Example when existing value for rpath_override_dirs

[EESSI pilot 2021.03] $ eb -d --disable-cleanup-tmpdir --rpath --rpath-override-dirs=/test/additional:/test/other:: --hooks=./eb_hooks.py OSU-Micro-Benchmarks-5.6.3-gompi-2020a.eb --stop prepare --force 
== Temporary log file in case of crash /tmp/eb-f7rf4lht/easybuild-ly4tamyl.log
== Running parse hook for OSU-Micro-Benchmarks-5.6.3-gompi-2020a.eb...
== Running parse hook for gompi-2020a.eb...
== processing EasyBuild easyconfig /home/alanc/EasyBuild_Git/easybuild-easyconfigs/easybuild/easyconfigs/o/OSU-Micro-Benchmarks/OSU-Micro-Benchmarks-5.6.3-gompi-2020a.eb
== building and installing OSU-Micro-Benchmarks/5.6.3-gompi-2020a...
== fetching files...
== ... (took < 1 sec)
== creating build dir, resetting environment...
== ... (took < 1 sec)
== unpacking...
== ... (took < 1 sec)
== patching...
== ... (took < 1 sec)
== preparing...
== Running pre-prepare hook...
== Updated rpath_override_dirs (to allow overriding MPI family OpenMPI): /test/additional:/test/other:::/cvmfs/pilot.eessi-hpc.org/host_injections/2021.03/software/linux/x86_64/generic/rpath_overrides/OpenMPI
== Running post-prepare hook...
== Resetting rpath_override_dirs to original value: /test/additional:/test/other::
== ... (took 1 secs)
== COMPLETED: Installation STOPPED successfully (took 1 secs)
== Results of the build can be found in the log file(s) /home/alanc/.local/easybuild/build/OSUMicroBenchmarks/5.6.3/gompi-2020a/easybuild/easybuild-OSU-Micro-Benchmarks-5.6.3-20210622.125609.log
== Build succeeded for 1 out of 1
== Keeping temporary log file(s) /tmp/eb-f7rf4lht/easybuild-ly4tamyl.log* and directory /tmp/eb-f7rf4lht.

[EESSI pilot 2021.03] $ grep "Converted RPATH" /tmp/eb-f7rf4lht/easybuild-ly4tamyl.log
== 2021-06-22 12:56:08,923 easyblock.py:2144 DEBUG Converted RPATH override directories ('/test/additional:/test/other:::/cvmfs/pilot.eessi-hpc.org/host_injections/2021.03/software/linux/x86_64/generic/rpath_overrides/OpenMPI') to a list of paths: ['/test/additional', '/test/other', '/cvmfs/pilot.eessi-hpc.org/host_injections/2021.03/software/linux/x86_64/generic/rpath_overrides/OpenMPI']

@ocaisa
Copy link
Member Author

ocaisa commented Jun 22, 2021

Example when no existing value for rpath_override_dirs

[EESSI pilot 2021.03] $ eb -d --disable-cleanup-tmpdir --rpath --hooks=./eb_hooks.py OSU-Micro-Benchmarks-5.6.3-gompi-2020a.eb --stop prepare --force 
== Temporary log file in case of crash /tmp/eb-b6obh53w/easybuild-uqspvn7u.log
== Running parse hook for OSU-Micro-Benchmarks-5.6.3-gompi-2020a.eb...
== Running parse hook for gompi-2020a.eb...
== processing EasyBuild easyconfig /home/alanc/EasyBuild_Git/easybuild-easyconfigs/easybuild/easyconfigs/o/OSU-Micro-Benchmarks/OSU-Micro-Benchmarks-5.6.3-gompi-2020a.eb
== building and installing OSU-Micro-Benchmarks/5.6.3-gompi-2020a...
== fetching files...
== ... (took < 1 sec)
== creating build dir, resetting environment...
== ... (took < 1 sec)
== unpacking...
== ... (took < 1 sec)
== patching...
== ... (took < 1 sec)
== preparing...
== Running pre-prepare hook...
== Updated rpath_override_dirs (to allow overriding MPI family OpenMPI): /cvmfs/pilot.eessi-hpc.org/host_injections/2021.03/software/linux/x86_64/generic/rpath_overrides/OpenMPI
== Running post-prepare hook...
== Resetting rpath_override_dirs to original value: None
== ... (took 1 secs)
== COMPLETED: Installation STOPPED successfully (took 2 secs)
== Results of the build can be found in the log file(s) /home/alanc/.local/easybuild/build/OSUMicroBenchmarks/5.6.3/gompi-2020a/easybuild/easybuild-OSU-Micro-Benchmarks-5.6.3-20210622.125746.log
== Build succeeded for 1 out of 1
== Keeping temporary log file(s) /tmp/eb-b6obh53w/easybuild-uqspvn7u.log* and directory /tmp/eb-b6obh53w.

[EESSI pilot 2021.03] $ grep "Converted RPATH" /tmp/eb-b6obh53w/easybuild-uqspvn7u.log
== 2021-06-22 12:57:44,704 easyblock.py:2144 DEBUG Converted RPATH override directories ('/cvmfs/pilot.eessi-hpc.org/host_injections/2021.03/software/linux/x86_64/generic/rpath_overrides/OpenMPI') to a list of paths: ['/cvmfs/pilot.eessi-hpc.org/host_injections/2021.03/software/linux/x86_64/generic/rpath_overrides/OpenMPI']

@ocaisa
Copy link
Member Author

ocaisa commented Jun 22, 2021

Example when no MPI is used:

[EESSI pilot 2021.03] $ eb -d --disable-cleanup-tmpdir --rpath --hooks=./eb_hooks.py libxc-4.3.4-GCC-9.3.0.eb --stop prepare --force 
== Temporary log file in case of crash /tmp/eb-yjc17doz/easybuild-8he25l7e.log
== Running parse hook for libxc-4.3.4-GCC-9.3.0.eb...
== Running parse hook for GCC-9.3.0.eb...
== Running parse hook for GCC-9.3.0.eb...
== Running parse hook for GCCcore-9.3.0.eb...
== Running parse hook for binutils-2.34-GCCcore-9.3.0.eb...
== Running parse hook for GCCcore-9.3.0.eb...
== Running parse hook for M4-1.4.18.eb...
== Running parse hook for binutils-2.34.eb...
== processing EasyBuild easyconfig /home/alanc/EasyBuild_Git/easybuild-easyconfigs/easybuild/easyconfigs/l/libxc/libxc-4.3.4-GCC-9.3.0.eb
== building and installing libxc/4.3.4-GCC-9.3.0...
== fetching files...
== ... (took < 1 sec)
== creating build dir, resetting environment...
== starting iteration #0 ...
== ... (took < 1 sec)
== unpacking...
== ... (took < 1 sec)
== patching...
== ... (took < 1 sec)
== preparing...
== Running pre-prepare hook...
== Running post-prepare hook...
== ... (took 1 secs)
== COMPLETED: Installation STOPPED successfully (took 3 secs)
== Results of the build can be found in the log file(s) /home/alanc/.local/easybuild/build/libxc/4.3.4/GCC-9.3.0/easybuild/easybuild-libxc-4.3.4-20210622.123239.log
== Build succeeded for 1 out of 1
== Keeping temporary log file(s) /tmp/eb-yjc17doz/easybuild-8he25l7e.log* and directory /tmp/eb-yjc17doz.

@ocaisa ocaisa changed the title Allow overriding OpenMPI via rpath Allow overriding MPI family via rpath Jun 22, 2021
boegel and others added 5 commits June 30, 2021 14:18
let build script also define $EESSI_SOFTWAREPATH, so it can be used by hooks to inject RPATH override path
fi

# make sure we're in Prefix environment by checking $SHELL
if [[ ${SHELL} = ${EPREFIX}/bin/bash ]]; then
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what startprefix itself checks, so I think we should do the same

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relying on the environment defined by sourcing init/eessi_environment_variables results in more confusing errors when you're not first in the Gentoo Prefix environment, because then all sorts of things can go wrong, like not having python3 which is used to call eessi_software_subdir.py:

software-layer $ ./EESSI-pilot-install-software.sh
>> Setting up environment...
>> Determining software subdirectory to use for current build host...
./EESSI-pilot-install-software.sh: line 62: python3: command not found
ERROR: no value set for $EESSI_SOFTWARE_SUBDIR
ERROR: Failed to determine software subdirectory?!

Another side effect is that the install script now fails hard when the init directory hasn't been populated yet:

>> Setting up environment...
>> Determining software subdirectory to use for current build host...
/cvmfs/pilot.eessi-hpc.org/2021.06/compat/linux/aarch64/usr/lib/python-exec/python3.9/python3: can't open file '/cvmfs/pilot.eessi-hpc.org/2021.06/init/eessi_software_subdir_for_host.py': [Errno 2] No such file or directory
ERROR: no value set for $EESSI_SOFTWARE_SUBDIR
ERROR: Failed to determine software subdirectory?!

We've been doing that late, after fully installing the software layer, but I guess doing that early on instead is fine.
We can add a check in the install script to ensure that init has been populated properly, and produce a clear error if not.

That said, I agree that we should clean things up a bit here, and avoid having the same information like $EESSI_PILOT_VERSION in multiple places.

I think I'll pull this apart a bit more, and split off a "minimal_eessi_env script that's sourced by both this install script and eessi_environment_variables, so we can move up this check and get sensible error reporting...

And allow the possibility that the MPI directory may be a symlinked to a version
'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',
Copy link
Member Author

Choose a reason for hiding this comment

The 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 bin).

@boegel boegel changed the title Allow overriding MPI family via rpath inject RPATH override directory via prepare hook to allow for overriding MPI library Aug 27, 2021
@boegel boegel changed the title inject RPATH override directory via prepare hook to allow for overriding MPI library add script to set up minimal EESSI environment, use init/* scripts in install script, inject RPATH override directory via prepare hook to allow for overriding MPI library Aug 27, 2021
@boegel boegel changed the title add script to set up minimal EESSI environment, use init/* scripts in install script, inject RPATH override directory via prepare hook to allow for overriding MPI library 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 Aug 27, 2021
@boegel
Copy link
Contributor

boegel commented Aug 27, 2021

I've pulled things apart a bit more, by also adding a script to configure EasyBuild (configure_easybuild), which is sourced by the install script, and a script to set up a minimal EESSI environment (init/minimal_eessi_env), which is sourced both by the install script and init/init/eessi_environment_variables (which is sourced by init/bash).

So things a more modular now, without having the same information in multiple places...

@boegel
Copy link
Contributor

boegel commented Aug 27, 2021

I have also verified that the EasyBuild hook to inject the host_injections RPATH override directories works as intended.

So, time to merge this, thanks for the efforts @ocaisa!

@boegel boegel merged commit aed951d into EESSI:main Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants