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

[WIP] Project subdirectories in dev.eessi.io install path and EESSI-extend integration #804

Draft
wants to merge 26 commits into
base: 2023.06-software.eessi.io
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8a6cd13
Add EESSI_DEV_PROJET to prefix
Neves-P Nov 1, 2024
ee6aea9
Merge branch 'EESSI:2023.06-software.eessi.io' into feature/dev.eessi.io
Neves-P Nov 1, 2024
0e9402b
Print EESSI_CVMFS_REPO to debug
Neves-P Nov 1, 2024
8e628be
Merge branch 'feature/dev.eessi.io' of https://github.com/Neves-P/sof…
Neves-P Nov 1, 2024
888b874
Check if running in subshell is the cause of some variables being reset
Neves-P Nov 4, 2024
1af43f1
Revert to run minimal_eessi_env in subshell and add log line
Neves-P Nov 4, 2024
25e8a5f
Fix condition to build with subdir in prefix in dev.eessi.io
Neves-P Nov 4, 2024
3e5e2af
Add some logs to see where EESSI_CVMFS_REPO is being ovewritten
Neves-P Nov 4, 2024
722ca22
Add more log output for EESSI_DEV_PROJECT variable
Neves-P Nov 5, 2024
1c3f20a
export EESSI_DEV_PROJECT to compat layer env
Neves-P Nov 5, 2024
7c9dee8
Expose cvmfs and version override in eessi_defaults
Neves-P Nov 5, 2024
d5d1522
Also expose EESSI_CVMFS_REPO in defaults
Neves-P Nov 5, 2024
fb45d7e
Try exporting EESSI_CVMFS_INSTALL
Neves-P Nov 5, 2024
a1f11fe
Overwrite EASYBUILD_INSTALLPATH and use EESSI_CVMFS_REPO_OVERRIDE in …
Neves-P Nov 5, 2024
dd9fccd
Load $EASYBUILD_INSTALLPATH modules in dev.eessi.io
Neves-P Nov 5, 2024
821455b
Use EESSI_DEV_PROJECT for check instead of EESSI_CVMFS_REPO in EASYBU…
Neves-P Nov 5, 2024
a19c79c
Fix running install_scripts.sh only if not in dev.eessi.io
Neves-P Nov 6, 2024
afaa94f
Remove debug printing to log
Neves-P Nov 6, 2024
2c3e74e
Improved logging when $EESSI_DEV_PROJECT is set
Neves-P Nov 6, 2024
3d9424d
Fix tarball creations in dev.eessi.io
Neves-P Nov 8, 2024
028f935
Actually set install_prefix_dir
Neves-P Nov 8, 2024
4f06864
Log EESSI_DEV_PROJECT and export it
Neves-P Nov 8, 2024
9eca5e4
Fix test checking for ${install_prefix_dir}
Neves-P Nov 8, 2024
0e68f18
Look for installed software in the right directory
Neves-P Nov 10, 2024
82d36c7
Fix error reporting of input in create_tarball.sh
Neves-P Nov 19, 2024
3248438
Fix installpath to include cpu target
Neves-P Nov 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions EESSI-install-software.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ else
# Make sure EESSI_PREFIX and EESSI_OS_TYPE are set
source $TOPDIR/init/minimal_eessi_env

echo ">> Creating directory for software subdirectory override: ${EESSI_PREFIX}/software/${EESSI_OS_TYPE}/${EESSI_SOFTWARE_SUBDIR_OVERRIDE}"
# make sure directory exists (since it's expected by init/eessi_environment_variables when using archdetect)
mkdir -p ${EESSI_PREFIX}/software/${EESSI_OS_TYPE}/${EESSI_SOFTWARE_SUBDIR_OVERRIDE}
)
Expand Down Expand Up @@ -206,6 +207,7 @@ export PYTHONPYCACHEPREFIX=$TMPDIR/pycache
# - .lmod/lmodrc.lua
# - .lmod/SitePackage.lua
_eessi_software_path=${EESSI_PREFIX}/software/${EESSI_OS_TYPE}/${EESSI_SOFTWARE_SUBDIR_OVERRIDE}
echo "_eessi_software_path: ${_eessi_software_path}"
_lmod_cfg_dir=${_eessi_software_path}/.lmod
_lmod_rc_file=${_lmod_cfg_dir}/lmodrc.lua
if [ ! -f ${_lmod_rc_file} ]; then
Expand All @@ -224,8 +226,8 @@ fi
# order is important: these are needed to install a full CUDA SDK in host_injections
# for now, this just reinstalls all scripts. Note the most elegant, but works

# Only run install_scripts.sh if not dev.eessi.io for security
if [[ "${EESSI_CVMFS_REPO}" != /cvmfs/dev.eessi.io ]]; then
# Only run install_scripts.sh if not in dev.eessi.io for security
if [[ -z ${EESSI_DEV_PROJECT} ]]; then
${TOPDIR}/install_scripts.sh --prefix ${EESSI_PREFIX}
fi

Expand Down Expand Up @@ -292,12 +294,14 @@ if [ ! -z ${EESSI_ACCELERATOR_TARGET} ]; then
fi

