From 105ad238f7c7672c796232ca15d441f09c9fc20d Mon Sep 17 00:00:00 2001 From: Shaheryar Sohail Date: Sun, 22 Jun 2025 08:45:12 -0400 Subject: [PATCH 1/2] Initial dockerfile creation. --- Docker/Dockerfile | 76 +++++++++++++++++++++++++++++++++++++++++++++++ Docker/run.sh | 45 ++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 Docker/Dockerfile create mode 100644 Docker/run.sh diff --git a/Docker/Dockerfile b/Docker/Dockerfile new file mode 100644 index 00000000..ed6fd1bb --- /dev/null +++ b/Docker/Dockerfile @@ -0,0 +1,76 @@ +FROM ubuntu:24.04 + +# Install prerequisites (including gcc, g++, glibc, cmake, make, ninja, and python3) +# Latest available gcc and g++ are installed - should we be specific about the version? +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y \ + lsb-release \ + software-properties-common \ + gnupg \ + curl \ + git \ + build-essential \ + cmake \ + ninja-build \ + python3 \ + python3-pip \ + python3-venv \ + wget + +# Install LLVM 20 +RUN wget https://apt.llvm.org/llvm.sh && \ + chmod +x llvm.sh && \ + ./llvm.sh 20 && \ + rm -rf llvm.sh + +RUN ln -s /usr/bin/clang-20 /usr/bin/clang && \ + ln -s /usr/bin/clang++-20 /usr/bin/clang++ + +ENV CC=clang +ENV CXX=clang++ + +# Install .NET Core SDK and Runtime - 9.0 +RUN add-apt-repository ppa:dotnet/backports + +RUN apt-get install -y \ + dotnet-sdk-9.0 \ + dotnet-runtime-9.0 + +# Install Rust (Latest stable version - should we be specific about the version?) +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ + --no-modify-path \ + --default-toolchain stable \ + --no-self-update + +ENV PATH="/root/.cargo/bin:$PATH" + +# Install Zig 0.14.1 +ENV ZIG_VERSION=0.14.1 +ENV ZIG_HOME=/opt/zig + +RUN curl -LO https://ziglang.org/download/${ZIG_VERSION}/zig-x86_64-linux-${ZIG_VERSION}.tar.xz && \ + tar -xf zig-x86_64-linux-${ZIG_VERSION}.tar.xz && \ + mv zig-x86_64-linux-${ZIG_VERSION} ${ZIG_HOME} && \ + ln -s ${ZIG_HOME}/zig /usr/bin/zig && \ + rm zig-x86_64-linux-${ZIG_VERSION}.tar.xz + +# Clone the OpenBench Client +RUN git clone https://github.com/AndyGrant/OpenBench + +# Fetch the OpenBench Client startup script +COPY run.sh /OpenBench/Client/run.sh + +RUN python3 -m venv /.venv + +ENV PATH="/.venv/bin:$PATH" + +# Set the working directory to the OpenBench Client +WORKDIR /OpenBench/Client + +# Install OpenBench Client dependencies +RUN pip install --upgrade pip && \ + pip install -r requirements.txt + +# Execute the OpenBench Client startup script +CMD ["bash", "run.sh"] \ No newline at end of file diff --git a/Docker/run.sh b/Docker/run.sh new file mode 100644 index 00000000..f58509f2 --- /dev/null +++ b/Docker/run.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +if [ -z "$OPENBENCH_USERNAME" ]; +then + echo "Username is not set. Please set the OPENBENCH_USERNAME variable." + exit 1 +fi + +if [ -z "$OPENBENCH_PASSWORD" ]; +then + echo "Password is not set. Please set the OPENBENCH_PASSWORD variable." + exit 1 +fi + +if [ -z "$OPENBENCH_SERVER" ]; +then + echo "Server is not set. Please set the OPENBENCH_SERVER variable." + exit 1 +fi + +SOCKETS=$(lscpu | awk -F: '/^Socket\(s\):/ { gsub(/ /,"",$2); print $2; exit }') + +if [ -z "$SOCKETS" ]; +then + echo "Error: could not detect Socket(s) from lscpu" >&2 + exit 1 +fi + +# This formula is ideal for selecting the correct number of threads for high number of cores, leaving enough leeway for +# Cutechess to not be subjected to time-losses. +# However, it may not be optimal for low core counts - would love to hear feedback on possible adjustments +THREADS=$( + awk -v N="$(nproc)" -v S="$SOCKETS" 'BEGIN { + t = N - int(0.75 * sqrt(N)) + printf "%d", t - (t % S) + }' +) + +exec python client.py \ + --username "$OPENBENCH_USERNAME" \ + --password "$OPENBENCH_PASSWORD" \ + --threads "$THREADS" \ + --nsockets "$SOCKETS" \ + --server "$OPENBENCH_SERVER" \ + -I "$(hostname)" \ No newline at end of file From 0f98ca1a1479f5f3a15cdac2028a6a2e1bc54c96 Mon Sep 17 00:00:00 2001 From: Shaheryar Sohail <44123859+TheBlackPlague@users.noreply.github.com> Date: Sun, 22 Jun 2025 15:25:10 -0400 Subject: [PATCH 2/2] .NET SDK includes .NET Runtime - eduherminio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Eduardo Cáceres --- Docker/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Docker/Dockerfile b/Docker/Dockerfile index ed6fd1bb..51ab355e 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -34,8 +34,7 @@ ENV CXX=clang++ RUN add-apt-repository ppa:dotnet/backports RUN apt-get install -y \ - dotnet-sdk-9.0 \ - dotnet-runtime-9.0 + dotnet-sdk-9.0 # Install Rust (Latest stable version - should we be specific about the version?) RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \