Skip to content

Commit 9d317ae

Browse files
authored
RHOAIENG-31715: add s390x Support for TrustyAI Notebook (#1628)
--------- Signed-off-by: Nishan Acharya <Nishan.Acharya@ibm.com>
1 parent 9101b77 commit 9d317ae

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

.tekton/odh-workbench-jupyter-trustyai-cpu-py312-v3-0-push.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ spec:
5656
- linux/x86_64
5757
- linux-m2xlarge/arm64
5858
- linux/ppc64le
59+
- linux/s390x
5960
pipelineRef:
6061
resolver: git
6162
params:

jupyter/trustyai/ubi9-python-3.12/Dockerfile.konflux.cpu

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ RUN curl -Lo mongodb-cli-mongocli-v${MONGOCLI_VERSION}.zip https://github.com/mo
1515
RUN unzip ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}.zip
1616
RUN cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ && \
1717
CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/
18+
1819
####################
1920
# wheel-cache-base #
2021
####################
@@ -31,7 +32,7 @@ COPY ${TRUSTYAI_SOURCE_CODE}/devel_env_setup.sh .
3132

3233
RUN --mount=type=cache,target=/root/.cache/uv \
3334
pip install --no-cache uv && \
34-
# the devel script is ppc64le specific - sets up build-time dependencies
35+
# the devel script is ppc64le and s390x specific - sets up build-time dependencies
3536
source ./devel_env_setup.sh && \
3637
# This may have to download and compile some dependencies, and as we don't lock requirements from `build-system.requires`,
3738
# we often don't know the correct hashes and `--require-hashes` would therefore fail on non amd64, where building is common.
@@ -117,7 +118,7 @@ WORKDIR /opt/app-root/bin
117118
USER root
118119

119120
# Install useful OS packages
120-
RUN dnf install -y jq unixODBC postgresql git-lfs libsndfile libxcrypt-compat && dnf clean all && rm -rf /var/cache/yum
121+
RUN dnf install -y jq unixODBC unixODBC-devel postgresql git-lfs libsndfile libxcrypt-compat && dnf clean all && rm -rf /var/cache/yum
121122

122123
# Copy dynamically-linked mongocli built in earlier build stage
123124
COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/
@@ -138,7 +139,7 @@ FROM jupyter-datascience AS jupyter-trustyai
138139
ARG DATASCIENCE_SOURCE_CODE=jupyter/datascience/ubi9-python-3.12
139140
ARG TRUSTYAI_SOURCE_CODE=jupyter/trustyai/ubi9-python-3.12
140141

141-
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib
142+
ENV LD_LIBRARY_PATH=/usr/lib:/usr/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
142143

143144
LABEL name="rhoai/odh-workbench-jupyter-trustyai-cpu-py312-rhel9" \
144145
com.redhat.component="odh-workbench-jupyter-trustyai-cpu-py312-rhel9" \
@@ -151,30 +152,40 @@ LABEL name="rhoai/odh-workbench-jupyter-trustyai-cpu-py312-rhel9" \
151152
USER 0
152153

153154
# Install jre that is needed to run the trustyai library
155+
# Also install runtime libraries for s390x/ppc64le
154156
RUN INSTALL_PKGS="java-17-openjdk" && \
157+
ARCH=$(uname -m) && \
158+
if [ "$ARCH" = "s390x" ] || [ "$ARCH" = "ppc64le" ]; then \
159+
# Add runtime libraries needed for s390x/ppc64le (OpenBLAS for PyTorch/NumPy)
160+
INSTALL_PKGS="$INSTALL_PKGS openblas openblas-threads"; \
161+
fi && \
155162
dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
156-
dnf -y clean all --enablerepo='*'
163+
dnf -y clean all --enablerepo='*' && \
164+
# Create symlink for compatibility (openblas package provides libopenblasp.so.0 but PyTorch looks for libopenblas.so.0)
165+
if [ "$ARCH" = "s390x" ] || [ "$ARCH" = "ppc64le" ]; then \
166+
ln -sf /usr/lib64/libopenblasp.so.0 /usr/lib64/libopenblas.so.0 && \
167+
ldconfig; \
168+
fi
157169

158170
# Install Python packages and Jupyterlab extensions from requirements.txt
159171
COPY ${TRUSTYAI_SOURCE_CODE}/pylock.toml ./
160172

161173
# install openblas for ppc64le
162174
RUN --mount=type=cache,from=whl-cache,source=/root/OpenBLAS/,target=/OpenBlas/,rw \
163-
bash -c ' \
164-
if [[ $(uname -m) == "ppc64le" ]]; then \
165-
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm; \
166-
dnf install -y libraqm libimagequant; \
175+
bash -c 'ARCH=$(uname -m); \
176+
if [ "$ARCH" = "ppc64le" ]; then \
167177
PREFIX=/usr/ make install -C /OpenBlas; \
168-
fi '
178+
fi'
169179

170180
# Install packages and cleanup
171181
# install packages as USER 0 (this will allow us to consume uv cache)
172182
RUN --mount=type=cache,from=whl-cache,source=/wheelsdir/,target=/wheelsdir/,rw \
173183
--mount=type=cache,target=/root/.cache/uv \
174-
bash -c ' \
175-
if [[ $(uname -m) == "ppc64le" ]]; then \
184+
bash -c 'ARCH=$(uname -m); \
185+
if [ "$ARCH" = "ppc64le" ] || [ "$ARCH" = "s390x" ]; then \
176186
UV_LINK_MODE=copy uv pip install /wheelsdir/*.whl accelerate --cache-dir /root/.cache/uv; \
177-
fi '
187+
fi'
188+
178189
RUN --mount=type=cache,target=/root/.cache/uv \
179190
echo "Installing softwares and packages" && \
180191
# we can ensure wheels are consumed from the cache only by restricting internet access for uv install with '--offline' flag

0 commit comments

Comments
 (0)