Skip to content

Commit 2b1054f

Browse files
author
Caspar van Leeuwen
committed
install_scripts.sh should install the scripts required to do install 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
1 parent 24a4ebc commit 2b1054f

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

EESSI-install-software.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,22 @@ fi
187187
# assume there's only one diff file that corresponds to the PR patch file
188188
pr_diff=$(ls [0-9]*.diff | head -1)
189189

190+
# install any additional required scripts
191+
# order is important: these are needed to install a full CUDA SDK in host_injections
192+
install_scripts_changed=$(cat ${pr_diff} | grep '^+++' | cut -f2 -d' ' | sed 's@^[a-z]/@@g' | grep '^install_scripts.sh$' > /dev/null; echo $?)
193+
if [ ${install_scripts_changed} == '0' ]; then
194+
# for now, this just reinstalls all scripts. Note the most elegant, but works
195+
${TOPDIR}/install_scripts.sh --prefix ${EESSI_CVMFS_REPO}
196+
fi
197+
198+
# Install full CUDA SDK in host_injections
199+
# Hardcode this for now, see if it works
200+
# TODO: We should make a nice yaml and loop over all CUDA versions in that yaml to figure out what to install
201+
${EESSI_CVMFS_REPO}/gpu_support/nvidia/install_cuda_host_injections.sh 12.1.1
202+
203+
# Install drivers in host_injections
204+
${EESSI_CVMFS_REPO}/gpu_support/nvidia/link_nvidia_host_libraries.sh
205+
190206
# use PR patch file to determine in which easystack files stuff was added
191207
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
192208

install_scripts.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
#
3+
# Script to install scripts from the software-layer repo into the EESSI software stack
4+
5+
display_help() {
6+
echo "usage: $0 [OPTIONS]"
7+
echo " -p | --prefix - prefix to copy the scripts to"
8+
echo " -h | --help - display this usage information"
9+
}
10+
11+
12+
POSITIONAL_ARGS=()
13+
14+
while [[ $# -gt 0 ]]; do
15+
case $1 in
16+
-o|--prefix)
17+
INSTALL_PREFIX="$2"
18+
shift 2
19+
;;
20+
-h|--help)
21+
display_help # Call your function
22+
# no shifting needed here, we're done.
23+
exit 0
24+
;;
25+
-*|--*)
26+
echo "Error: Unknown option: $1" >&2
27+
exit 1
28+
;;
29+
*) # No more options
30+
POSITIONAL_ARGS+=("$1") # save positional arg
31+
shift
32+
;;
33+
esac
34+
done
35+
36+
set -- "${POSITIONAL_ARGS[@]}"
37+
38+
TOPDIR=$(dirname $(realpath $0))
39+
40+
# Subdirs for generic scripts
41+
SCRIPTS_DIR_SOURCE=${TOPDIR}/scripts/ # Source dir
42+
SCRIPTS_DIR_TARGET=${INSTALL_PREFIX}/scripts/ # Target dir
43+
44+
# Create target dir
45+
mkdir -p ${SCRIPTS_DIR_TARGET}
46+
47+
# Copy scripts into this prefix
48+
for file in utils.sh; do
49+
cp ${SCRIPTS_DIR_SOURCE}/${file} ${SCRIPTS_DIR_TARGET}/${file}
50+
done
51+
# Subdirs for GPU support
52+
NVIDIA_GPU_SUPPORT_DIR_SOURCE=${TOPDIR}/gpu_support/nvidia/ # Source dir
53+
NVIDIA_GPU_SUPPORT_DIR_TARGET=${INSTALL_PREFIX}/gpu_support/nvidia/ # Target dir
54+
55+
# Create target dir
56+
mkdir -p ${NVIDIA_GPU_SUPPORT_DIR_TARGET}
57+
58+
# Copy files from this directory into the prefix
59+
# To be on the safe side, we dont do recursive copies, but we are explicitely copying each individual file we want to add
60+
for file in install_cuda_host_injections.sh link_nvidia_host_injections.sh; do
61+
cp ${NVIDIA_GPU_SUPPORT_DIR_SOURCE}/${file} ${NVIDIA_GPU_SUPPORT_DIR_TARGET}/${file}
62+
done

0 commit comments

Comments
 (0)