Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
feature: ${{ fromJSON(needs.features-matrix.outputs.features) }}
with:
name: "{0}"
args: "-f ${{ matrix.feature }} -i ubuntu:22.04 --skip-scenarios"
args: "-f ${{ matrix.feature }} -i ubuntu:24.04 --skip-scenarios"

image-matrix:
name: Determine image matrix
Expand Down
2 changes: 2 additions & 0 deletions features/src/nvhpc/.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ if [ -z "${LIBRARY_PATH:-}" ] \
|| [ -n "${LIBRARY_PATH##*"${NVHPC_CUDA_HOME}/lib64/stubs"*}" ]; then
export LIBRARY_PATH="${NVHPC_CUDA_HOME}/lib64/stubs${LIBRARY_PATH:+:$LIBRARY_PATH}"
fi

. /etc/profile.d/load-nvhpc._sh
2 changes: 1 addition & 1 deletion features/src/nvhpc/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "NVHPC SDK",
"id": "nvhpc",
"version": "26.4.2",
"version": "26.4.3",
"description": "A feature to install the NVHPC SDK",
"options": {
"version": {
Expand Down
32 changes: 0 additions & 32 deletions features/src/nvhpc/etc/profile.d/nvhpc.sh

This file was deleted.

10 changes: 6 additions & 4 deletions features/src/nvhpc/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ if ! test -L /usr/local/cuda; then
ln -s "${NVHPC_CUDA_HOME}" /usr/local/cuda;
fi

cuda_ver=$(grep "#define CUDA_VERSION" "${NVHPC_CUDA_HOME}/include/cuda.h" | cut -d' ' -f3);
cuda_ver="$(grep "#define CUDA_VERSION" "${NVHPC_CUDA_HOME}/include/cuda.h" | cut -d' ' -f3)";
export NVHPC_CUDA_VERSION_MAJOR="$((cuda_ver / 1000))";
export NVHPC_CUDA_VERSION_MINOR="$((cuda_ver / 10 % 100))";
export NVHPC_CUDA_VERSION_PATCH="$((cuda_ver % 10))";
Expand All @@ -94,11 +94,13 @@ vars_+=('$NVHPC_CUDA_HOME');
vars_+=('$NVHPC_MODULEFILE_DIRS');
printf -v vars_ '%s,' "${vars_[@]}";

cp load-nvhpc.sh /etc/profile.d/load-nvhpc._sh

# export envvars in bashrc files
append_to_etc_bashrc "$(cat <(cat .bashrc | envsubst "${vars_%,}") etc/profile.d/nvhpc.sh)";
append_to_all_bashrcs "$(cat <(cat .bashrc | envsubst "${vars_%,}") etc/profile.d/nvhpc.sh)";
append_to_etc_bashrc "$(cat <(cat .bashrc | envsubst "${vars_%,}"))";
append_to_all_bashrcs "$(cat <(cat .bashrc | envsubst "${vars_%,}"))";
# export envvars in /etc/profile.d
add_etc_profile_d_script nvhpc "$(cat <(cat .bashrc | envsubst "${vars_%,}") etc/profile.d/nvhpc.sh)";
add_etc_profile_d_script nvhpc "$(cat <(cat .bashrc | envsubst "${vars_%,}"))";

# Clean up
# rm -rf /tmp/*;
Expand Down
48 changes: 48 additions & 0 deletions features/src/nvhpc/load-nvhpc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
DEVCONTAINERS_NVHPC_LOADED_BY="${DEVCONTAINERS_NVHPC_LOADED_BY:-}"

if ! test "${DEVCONTAINERS_NVHPC_LOADED_BY:-}" = "$(whoami)"; then

# "unload" lmod so all the modules are loaded from scratch
for __module_unload_func_name in clearMT clearLmod; do
if ! command -V $__module_unload_func_name 2>&1 | grep -q function; then
. /etc/profile.d/lmod._sh
fi
$__module_unload_func_name >/dev/null 2>&1
done
unset __module_unload_func_name

if ! command -V module 2>&1 | grep -q function; then
. /etc/profile.d/lmod._sh;
fi

# Restore MODULEPATH since it is cleared by `clearLmod`
for NVHPC_MODULEFILES_DIR in "${NVHPC_MODULEFILE_DIRS[@]}"; do
if [ -n "${MODULEPATH##*"${NVHPC_MODULEFILES_DIR}"*}" ]; then
module use -a "${NVHPC_MODULEFILES_DIR}";
fi
done
unset NVHPC_MODULEFILES_DIR;

# Load the NHVPC modules again
for NVHPC_MODULE_NAME in "nvhpc-hpcx-cuda${NVHPC_CUDA_VERSION_MAJOR}/${NVHPC_VERSION}" \
"nvhpc-hpcx/${NVHPC_VERSION}"; do
if ! module list "${NVHPC_MODULE_NAME}" 2>&1 | grep -q 'None found.'; then
if ! module list 2>&1 | grep -q "${NVHPC_MODULE_NAME}"; then
module try-load "${NVHPC_MODULE_NAME}" >/dev/null 2>&1;
fi
fi
done
unset NVHPC_MODULE_NAME;

# Have to source and manually call hpcx_load for nvhpc>=25.7
HPCX_INIT="$(find -L "$NVHPC_ROOT"/comm_libs/ -path '*/latest/hpcx-init.sh' -print -quit)";
if [ -n "${HPCX_INIT:+x}" ] && [ -s "${HPCX_INIT}" ]; then
. "$HPCX_INIT";
hpcx_load;
fi
unset HPCX_INIT;

DEVCONTAINERS_NVHPC_LOADED_BY="$(whoami)"
fi

export DEVCONTAINERS_NVHPC_LOADED_BY
Loading