Skip to content

Commit

Permalink
install_scripts.sh should install the scripts required to do install …
Browse files Browse the repository at this point in the history
…the required GPU components in host_injections. The EESSI-install-software.sh has been modified to run install_scripts.sh early on and then run the actual installed scripts to install a full cuda SDK and drivers. This should enable building and using CUDA software anywhere down the line in this same environment
  • Loading branch information
Caspar van Leeuwen committed Dec 19, 2023
1 parent 24a4ebc commit 2b1054f
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
16 changes: 16 additions & 0 deletions EESSI-install-software.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,22 @@ fi
# assume there's only one diff file that corresponds to the PR patch file
pr_diff=$(ls [0-9]*.diff | head -1)

# install any additional required scripts
# order is important: these are needed to install a full CUDA SDK in host_injections
install_scripts_changed=$(cat ${pr_diff} | grep '^+++' | cut -f2 -d' ' | sed 's@^[a-z]/@@g' | grep '^install_scripts.sh$' > /dev/null; echo $?)
if [ ${install_scripts_changed} == '0' ]; then
# for now, this just reinstalls all scripts. Note the most elegant, but works
${TOPDIR}/install_scripts.sh --prefix ${EESSI_CVMFS_REPO}
fi

# Install full CUDA SDK in host_injections
# Hardcode this for now, see if it works
# TODO: We should make a nice yaml and loop over all CUDA versions in that yaml to figure out what to install
${EESSI_CVMFS_REPO}/gpu_support/nvidia/install_cuda_host_injections.sh 12.1.1

# Install drivers in host_injections
${EESSI_CVMFS_REPO}/gpu_support/nvidia/link_nvidia_host_libraries.sh

This comment has been minimized.

Copy link
@ocaisa

ocaisa Dec 19, 2023

Member

Have you checked what this script does if the libraries are not in the host?

This comment has been minimized.

Copy link
@ocaisa

ocaisa Dec 19, 2023

Member

(Not sure if I did or not)


# use PR patch file to determine in which easystack files stuff was added
for easystack_file in $(cat ${pr_diff} | grep '^+++' | cut -f2 -d' ' | sed 's@^[a-z]/@@g' | grep '^easystacks/.*yml$' | egrep -v 'known-issues|missing'); do

Expand Down
62 changes: 62 additions & 0 deletions install_scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash
#
# Script to install scripts from the software-layer repo into the EESSI software stack

display_help() {
echo "usage: $0 [OPTIONS]"
echo " -p | --prefix - prefix to copy the scripts to"
echo " -h | --help - display this usage information"
}


POSITIONAL_ARGS=()

while [[ $# -gt 0 ]]; do
case $1 in
-o|--prefix)
INSTALL_PREFIX="$2"
shift 2
;;
-h|--help)
display_help # Call your function
# no shifting needed here, we're done.
exit 0
;;
-*|--*)
echo "Error: Unknown option: $1" >&2
exit 1
;;
*) # No more options
POSITIONAL_ARGS+=("$1") # save positional arg
shift
;;
esac
done

set -- "${POSITIONAL_ARGS[@]}"

TOPDIR=$(dirname $(realpath $0))

# Subdirs for generic scripts
SCRIPTS_DIR_SOURCE=${TOPDIR}/scripts/ # Source dir
SCRIPTS_DIR_TARGET=${INSTALL_PREFIX}/scripts/ # Target dir

# Create target dir
mkdir -p ${SCRIPTS_DIR_TARGET}

# Copy scripts into this prefix
for file in utils.sh; do
cp ${SCRIPTS_DIR_SOURCE}/${file} ${SCRIPTS_DIR_TARGET}/${file}
done
# Subdirs for GPU support
NVIDIA_GPU_SUPPORT_DIR_SOURCE=${TOPDIR}/gpu_support/nvidia/ # Source dir
NVIDIA_GPU_SUPPORT_DIR_TARGET=${INSTALL_PREFIX}/gpu_support/nvidia/ # Target dir

# Create target dir
mkdir -p ${NVIDIA_GPU_SUPPORT_DIR_TARGET}

# Copy files from this directory into the prefix
# To be on the safe side, we dont do recursive copies, but we are explicitely copying each individual file we want to add
for file in install_cuda_host_injections.sh link_nvidia_host_injections.sh; do
cp ${NVIDIA_GPU_SUPPORT_DIR_SOURCE}/${file} ${NVIDIA_GPU_SUPPORT_DIR_TARGET}/${file}

This comment has been minimized.

Copy link
@ocaisa

ocaisa Dec 19, 2023

Member

Could just use cp -u here so it will only update if the time stamp is newer

done

0 comments on commit 2b1054f

Please sign in to comment.