Skip to content

Commit

Permalink
Support for arm64 in mxnet-mnist image (#1940)
Browse files Browse the repository at this point in the history
* support for arm64 in mxnet-mnist image

* fix build script
  • Loading branch information
tenzen-y authored Aug 29, 2022
1 parent 733d982 commit 3906f8e
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 8 deletions.
21 changes: 16 additions & 5 deletions examples/v1beta1/trial-images/mxnet-mnist/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
FROM python:3.9-slim

ADD examples/v1beta1/trial-images/mxnet-mnist /opt/mxnet-mnist
ARG TARGETARCH
ENV LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:/opt/arm/armpl_22.0.2_gcc-11.2/lib"

COPY examples/v1beta1/trial-images/mxnet-mnist /opt/mxnet-mnist

WORKDIR /opt/mxnet-mnist

RUN apt-get -y update \
&& apt-get -y install libgomp1 libquadmath0 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
&& apt-get -y install libgomp1 \
&& if [ "${TARGETARCH}" = "arm64" ]; then \
apt-get -y install wget; \
elif [ "${TARGETARCH}" = "amd64" ]; then \
apt-get -y install libquadmath0; \
fi \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN pip install mxnet==1.9.0
RUN if [ "${TARGETARCH}" = "arm64" ]; then \
/opt/mxnet-mnist/install-arm-performance-libraries.sh; \
fi
RUN pip install mxnet==1.9.1
RUN chgrp -R 0 /opt/mxnet-mnist \
&& chmod -R g+rwX /opt/mxnet-mnist

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

# Copyright 2022 The Kubeflow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail
cd "$(dirname "$0")"

# Download Arm Performance Libraries for Ubuntu 20.04
# Ref: https://developer.arm.com/downloads/-/arm-performance-libraries
echo "Downloading Arm Performance Libraries for Ubuntu 20.04..."
wget -qO - \
"https://developer.arm.com/-/media/Files/downloads/hpc/arm-performance-libraries/22-0-2/Ubuntu20.04/arm-performance-libraries_22.0.2_Ubuntu-20.04_gcc-11.2.tar?rev=577d3dbcff7847b9af57399b2978f9a6&revision=577d3dbc-ff78-47b9-af57-399b2978f9a6" \
| tar -xf -

# Install Arm Performance Libraries
echo "Installing Arm Performance Libraries for Ubuntu 20.04..."
./arm-performance-libraries_22.0.2_Ubuntu-20.04/arm-performance-libraries_22.0.2_Ubuntu-20.04.sh -a

# Clean up
echo "Removing installer..."
rm -rf ./arm-performance-libraries_22.0.2_Ubuntu-20.04
6 changes: 3 additions & 3 deletions scripts/v1beta1/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ echo -e "\nBuilding training container images..."
if [ ! "$ARCH" = "amd64" ]; then
echo -e "\nSome training container images are supported only amd64."
else
echo -e "\nBuilding mxnet mnist training container example...\n"
docker buildx build --platform linux/amd64 -t "${REGISTRY}/mxnet-mnist:${TAG}" -f examples/${VERSION}/trial-images/mxnet-mnist/Dockerfile .

echo -e "\nBuilding PyTorch mnist training container example with CPU support...\n"
docker buildx build --platform linux/amd64 -t "${REGISTRY}/pytorch-mnist-cpu:${TAG}" -f examples/${VERSION}/trial-images/pytorch-mnist/Dockerfile.cpu .

Expand All @@ -142,6 +139,9 @@ else
docker buildx build --platform linux/amd64 -t "${REGISTRY}/simple-pbt:${TAG}" -f examples/${VERSION}/trial-images/simple-pbt/Dockerfile .
fi

echo -e "\nBuilding mxnet mnist training container example...\n"
docker buildx build --platform "linux/$ARCH" -t "${REGISTRY}/mxnet-mnist:${TAG}" -f examples/${VERSION}/trial-images/mxnet-mnist/Dockerfile .

echo -e "\nBuilding Tensorflow with summaries mnist training container example...\n"
docker buildx build --platform "linux/$ARCH" -t "${REGISTRY}/tf-mnist-with-summaries:${TAG}" -f examples/${VERSION}/trial-images/tf-mnist-with-summaries/Dockerfile .

Expand Down

0 comments on commit 3906f8e

Please sign in to comment.