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
8 changes: 6 additions & 2 deletions latest/docker/Dockerfile.caliper
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,19 @@ RUN . /opt/global_py_venv/bin/activate && \
ENV CALI_INSTALL_PREFIX=/usr \
GIT_CLONE_STAGING_DIR=/tmp

# Build arguments for caliper and adiak versions (extracted from caliper-tutorial submodule)
ARG CALIPER_VERSION=v2.15.0
ARG ADIAK_VERSION=v0.5.0

RUN git clone https://github.com/LLNL/Caliper.git ${GIT_CLONE_STAGING_DIR}/Caliper && \
cd ${GIT_CLONE_STAGING_DIR}/Caliper && \
git fetch origin && \
git checkout v2.12.1 && \
git checkout ${CALIPER_VERSION} && \
git submodule update --init --recursive && \
git clone https://github.com/LLNL/Adiak.git ${GIT_CLONE_STAGING_DIR}/Adiak && \
cd ${GIT_CLONE_STAGING_DIR}/Adiak && \
git fetch origin && \
git checkout v0.4.1 && \
git checkout ${ADIAK_VERSION} && \
git submodule update --init --recursive

RUN cd ${GIT_CLONE_STAGING_DIR}/Adiak && \
Expand Down
21 changes: 20 additions & 1 deletion latest/docker/build_and_upload_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,28 @@ fi

echo $(gh auth token) | docker login ghcr.io -u $(gh api user --jq .login) --password-stdin

# Extract Caliper and Adiak versions from caliper-tutorial submodule
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -x "${SCRIPT_DIR}/get_caliper_version.sh" ]; then
echo "Extracting Caliper and Adiak versions from caliper-tutorial submodule..."
CALIPER_VERSION=$(${SCRIPT_DIR}/get_caliper_version.sh caliper)
ADIAK_VERSION=$(${SCRIPT_DIR}/get_caliper_version.sh adiak)
echo "Using Caliper version: ${CALIPER_VERSION}"
echo "Using Adiak version: ${ADIAK_VERSION}"
CALIPER_BUILD_ARGS="--build-arg CALIPER_VERSION=${CALIPER_VERSION} --build-arg ADIAK_VERSION=${ADIAK_VERSION}"
else
echo "Warning: get_caliper_version.sh not found, using default versions"
CALIPER_BUILD_ARGS=""
fi

for bid in ${TO_BUILD_IDS[@]}; do
CURR_IMAGE_NAME="${bid}_IMAGE"
docker build --platform $DOCKER_PLATFORMS -f Dockerfile.$bid -t ${!CURR_IMAGE_NAME}:$TAG .
# Add build args for caliper image
if [ "$bid" = "caliper" ]; then
docker build --platform $DOCKER_PLATFORMS ${CALIPER_BUILD_ARGS} -f Dockerfile.$bid -t ${!CURR_IMAGE_NAME}:$TAG .
else
docker build --platform $DOCKER_PLATFORMS -f Dockerfile.$bid -t ${!CURR_IMAGE_NAME}:$TAG .
fi
docker push ${!CURR_IMAGE_NAME}:$TAG
done

Expand Down
73 changes: 73 additions & 0 deletions latest/docker/get_caliper_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env bash

# Script to extract Caliper and Adiak versions from the caliper-tutorial submodule
# Usage: ./get_caliper_version.sh [caliper|adiak]

set -e

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
CALIPER_TUTORIAL_PATH="${REPO_ROOT}/latest/tutorial-code/caliper-tutorial"

# Ensure the caliper-tutorial submodule is initialized
if [ ! -d "${CALIPER_TUTORIAL_PATH}/.git" ]; then
echo "Error: caliper-tutorial submodule not initialized at ${CALIPER_TUTORIAL_PATH}" >&2
echo "Please run: git submodule update --init --recursive latest/tutorial-code/caliper-tutorial" >&2
exit 1
fi

cd "${CALIPER_TUTORIAL_PATH}"

# Get the caliper submodule commit hash
CALIPER_COMMIT=$(git submodule status | grep caliper | awk '{print $1}' | sed 's/^[-+]//')

if [ -z "${CALIPER_COMMIT}" ]; then
echo "Error: Could not find caliper submodule in caliper-tutorial" >&2
exit 1
fi

# Initialize the caliper submodule to get version information
git submodule update --init caliper 2>/dev/null || true

cd caliper

# Try to get a tag for this commit
CALIPER_TAG=$(git describe --tags --exact-match "${CALIPER_COMMIT}" 2>/dev/null || echo "")

if [ -z "${CALIPER_TAG}" ]; then
# No exact tag match, use the commit hash
CALIPER_VERSION="${CALIPER_COMMIT}"
else
CALIPER_VERSION="${CALIPER_TAG}"
fi

# Get Adiak version from Caliper's submodules or default
if [ -f .gitmodules ] && grep -q "path = ext/adiak" .gitmodules; then
git submodule update --init ext/adiak 2>/dev/null || true
ADIAK_COMMIT=$(git submodule status ext/adiak | awk '{print $1}' | sed 's/^[-+]//')

cd ext/adiak
ADIAK_TAG=$(git describe --tags --exact-match "${ADIAK_COMMIT}" 2>/dev/null || echo "")

if [ -z "${ADIAK_TAG}" ]; then
ADIAK_VERSION="${ADIAK_COMMIT}"
else
ADIAK_VERSION="${ADIAK_TAG}"
fi
else
# Default version if Adiak is not a submodule
ADIAK_VERSION="v0.5.0"
fi

# Output based on requested component
if [ $# -eq 0 ]; then
echo "CALIPER_VERSION=${CALIPER_VERSION}"
echo "ADIAK_VERSION=${ADIAK_VERSION}"
elif [ "$1" = "caliper" ]; then
echo "${CALIPER_VERSION}"
elif [ "$1" = "adiak" ]; then
echo "${ADIAK_VERSION}"
else
echo "Error: Unknown component '$1'. Use 'caliper' or 'adiak'" >&2
exit 1
fi
Loading