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

Forward-merge branch-24.06 into branch-24.08 #305

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions features/src/openmpi/.bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export OPENMPI_VERSION="${OPENMPI_VERSION}";
1 change: 1 addition & 0 deletions features/src/openmpi/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Installs one of the OpenMPI releases listed [here](https://www.open-mpi.org/software/ompi).
25 changes: 25 additions & 0 deletions features/src/openmpi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

# UCX (ucx)

A feature to install UCX

## Example Usage

```json
"features": {
"ghcr.io/rapidsai/devcontainers/features/ucx:24": {}
}
```

## Options

| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| version | ucx version to install (defaults to latest). | string | latest |

Installs one of the UCX releases listed [here](https://github.com/openucx/ucx).


---

_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/rapidsai/devcontainers/blob/main/features/src/ucx/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
37 changes: 37 additions & 0 deletions features/src/openmpi/common/etc/bash.bash_env
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#! /usr/bin/env bash

# Respect --noprofile and --norc
if [[ ! $(ps -o args= -p $$) =~ (--noprofile) ]]; then
# Otherwise, initialize non-login shells like login shells
if ! shopt -q login_shell; then
if [ -f /etc/profile ]; then
. /etc/profile
fi
for x in "$HOME"/.{bash_profile,bash_login,profile}; do
if [ -f "$x" ]; then
. "$x"
break
fi
done
fi
elif [[ ! $(ps -o args= -p $$) =~ (--norc|--rcfile|--init-file) ]]; then
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
for x in "$HOME"/.bashrc; do
if [ -f "$x" ]; then
. "$x"
break
fi
done
fi

export BASH_ENV=/etc/bash.bash_env

if [ -n "${BASH_ENV_ETC_PROFILE:-}" ]; then
if [ -f "$BASH_ENV_ETC_PROFILE" ] \
&& [ "$BASH_ENV_ETC_PROFILE" != "$BASH_ENV" ]; \
then
. "$BASH_ENV_ETC_PROFILE"
fi
fi
61 changes: 61 additions & 0 deletions features/src/openmpi/common/etc/skel/.config/clangd/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# https://clangd.llvm.org/config

# Apply a config conditionally to all C files
If:
PathMatch: .*\.(c|h)$

---

# Apply a config conditionally to all C++ files
If:
PathMatch: .*\.(c|h)pp

---

# Apply a config conditionally to all CUDA files
If:
PathMatch: .*\.cuh?
CompileFlags:
Add:
- "-x"
- "cuda"
# No error on unknown CUDA versions
- "-Wno-unknown-cuda-version"
# Allow variadic CUDA functions
- "-Xclang=-fcuda-allow-variadic-functions"

---

# Tweak the clangd parse settings for all files
CompileFlags:
Add:
# report all errors
- "-ferror-limit=0"
- "-fmacro-backtrace-limit=0"
- "-ftemplate-backtrace-limit=0"
# Skip the CUDA version check
- "--no-cuda-version-check"
Remove:
# remove gcc's -fcoroutines
- -fcoroutines
# remove nvc++ flags unknown to clang
- "-gpu=*"
- "-stdpar*"
# remove nvcc flags unknown to clang
- "-arch*"
- "-gencode*"
- "--generate-code*"
- "-ccbin*"
- "-t=*"
- "--threads*"
- "-Xptxas*"
- "-Xcudafe*"
- "-Xfatbin*"
- "-Xcompiler*"
- "--diag-suppress*"
- "--diag_suppress*"
- "--compiler-options*"
- "--expt-extended-lambda"
- "--expt-relaxed-constexpr"
- "-forward-unknown-to-host-compiler"
- "-Werror=cross-execution-space-call"
63 changes: 63 additions & 0 deletions features/src/openmpi/common/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#! /usr/bin/env bash
set -e

if [ "$(id -u)" -ne 0 ]; then
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
exit 1
fi

src="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# export bash utility functions
# shellcheck disable=SC1091
source "$src/utilities.sh";

rm -f /etc/profile.d/00-restore-env.sh;

# install /etc/skel
cp -r "$src/etc/skel" /etc/;
# install /etc/bash.bash_env
cp "$src/etc/bash.bash_env" /etc/;
chown root:root /etc/bash.bash_env;
chmod u+rwx,g+rwx,o+rx /etc/bash.bash_env;

unset src;

# Store and reset BASH_ENV in /etc/profile so lmod doesn't steal it from us.
# Our `/etc/bash.bash_env` will source lmod's $BASH_ENV at the end.
append_to_etc_profile "$(cat <<EOF
export BASH_ENV_ETC_PROFILE="\$BASH_ENV";
export BASH_ENV=/etc/bash.bash_env;
EOF
)";

if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then
echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment;
fi

# Remove unnecessary "$HOME/.local/bin" at the end of the path
# shellcheck disable=SC2016
if grep -qxF 'if [[ "${PATH}" != *"$HOME/.local/bin"* ]]; then export PATH="${PATH}:$HOME/.local/bin"; fi' /etc/bash.bashrc; then
grep -vxF \
'if [[ "${PATH}" != *"$HOME/.local/bin"* ]]; then export PATH="${PATH}:$HOME/.local/bin"; fi' \
/etc/bash.bashrc \
> /etc/bash.bashrc.new \
&& mv /etc/bash.bashrc{.new,};
fi

cp /etc/skel/.profile /root/.profile;
echo 'mesg n 2> /dev/null || true' >> /root/.profile;

for_each_user_profile "$(cat <<"EOF"
sed -i 's@if \[ -d "$HOME/bin" \]@if [ -n "${PATH##*"$HOME/bin"*}" ] \&\& [ -d "$HOME/bin" ]@' $0;
sed -i 's@if \[ -d "$HOME/.local/bin" \]@if [ -n "${PATH##*"$HOME/.local/bin"*}" ] \&\& [ -d "$HOME/.local/bin" ]@' $0;
EOF
)";

# Fix the devcontainers/features/common-utils __bash_prompt fn
# shellcheck disable=SC2016
for_each_user_bashrc '
if [[ "$(grep -qE "^__bash_prompt\(\) \{$" "$0"; echo $?)" == 0 ]]; then
sed -i "s/\${GITHUB_USER}/\${GITHUB_USER:-}/g" "$0";
fi
';
Loading