Skip to content

Commit

Permalink
install clang in release dockers (#676)
Browse files Browse the repository at this point in the history
  • Loading branch information
yshekel authored Dec 5, 2024
1 parent 0380531 commit 9a10b49
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 25 deletions.
31 changes: 26 additions & 5 deletions scripts/release/Dockerfile.ubi8
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
# Use the official NVIDIA CUDA development image for ubi8 - rhel compatible
# Use the official NVIDIA CUDA development image for UBI8 (RHEL-compatible)
FROM nvidia/cuda:12.2.2-devel-ubi8

# install cmake
RUN dnf update -y && dnf install -y cmake
# install ninja-build
RUN dnf install -y ninja-build
# Set non-interactive mode for package installations
ENV DNF_YES_CLEAN_ALL=1

# Install necessary tools and dependencies
RUN dnf update -y && dnf install -y \
cmake \
ninja-build \
wget \
gnupg2 \
&& dnf clean all

# Add the RPM-based LLVM repository for Clang
# RUN wget https://rpm.llvm.org/llvm-snapshot.gpg.key -O /etc/pki/rpm-gpg/RPM-GPG-KEY-clang && \
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-clang && \
# echo -e "[llvm]\nname=LLVM\nbaseurl=https://rpm.llvm.org/centos8/\nenabled=1\ngpgcheck=1\ngpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-clang" > /etc/yum.repos.d/llvm.repo

# Install Clang, LLDB, and LLD
RUN dnf update -y && dnf install -y \
clang \
lldb \
lld \
&& dnf clean all

# Verify installations
RUN clang --version && cmake --version && ninja --version
34 changes: 29 additions & 5 deletions scripts/release/Dockerfile.ubi9
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
# Use the official NVIDIA CUDA development image for ubi9 - rhel compatible
# Use the official NVIDIA CUDA development image for UBI9 (RHEL-compatible)
FROM nvidia/cuda:12.2.2-devel-ubi9

# install cmake
RUN dnf update -y && dnf install -y cmake
# install ninja-build
RUN dnf install -y ninja-build
# Set non-interactive mode for package installations
ENV DNF_YES_CLEAN_ALL=1

# Install necessary packages
RUN dnf update -y && dnf install -y \
cmake \
ninja-build \
wget \
tar \
gcc \
gcc-c++ \
make \
gnupg \
&& dnf clean all

# Add LLVM repository for Clang installation
# RUN wget https://apt.llvm.org/llvm-snapshot.gpg.key -O /etc/pki/rpm-gpg/RPM-GPG-KEY-clang && \
# echo -e "[llvm]\nname=LLVM\nbaseurl=https://apt.llvm.org/centos/\$releasever/llvm-toolchain/15.x/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-clang" > /etc/yum.repos.d/llvm.repo

# Install Clang, LLDB, and LLD
RUN dnf update -y && dnf install -y \
clang \
lldb \
lld \
&& dnf clean all

# Verify installations
RUN clang --version && cmake --version && ninja --version
19 changes: 17 additions & 2 deletions scripts/release/Dockerfile.ubuntu20
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,19 @@ RUN apt-get update && apt-get install -y \
libcurl4-openssl-dev \
libarchive-dev \
zlib1g-dev \
ninja-build
ninja-build \
software-properties-common \
gnupg \
&& wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal main" \
&& apt-get update && apt-get install -y \
clang \
lldb \
lld \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Verify installations
RUN clang --version && lldb --version

# Install the latest stable version of CMake from source
RUN CMAKE_VERSION=3.27.4 \
Expand All @@ -27,4 +39,7 @@ RUN CMAKE_VERSION=3.27.4 \
&& rm -rf cmake-${CMAKE_VERSION} cmake-${CMAKE_VERSION}.tar.gz

# Set CMake as the default version
RUN ln -sf /usr/local/bin/cmake /usr/bin/cmake
RUN ln -sf /usr/local/bin/cmake /usr/bin/cmake

# Verify CMake installation
RUN cmake --version
18 changes: 15 additions & 3 deletions scripts/release/Dockerfile.ubuntu22
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
# Use the official NVIDIA development runtime image for Ubuntu 22.04
FROM nvidia/cuda:12.2.2-devel-ubuntu22.04

# Install necessary packages
# Set noninteractive mode for apt to prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive

# Add LLVM's official repository and GPG key
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
tar \
ninja-build
ninja-build \
software-properties-common \
wget \
gnupg \
&& wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy main"

# Install the latest version of Clang
RUN apt-get update && apt-get install -y clang lldb lld && apt-get clean

RUN apt install cargo -y
# Verify installations
RUN clang --version && lldb --version
3 changes: 1 addition & 2 deletions scripts/release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ We use docker to represent the target environment for the release. Each Docker i
To build all tars:
```bash
# from icicle root dir
mkdir -p release_output && rm -rf release_output/* # output dir where tars will be placed
./scripts/release/build_all.sh release_output # release_output is the output dir where tar files will be generated to
./scripts/release/build_all.sh 3.2.0 <optional: output-dir> # replace with any version
```

### Build Docker Image
Expand Down
25 changes: 17 additions & 8 deletions scripts/release/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@

set -e

# Use provided release_output directory or default to "release_output"
output_dir="${1:-./release_output}"
version="$2"

if [[ -z $version ]]; then
echo "Usage: You must supply a version for release tar files"
# Check if sufficient arguments are provided
if [[ $# -lt 1 ]]; then
echo "Usage: $0 <version> [output_dir]"
echo
echo "Arguments:"
echo " <version> The version for release tar files (required)."
echo " [output_dir] The directory to store release output files (optional, defaults to './release_output')."
exit 1
fi

# Use provided release_output directory or default to "release_output"
version="$1"
output_dir="${2:-./release_output}"

first_char=${version:0:1}
if [[ "${first_char,,}" == "v" ]]; then
version="${version:1}"
fi


version="${version//./_}"

# Check if both directories exist in the current working directory
Expand All @@ -26,7 +30,7 @@ if [[ ! -d "./icicle" || ! -d "./scripts" ]]; then
fi

# Build Docker images

echo "Building Docker images..."
# Ubuntu 22.04, CUDA 12.2.2
docker build -t icicle-release-ubuntu22-cuda122 -f ./scripts/release/Dockerfile.ubuntu22 .
# Ubuntu 20.04, CUDA 12.2.2
Expand All @@ -38,6 +42,11 @@ docker build -t icicle-release-ubi9-cuda122 -f ./scripts/release/Dockerfile.ubi9

# Compile and tar release in each

# Inform the user of what is being done
echo "Preparing release files..."
echo "Version: $version"
echo "Output Directory: $output_dir"

# Create the output directory if it doesn't exist, and clean it
mkdir -p "$output_dir" && rm -rf "$output_dir/*"

Expand Down

0 comments on commit 9a10b49

Please sign in to comment.