Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker containers to test NSIMD on different architectures #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
33 changes: 33 additions & 0 deletions docker/aarch64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# docker build . --tag eschnett/nsimd-aarch64
# docker push eschnett/nsimd-aarch64
# docker run eschnett/nsimd-aarch64

FROM ubuntu:19.10

ENV DEBIAN_FRONTEND=noninteractive

# John Milton was a polyglot
RUN mkdir /milton
WORKDIR /milton

# Install system packages
RUN apt-get update && \
apt-get --yes --no-install-recommends install \
apt-utils \
build-essential \
ca-certificates \
clang-format \
cmake \
crossbuild-essential-arm64 \
git \
perl \
python3 \
qemu-user \
&& \
rm -rf /var/lib/apt/lists/*

# TODO: install mpfr from scratch

COPY run.sh /milton/run.sh

CMD ./run.sh
34 changes: 34 additions & 0 deletions docker/aarch64/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -euxo pipefail

# Download nsimd
mkdir src
cd src
git clone https://github.com/agenium-scale/nsimd.git
cd nsimd

# Patch to create static libraries and executables
perl -pi -e 's/SHARED/STATIC/' CMakeLists.txt
perl -pi -e 's/LIBRARY DESTINATION/ARCHIVE DESTINATION/' CMakeLists.txt
perl -pi -e 's/\$\{target\} \$\{libname\}/\$\{target\} \$\{libname\} "-static"/' CMakeLists.txt

# Create source files
python3 egg/hatch.py --all --force --simd=aarch64

# Configure
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc-9 -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++-9 -DSIMD=AARCH64 -DCMAKE_INSTALL_PREFIX=/milton/nsimd ..

# Build library
make -j$(nproc)

# Build tests
make -j$(nproc) tests

# Run tests
ctest -V .

# Install library
make -j$(nproc) install
31 changes: 31 additions & 0 deletions docker/armv7/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# docker build . --tag eschnett/nsimd-armv7
# docker push eschnett/nsimd-armv7
# docker run eschnett/nsimd-armv7

FROM ubuntu:19.10

ENV DEBIAN_FRONTEND=noninteractive

# John Milton was a polyglot
RUN mkdir /milton
WORKDIR /milton

# Install system packages
RUN apt-get update && \
apt-get --yes --no-install-recommends install \
ca-certificates \
clang-format \
cmake \
crossbuild-essential-armhf \
git \
perl \
python3 \
qemu-user \
&& \
rm -rf /var/lib/apt/lists/*

# TODO: install mpfr from scratch

COPY run.sh /milton/run.sh

CMD ./run.sh
34 changes: 34 additions & 0 deletions docker/armv7/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -euxo pipefail

# Download nsimd
mkdir src
cd src
git clone https://github.com/agenium-scale/nsimd.git
cd nsimd

# Patch to create static libraries and executables
perl -pi -e 's/SHARED/STATIC/' CMakeLists.txt
perl -pi -e 's/LIBRARY DESTINATION/ARCHIVE DESTINATION/' CMakeLists.txt
perl -pi -e 's/\$\{target\} \$\{libname\}/\$\{target\} \$\{libname\} "-static"/' CMakeLists.txt

# Create source files
python3 egg/hatch.py --all --force --simd=neon128

# Configure
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc-9 -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++-9 -DSIMD=NEON128 -DCMAKE_INSTALL_PREFIX=/milton/nsimd ..

# Build library
make -j$(nproc)

# Build tests
make -j$(nproc) tests

# Run tests
ctest -V .

# Install library
make -j$(nproc) install
82 changes: 82 additions & 0 deletions docker/ppc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# docker build . --tag eschnett/nsimd-ppc
# docker push eschnett/nsimd-ppc
# docker run eschnett/nsimd-ppc

FROM ubuntu:19.10

ENV DEBIAN_FRONTEND=noninteractive

# John Milton was a polyglot
RUN mkdir /milton
WORKDIR /milton

# Install system packages
RUN apt-get update && \
apt-get --yes --no-install-recommends install \
binutils-powerpc64-linux-gnu \
build-essential \
ca-certificates \
clang-format \
cmake \
crossbuild-essential-ppc64el \
git \
libfdt-dev \
libglib2.0-dev \
libpixman-1-dev \
perl \
pkg-config \
python \
python3 \
wget \
zlib1g-dev \
&& \
rm -rf /var/lib/apt/lists/*

# Install qemu

# We can't use Ubuntu's qemu, nor the released versions. This
# PPC-specific bug <https://bugs.launchpad.net/qemu/+bug/1841990>
# might be the reason.

# qemu-4.1.0: illegal instruction
# RUN mkdir src && \
# ( cd src && \
# wget https://download.qemu.org/qemu-4.1.0.tar.xz && \
# tar xJf qemu-4.1.0.tar.xz \
# cd qemu-4.1.0 && \
# ./configure --target-list=ppc64le-linux-user --prefix=/milton/qemu && \
# make -j$(nproc) && \
# make -j$(nproc) install && \
# true ) && \
# rm -rf src

# qemu-4.0.1: build failure
# RUN mkdir src && \
# ( cd src && \
# wget https://download.qemu.org/qemu-4.0.1.tar.xz && \
# tar xJf qemu-4.0.1.tar.xz && \
# cd qemu-4.0.1 && \
# ./configure --target-list=ppc64le-linux-user --prefix=/milton/qemu && \
# make -j$(nproc) && \
# make -j$(nproc) install && \
# true ) && \
# rm -rf src

# qemu master
RUN mkdir src && \
( cd src && \
git clone https://git.qemu.org/git/qemu.git && \
cd qemu && \
git submodule init && \
git submodule update --recursive && \
./configure --target-list=ppc64le-linux-user --prefix=/milton/qemu && \
make -j$(nproc) && \
make -j$(nproc) install && \
true ) && \
rm -rf src

# TODO: install mpfr from scratch

COPY run.sh /milton/run.sh

CMD ./run.sh
36 changes: 36 additions & 0 deletions docker/ppc/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

set -euxo pipefail

# Download nsimd
mkdir src
cd src
git clone -b eschnett/vsx https://github.com/eschnett/nsimd.git
cd nsimd

# Patch to create static libraries and executables, and to run tests
# with qemu
perl -pi -e 's/SHARED/STATIC/' CMakeLists.txt
perl -pi -e 's/LIBRARY DESTINATION/ARCHIVE DESTINATION/' CMakeLists.txt
perl -pi -e 's/\$\{target\} \$\{libname\}/\$\{target\} \$\{libname\} "-static"/' CMakeLists.txt
perl -pi -e 's/add_test\(NAME \$\{target\} COMMAND/add_test\(NAME \$\{target\} COMMAND \/milton\/qemu\/bin\/qemu-ppc64le -cpu power9/' CMakeLists.txt

# Create source files
python3 egg/hatch.py --all --force --simd=vsx

# Configure
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=powerpc64le-linux-gnu-gcc-9 -DCMAKE_CXX_COMPILER=powerpc64le-linux-gnu-g++-9 -DCMAKE_C_FLAGS=-mcpu=power9 -DCMAKE_CXX_FLAGS=-mcpu=power9 -DSIMD=VSX -DCMAKE_INSTALL_PREFIX=/milton/nsimd ..

# Build library
make -j$(nproc)

# Build tests
make -j$(nproc) tests

# Run tests
ctest -V .

# Install library
make -j$(nproc) install