# If in dev.eessi.io, allow building on top of software.eessi.io
if [[ "${EESSI_CVMFS_REPO}" == /cvmfs/dev.eessi.io ]]; then
if [[ ! -z ${EESSI_DEV_PROJECT} ]]; then
module use /cvmfs/software.eessi.io/versions/$EESSI_VERSION/software/${EESSI_OS_TYPE}/${EESSI_SOFTWARE_SUBDIR_OVERRIDE}/modules/all
# Overwrite EASYBUILD_INSTALLPATH to point to dev.eessi.io
EASYBUILD_INSTALLPATH=$EESSI_CVMFS_REPO_OVERRIDE/versions/$EESSI_VERSION/$EESSI_DEV_PROJECT/software/${EESSI_OS_TYPE}/${EESSI_SOFTWARE_SUBDIR_OVERRIDE}
echo ">> \$EASYBUILD_INSTALLPATH overwritten to ${EASYBUILD_INSTALLPATH}"
module use $EASYBUILD_INSTALLPATH/modules/all
fi

module use $EASYBUILD_INSTALLPATH/modules/all

if [[ -z ${MODULEPATH} ]]; then
fatal_error "Failed to set up \$MODULEPATH?!"
else
Expand Down
8 changes: 6 additions & 2 deletions bot/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,19 @@ timestamp=$(date +%s)
source $software_layer_dir/init/eessi_defaults
export TGZ=$(printf "eessi-%s-software-%s-%s-%d.tar.gz" ${EESSI_VERSION} ${EESSI_OS_TYPE} ${EESSI_SOFTWARE_SUBDIR_OVERRIDE//\//-} ${timestamp})

# Export EESSI_DEV_PROJECT to use it (if needed) when making tarball
echo "bot/build.sh: EESSI_DEV_PROJECT='${EESSI_DEV_PROJECT}'"
export EESSI_DEV_PROJECT=${EESSI_DEV_PROJECT}

# value of first parameter to create_tarball.sh - TMP_IN_CONTAINER - needs to be
# synchronised with setting of TMP_IN_CONTAINER in eessi_container.sh
# TODO should we make this a configurable parameter of eessi_container.sh using
# /tmp as default?
TMP_IN_CONTAINER=/tmp
echo "Executing command to create tarball:"
echo "$software_layer_dir/eessi_container.sh ${COMMON_ARGS[@]} ${TARBALL_STEP_ARGS[@]}"
echo " -- $software_layer_dir/create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_VERSION} ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} \"${EESSI_ACCELERATOR_TARGET}\" /eessi_bot_job/${TGZ} 2>&1 | tee -a ${tar_outerr}"
echo " -- $software_layer_dir/create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_VERSION} ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} \"${EESSI_ACCELERATOR_TARGET}\" \"${EESSI_DEV_PROJECT}\" /eessi_bot_job/${TGZ} 2>&1 | tee -a ${tar_outerr}"
$software_layer_dir/eessi_container.sh "${COMMON_ARGS[@]}" "${TARBALL_STEP_ARGS[@]}" \
-- $software_layer_dir/create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_VERSION} ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} "${EESSI_ACCELERATOR_TARGET}" /eessi_bot_job/${TGZ} 2>&1 | tee -a ${tar_outerr}
-- $software_layer_dir/create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_VERSION} ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} "${EESSI_ACCELERATOR_TARGET}" "${EESSI_DEV_PROJECT}" /eessi_bot_job/${TGZ} 2>&1 | tee -a ${tar_outerr}

exit 0
29 changes: 20 additions & 9 deletions create_tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ set -e

base_dir=$(dirname $(realpath $0))

