Skip to content

Commit 3906f8e

Browse files
authored
Support for arm64 in mxnet-mnist image (#1940)
* support for arm64 in mxnet-mnist image * fix build script
1 parent 733d982 commit 3906f8e

File tree

3 files changed

+54
-8
lines changed

3 files changed

+54
-8
lines changed

examples/v1beta1/trial-images/mxnet-mnist/Dockerfile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
FROM python:3.9-slim
22

3-
ADD examples/v1beta1/trial-images/mxnet-mnist /opt/mxnet-mnist
3+
ARG TARGETARCH
4+
ENV LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:/opt/arm/armpl_22.0.2_gcc-11.2/lib"
5+
6+
COPY examples/v1beta1/trial-images/mxnet-mnist /opt/mxnet-mnist
47

58
WORKDIR /opt/mxnet-mnist
69

710
RUN apt-get -y update \
8-
&& apt-get -y install libgomp1 libquadmath0 \
9-
&& apt-get clean \
10-
&& rm -rf /var/lib/apt/lists/*
11+
&& apt-get -y install libgomp1 \
12+
&& if [ "${TARGETARCH}" = "arm64" ]; then \
13+
apt-get -y install wget; \
14+
elif [ "${TARGETARCH}" = "amd64" ]; then \
15+
apt-get -y install libquadmath0; \
16+
fi \
17+
&& apt-get clean \
18+
&& rm -rf /var/lib/apt/lists/*
1119

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2022 The Kubeflow Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
cd "$(dirname "$0")"
21+
22+
# Download Arm Performance Libraries for Ubuntu 20.04
23+
# Ref: https://developer.arm.com/downloads/-/arm-performance-libraries
24+
echo "Downloading Arm Performance Libraries for Ubuntu 20.04..."
25+
wget -qO - \
26+
"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" \
27+
| tar -xf -
28+
29+
# Install Arm Performance Libraries
30+
echo "Installing Arm Performance Libraries for Ubuntu 20.04..."
31+
./arm-performance-libraries_22.0.2_Ubuntu-20.04/arm-performance-libraries_22.0.2_Ubuntu-20.04.sh -a
32+
33+
# Clean up
34+
echo "Removing installer..."
35+
rm -rf ./arm-performance-libraries_22.0.2_Ubuntu-20.04

scripts/v1beta1/build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@ echo -e "\nBuilding training container images..."
120120
if [ ! "$ARCH" = "amd64" ]; then
121121
echo -e "\nSome training container images are supported only amd64."
122122
else
123-
echo -e "\nBuilding mxnet mnist training container example...\n"
124-
docker buildx build --platform linux/amd64 -t "${REGISTRY}/mxnet-mnist:${TAG}" -f examples/${VERSION}/trial-images/mxnet-mnist/Dockerfile .
125-
126123
echo -e "\nBuilding PyTorch mnist training container example with CPU support...\n"
127124
docker buildx build --platform linux/amd64 -t "${REGISTRY}/pytorch-mnist-cpu:${TAG}" -f examples/${VERSION}/trial-images/pytorch-mnist/Dockerfile.cpu .
128125

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

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

0 commit comments

Comments
 (0)