Skip to content

Commit

Permalink
Fix NVHPC_CUDA_HOME and bump nvhpc versions (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
trxcllnt authored Oct 3, 2024
1 parent 7123581 commit 927b158
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 35 deletions.
5 changes: 2 additions & 3 deletions features/src/gitlab-cli/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"id": "gitlab-cli",
"version": "24.12.0",
"version": "24.12.1",
"name": "GitLab CLI",
"documentationURL": "https://github.com/rapidsai/devcontainers/features/tree/main/src/gitlab-cli",
"description": "Installs the GitLab CLI. Auto-detects latest version and installs needed dependencies.",
"options": {
"version": {
"type": "string",
"proposals": [
"latest",
"none"
"latest"
],
"default": "latest",
"description": "Select version of the GitLab CLI, if not latest."
Expand Down
66 changes: 40 additions & 26 deletions features/src/gitlab-cli/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,62 @@ cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
# install global/common scripts
. ./common/install.sh;

gitlab_cli_file_name() {
local -;
set -euo pipefail;

local os="$(uname -s)";
local arch="${TARGETARCH:-}";

if [[ "${CLI_VERSION}" < "1.47.0" ]]; then
arch="${arch:-$(uname -m)}";
else
arch="${arch:-$(dpkg --print-architecture | awk -F'-' '{print $NF}')}";
os="${os,,}";
fi

echo "glab_${CLI_VERSION}_${os}_${arch}.deb";
}

download_gitlab_cli_deb() {
local -;
set -euo pipefail;
wget --no-hsts -q -O /tmp/gitlab-cli.deb \
"https://gitlab.com/gitlab-org/cli/-/releases/v${CLI_VERSION}/downloads/$(gitlab_cli_file_name)";
}

# Fall back on direct download if no apt package exists
# Fetches .deb file to be installed with dpkg
install_deb_using_gitlab() {
local -;
set -euo pipefail;

check_packages wget;
arch="${TARGETARCH:-$(dpkg --print-architecture | awk -F'-' '{print $NF}')}";
if [[ "$arch" == amd64 ]]; then
arch=x86_64;
fi

find_version_from_git_tags CLI_VERSION https://gitlab.com/gitlab-org/cli;
cli_filename="glab_${CLI_VERSION}_Linux_${arch}.deb";

mkdir -p /tmp/glabcli;
pushd /tmp/glabcli;
wget https://gitlab.com/gitlab-org/cli/-/releases/v${CLI_VERSION}/downloads/${cli_filename};
exit_code=$?;
set -e;
if [ "$exit_code" != "0" ]; then
# Handle situation where git tags are ahead of what was is available to actually download
echo "(!) gitlab-cli version ${CLI_VERSION} failed to download. Attempting to fall back one version to retry...";
find_prev_version_from_git_tags CLI_VERSION https://gitlab.com/gitlab-org/cli;
wget https://gitlab.com/gitlab-org/cli/-/releases/v${CLI_VERSION}/downloads/${cli_filename};
# Soft version matching
if test "${CLI_VERSION}" = latest || test "${CLI_VERSION}" = stable || test "${CLI_VERSION}" = lts; then
find_version_from_git_tags CLI_VERSION https://gitlab.com/gitlab-org/cli;
while ! download_gitlab_cli_deb; do
# Handle situation where git tags are ahead of what was is available to actually download
echo "(!) gitlab-cli version ${CLI_VERSION} failed to download. Attempting to fall back one version to retry...";
find_prev_version_from_git_tags CLI_VERSION https://gitlab.com/gitlab-org/cli;
done
else
download_gitlab_cli_deb;
fi

dpkg -i /tmp/glabcli/${cli_filename};
popd;
rm -rf /tmp/glabcli;
dpkg -i /tmp/gitlab-cli.deb;
rm /tmp/gitlab-cli.deb;
}

export DEBIAN_FRONTEND=noninteractive;

# Install curl, apt-transport-https, curl, or git if missing
# Install curl, ca-certificates, apt-transport-https, and git (if missing)
check_packages curl ca-certificates apt-transport-https;
if ! type git >/dev/null 2>&1; then
check_packages git;
fi

# Soft version matching
if [ "${CLI_VERSION}" != "latest" ] && [ "${CLI_VERSION}" != "lts" ] && [ "${CLI_VERSION}" != "stable" ]; then
find_version_from_git_tags CLI_VERSION "https://gitlab.com/gitlab-org/cli";
fi

# Install the GitHub CLI
echo "Downloading gitlab CLI...";

Expand Down
6 changes: 4 additions & 2 deletions features/src/nvhpc/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "NVHPC SDK",
"id": "nvhpc",
"version": "24.12.0",
"version": "24.12.1",
"description": "A feature to install the NVHPC SDK",
"options": {
"version": {
"type": "string",
"proposals": [
"24.9",
"24.7",
"24.5",
"24.3",
"24.1",
Expand All @@ -20,7 +22,7 @@
"22.9",
"22.7"
],
"default": "24.5",
"default": "24.9",
"description": "Version of NVHPC SDK to install."
}
},
Expand Down
2 changes: 1 addition & 1 deletion features/src/nvhpc/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ check_packages ${pkgs[@]};
export NVHPC="/opt/nvidia/hpc_sdk";
export NVHPC_VERSION="${NVHPC_VERSION}";
export NVHPC_ROOT="${NVHPC}/Linux_$(uname -p)/${NVHPC_VERSION}";
export NVHPC_CUDA_HOME="${NVHPC_ROOT}/cuda";
export NVHPC_CUDA_HOME="$(dirname "$(find "$NVHPC_ROOT/cuda" -type f -name 'version.json' | head -n1)")";
export NVHPC_MODULEFILE_DIRS="($(find "${NVHPC}/" -type d -name modulefiles -exec echo -n \"{}\"\ \;))";

if ! test -L /usr/local/cuda; then
Expand Down
2 changes: 1 addition & 1 deletion features/test/nvhpc/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module list 1>&2

# Feature-specific tests
# The 'check' command comes from the dev-container-features-test-lib.
check "version" bash -c "echo '$NVHPC_VERSION' | grep '24.5'"
check "version" bash -c "echo '$NVHPC_VERSION' | grep '24.9'"
check "installed" stat /opt/nvidia/hpc_sdk
check "nvc++ exists and is on path" which nvc++
check "mpic++ exists and is on path" which mpic++
Expand Down
4 changes: 2 additions & 2 deletions matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ x-llvm-prev: &llvm_18 { name: "llvm", version: "18" }
x-llvm-curr: &llvm_19 { name: "llvm", version: "19" }
x-llvm-env: &llvm_env { CC: "clang", CXX: "clang++", CUDAHOSTCXX: "clang++" }

x-nvhpc-prev: &nvhpc_prev { name: "nvhpc", version: "24.5" }
x-nvhpc-curr: &nvhpc_curr { name: "nvhpc", version: "24.7" }
x-nvhpc-prev: &nvhpc_prev { name: "nvhpc", version: "24.7" }
x-nvhpc-curr: &nvhpc_curr { name: "nvhpc", version: "24.9" }

x-nvhpc-env: &nvhpc_env { CC: "nvc", CXX: "nvc++", CUDAHOSTCXX: "nvc++" }

Expand Down

0 comments on commit 927b158

Please sign in to comment.