if [ $# -ne 5 ]; then
echo "ERROR: Usage: $0 <EESSI tmp dir (example: /tmp/$USER/EESSI)> <version (example: 2023.06)> <CPU arch subdir (example: x86_64/amd/zen2)> <accelerator subdir (example: nvidia/cc80)> <path to tarball>" >&2
if [ $# -ne 6 ]; then
echo "ERROR: Usage: $0 <EESSI tmp dir (example: /tmp/$USER/EESSI)> <version (example: 2023.06)> <CPU arch subdir (example: x86_64/amd/zen2)> <accelerator subdir (example: nvidia/cc80)> <dev project> (example: ESPREsSo) <path to tarball>" >&2
exit 1
fi
eessi_tmpdir=$1
eessi_version=$2
cpu_arch_subdir=$3
accel_subdir=$4
target_tgz=$5
eessi_dev_project=$5
target_tgz=$6

tmpdir=`mktemp -d`
echo ">> tmpdir: $tmpdir"
Expand All @@ -21,6 +22,16 @@ os="linux"
source ${base_dir}/init/eessi_defaults
cvmfs_repo=${EESSI_CVMFS_REPO}

# install to $eessi_version/$eessi_dev_project if defined, otherwise install
# to $eessi_version
install_prefix_dir=${eessi_version}${eessi_dev_project:+/$eessi_dev_project}/
echo "Setting Install prefix directory to: ${install_prefix_dir}"

if [ -z ${install_prefix_dir} ]; then
echo "\${install_prefix_dir} is empty?!" >&2
exit 2
fi

software_dir="${cvmfs_repo}/versions/${eessi_version}/software/${os}/${cpu_arch_subdir}"
if [ ! -d ${software_dir} ]; then
echo "Software directory ${software_dir} does not exist?!" >&2
Expand Down Expand Up @@ -62,18 +73,18 @@ fi
# consider both CPU-only and accelerator subdirectories
for subdir in ${cpu_arch_subdir} ${cpu_arch_subdir}/accel/${accel_subdir}; do

if [ -d ${eessi_version}/software/${os}/${subdir}/modules ]; then
if [ -d ${install_prefix_dir}/software/${os}/${subdir}/modules ]; then
# module files
find ${eessi_version}/software/${os}/${subdir}/modules -type f | grep -v '/\.wh\.' >> ${files_list} || true # Make sure we don't exit because of set -e if grep doesn't return a match
find ${install_prefix_dir}/software/${os}/${subdir}/modules -type f | grep -v '/\.wh\.' >> ${files_list} || true # Make sure we don't exit because of set -e if grep doesn't return a match
# module symlinks
find ${eessi_version}/software/${os}/${subdir}/modules -type l | grep -v '/\.wh\.' >> ${files_list} || true # Make sure we don't exit because of set -e if grep doesn't return a match
find ${install_prefix_dir}/software/${os}/${subdir}/modules -type l | grep -v '/\.wh\.' >> ${files_list} || true # Make sure we don't exit because of set -e if grep doesn't return a match
# module files and symlinks
find ${eessi_version}/software/${os}/${subdir}/modules/all -type f -o -type l \
find ${install_prefix_dir}/software/${os}/${subdir}/modules/all -type f -o -type l \
| grep -v '/\.wh\.' | grep -v '/\.modulerc\.lua' | sed -e 's/.lua$//' | sed -e 's@.*/modules/all/@@g' | sort -u \
>> ${module_files_list}
fi

if [ -d ${eessi_version}/software/${os}/${subdir}/software -a -r ${module_files_list} ]; then
if [ -d ${install_prefix_dir}/software/${os}/${subdir}/software -a -r ${module_files_list} ]; then
# installation directories but only those for which module files were created
# Note, we assume that module names (as defined by 'PACKAGE_NAME/VERSION.lua'
# using EasyBuild's standard module naming scheme) match the name of the
Expand All @@ -82,7 +93,7 @@ for subdir in ${cpu_arch_subdir} ${cpu_arch_subdir}/accel/${accel_subdir}; do
# installation directories), the procedure will likely not work.
for package_version in $(cat ${module_files_list}); do
echo "handling ${package_version}"
ls -d ${eessi_version}/software/${os}/${subdir}/software/${package_version} \
ls -d ${install_prefix_dir}/software/${os}/${subdir}/software/${package_version} \
| grep -v '/\.wh\.' >> ${files_list} || true # Make sure we don't exit because of set -e if grep doesn't return a match
done
fi
Expand Down
12 changes: 11 additions & 1 deletion init/minimal_eessi_env
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ EESSI_INIT_DIR_PATH=$(dirname $(readlink -f $BASH_SOURCE))
# script takes *_OVERRIDEs into account
source ${EESSI_INIT_DIR_PATH}/eessi_defaults

export EESSI_PREFIX=$EESSI_CVMFS_REPO/versions/$EESSI_VERSION
# If $EESSI_DEV_PROJECT is defined, then we are building for dev.eessi.io
# and add a subdirectory to $EESSI_PREFIX
if [ -z ${EESSI_DEV_PROJECT} ]; then
export EESSI_PREFIX=$EESSI_CVMFS_REPO/versions/$EESSI_VERSION/
else
echo "\$EESSI_DEV_PROJECT: ${EESSI_DEV_PROJECT}; building for dev.eessi.io"
export EESSI_PREFIX=$EESSI_CVMFS_REPO_OVERRIDE/versions/$EESSI_VERSION/$EESSI_DEV_PROJECT/
# Set EESSI_PREFIX to the dev project path for EESSI-extend
export EESSI_CVMFS_INSTALL=$EESSI_PREFIX
fi


if [[ $(uname -s) == 'Linux' ]]; then
export EESSI_OS_TYPE='linux'
Expand Down
3 changes: 3 additions & 0 deletions run_in_compat_layer_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ fi
if [ ! -z ${EESSI_CVMFS_REPO_OVERRIDE} ]; then
INPUT="export EESSI_CVMFS_REPO_OVERRIDE=${EESSI_CVMFS_REPO_OVERRIDE}; ${INPUT}"
fi
if [ ! -z ${EESSI_DEV_PROJECT} ]; then
INPUT="export EESSI_DEV_PROJECT=${EESSI_DEV_PROJECT}; ${INPUT}"
fi
if [ ! -z ${EESSI_VERSION_OVERRIDE} ]; then
INPUT="export EESSI_VERSION_OVERRIDE=${EESSI_VERSION_OVERRIDE}; ${INPUT}"
fi
Expand Down
Loading