Skip to content

Commit

Permalink
Pre-release v2.0.0 (#48)
Browse files Browse the repository at this point in the history
* Pre-release v2.0.0
 - Update numpy version from 1.22.0 to 1.22.4
 - Update sklearn version from 1.0.2 to 1.3.2
 - Refactore docker images
 - Add test for scikit-learn
 - Update build_fuzzy_libmath_dockerfile script:
    * Update verificarlo version
    * Copy libraries into /opt/build-math/lib
    instead of /usr/local/lib to not conflict with
    existing library search path (LD_LIBRARY_PATH).
- Update Github action versions
  • Loading branch information
yohanchatelain authored May 21, 2024
1 parent f2018c2 commit c279ce2
Show file tree
Hide file tree
Showing 18 changed files with 274 additions and 265 deletions.
60 changes: 30 additions & 30 deletions .github/workflows/build-fuzzy.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
name: Build Fuzzy Environments

on:
push:
branches: ['*']
pull_request:
branches: ['*']

env:
VERIFICARLO_VERSION: v2.0.0

jobs:
fuzzy:
runs-on: ubuntu-20.04
Expand All @@ -18,41 +18,41 @@ jobs:
include:
- NAME: Lapack + Libmath
DOCKER_FROM: ""
DOCKER_TO: fuzzy_v0.9.1-lapack
DOCKER_IMAGE: verificarlo/fuzzy:v0.9.1-lapack
DOCKER_TO: fuzzy_v2.0.0-lapack
DOCKER_IMAGE: verificarlo/fuzzy:v2.0.0-lapack
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-0-lapack-libmath

- NAME: Python
DOCKER_FROM: fuzzy_v0.9.1-lapack
DOCKER_TO: fuzzy_v0.9.1-lapack-python3.8.5
DOCKER_IMAGE: verificarlo/fuzzy:v0.9.1-lapack-python3.8.5
DOCKER_FROM: fuzzy_v2.0.0-lapack
DOCKER_TO: fuzzy_v2.0.0-lapack-python3.8.5
DOCKER_IMAGE: verificarlo/fuzzy:v2.0.0-lapack-python3.8.5
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-1-python

- NAME: Numpy
DOCKER_FROM: fuzzy_v0.9.1-lapack-python3.8.5
DOCKER_TO: fuzzy_v0.9.1-lapack-python3.8.5-numpy
DOCKER_IMAGE: verificarlo/fuzzy:v0.9.1-lapack-python3.8.5-numpy
DOCKER_FROM: fuzzy_v2.0.0-lapack-python3.8.5
DOCKER_TO: fuzzy_v2.0.0-lapack-python3.8.5-numpy
DOCKER_IMAGE: verificarlo/fuzzy:v2.0.0-lapack-python3.8.5-numpy
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-2-numpy

- NAME: Scipy
DOCKER_FROM: fuzzy_v0.9.1-lapack-python3.8.5-numpy
DOCKER_TO: fuzzy_v0.9.1-lapack-python3.8.5-numpy-scipy
DOCKER_IMAGE: verificarlo/fuzzy:v0.9.1-lapack-python3.8.5-numpy-scipy
DOCKER_FROM: fuzzy_v2.0.0-lapack-python3.8.5-numpy
DOCKER_TO: fuzzy_v2.0.0-lapack-python3.8.5-numpy-scipy
DOCKER_IMAGE: verificarlo/fuzzy:v2.0.0-lapack-python3.8.5-numpy-scipy
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-3-scipy

- NAME: Scikit-Learn
DOCKER_FROM: fuzzy_v0.9.1-lapack-python3.8.5-numpy-scipy
DOCKER_TO: fuzzy_v0.9.1-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_IMAGE: verificarlo/fuzzy:v0.9.1-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_FROM: fuzzy_v2.0.0-lapack-python3.8.5-numpy-scipy
DOCKER_TO: fuzzy_v2.0.0-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_IMAGE: verificarlo/fuzzy:v2.0.0-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-4-sklearn

name: ${{ matrix.NAME }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Check for file changes
uses: jitterbit/get-changed-files@v1
uses: tj-actions/changed-files@v44
id: changes

- name: Print list of changed files
Expand All @@ -61,7 +61,7 @@ jobs:
- name: If Dockerfiles have been updated, cancel running upstream jobs
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
continue-on-error: true
uses: n1hility/cancel-previous-runs@v2
uses: n1hility/cancel-previous-runs@v3
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}

Expand All @@ -80,7 +80,7 @@ jobs:
- name: Download Docker artifacts, if available
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: ${{ matrix.DOCKER_FROM }}
path: /tmp
Expand All @@ -96,7 +96,7 @@ jobs:
docker build ./ -t ${{ matrix.DOCKER_IMAGE }} \
-f ${{ matrix.DOCKER_FILE }} \
--build-arg VERIFICARLO_VERSION=v0.9.1
--build-arg VERIFICARLO_VERSION=v2.0.0
docker save ${{ matrix.DOCKER_IMAGE }} -o /tmp/${{ matrix.DOCKER_TO }}.tar
Expand All @@ -107,7 +107,7 @@ jobs:
- name: Upload Docker artifacts
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.DOCKER_TO }}
path: /tmp/${{ matrix.DOCKER_TO }}.tar
Expand All @@ -117,24 +117,24 @@ jobs:
runs-on: ubuntu-20.04
env:
RUN_IF_CHANGED: docker
DOCKER_FROM: fuzzy_v0.9.1-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_FROM: fuzzy_v2.0.0-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_IMAGE: verificarlo/fuzzy
DOCKER_FROM_TAG: v0.9.1-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_FROM_TAG: v2.0.0-lapack-python3.8.5-numpy-scipy-sklearn

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Check for file changes
uses: jitterbit/get-changed-files@v1
uses: tj-actions/changed-files@v44
id: changes

- name: Print list of changed files
run: echo ${{ steps.changes.outputs.all }}

- name: If Dockerfiles have been updated, cancel running upstream jobs
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: n1hility/cancel-previous-runs@v2
uses: n1hility/cancel-previous-runs@v3
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}

Expand All @@ -153,7 +153,7 @@ jobs:
- name: Download Docker artifacts, if available
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: ${{ env.DOCKER_FROM }}
path: /tmp
Expand All @@ -165,7 +165,7 @@ jobs:
docker image ls -a
docker image tag ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_FROM_TAG }} \
${{ env.DOCKER_IMAGE }}:latest
${{ env.DOCKER_IMAGE }}:latest
if ${{ env.PUSH }}
then
Expand Down
70 changes: 34 additions & 36 deletions docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-0-lapack-libmath
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ARG VERIFICARLO_VERSION=v0.9.1
FROM verificarlo/verificarlo:${VERIFICARLO_VERSION}
ARG ORG=verificarlo
ARG VERIFICARLO_VERSION=v2.0.0
FROM ${ORG}/verificarlo:${VERIFICARLO_VERSION}

# Setup build dependencies
RUN apt-get update -qqq &&\
Expand All @@ -14,59 +15,56 @@ RUN apt-get update -qqq &&\

# Copy verificarlo's exclusion file for Python 3
COPY docker/resources/python-vfc-exclude.txt /tmp/python-vfc-exclude.txt
COPY docker/resources/verificarlo.patch /tmp/verificarlo.patch
COPY docker/resources/libmath/set-fuzzy-libmath.py /usr/local/bin/set-fuzzy-libmath
RUN patch $(which verificarlo) /tmp/verificarlo.patch

# Setting compilers and linkers to use verificarlo
ENV CC "verificarlo-c"
ENV CXX "verificarlo-c++"
ENV FC "verificarlo-f"
ENV LDSHARED "verificarlo-c"

# Load backend IEEE
RUN mkdir -p /opt/ && touch /opt/vfc-backends.txt
# Setting verificarlo's backend file
ENV VFC_BACKENDS_FROM_FILE=/opt/vfc-backends.txt
RUN echo "libinterflop_ieee.so" > $VFC_BACKENDS_FROM_FILE

# Create instrumented shared mathematical library
# Copy libmath source code
COPY docker/resources/libmath/ /opt/mca-libmath/
RUN cd /opt/mca-libmath/ &&\
make CONSERVATIVE=True &&\
make test

# Load backend IEEE and
# create instrumented shared mathematical library
RUN mkdir -p /opt/ && \
echo "libinterflop_ieee.so" > /opt/vfc-backends.txt && \
cd /opt/mca-libmath/ && \
make && \
make test

# Build BLAS and LAPACK from the following URL's instructions:
# http://ab-initio.mit.edu/wiki/index.php/Template:Installing_BLAS_and_LAPACK
RUN cd /opt/build/ &&\
wget http://www.netlib.org/lapack/lapack-3.9.0.tgz &&\
gunzip lapack-3.9.0.tgz &&\
tar xf lapack-3.9.0.tar &&\
cd /opt/build/lapack-3.9.0/ &&\
cp make.inc.example make.inc &&\
sed -i 's/= gcc/= verificarlo-c/g' make.inc &&\
sed -i 's/= gfortran/= verificarlo-f/g' make.inc &&\
sed -i 's/TIMER = INT_ETIME/#TIMER = INT_ETIME/g' make.inc &&\
sed -i 's/# TIMER = NONE/TIMER = NONE/g' make.inc &&\
mkdir build &&\
cd /opt/build/lapack-3.9.0/build &&\
cmake FC=verificarlo-f -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_C_COMPILER=verificarlo-c -DCMAKE_Fortran_COMPILER=verificarlo-f \
-DCBLAS=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_C_FLAGS="--conservative" -DCMAKE_Fortran_FLAGS="--conservative" .. &&\
make -j $(nproc) &&\
make install

# Remove temporary files
RUN rm -rf /opt/build/*
RUN cd /opt/build/ && \
wget http://www.netlib.org/lapack/lapack-3.9.0.tgz && \
gunzip lapack-3.9.0.tgz && \
tar xf lapack-3.9.0.tar && \
cd /opt/build/lapack-3.9.0/ && \
cp make.inc.example make.inc && \
sed -i 's/= gcc/= verificarlo-c/g' make.inc && \
sed -i 's/= gfortran/= verificarlo-f/g' make.inc && \
sed -i 's/TIMER = INT_ETIME/#TIMER = INT_ETIME/g' make.inc && \
sed -i 's/# TIMER = NONE/TIMER = NONE/g' make.inc && \
mkdir build && \
cd /opt/build/lapack-3.9.0/build && \
cmake FC=verificarlo-f -DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_C_COMPILER=verificarlo-c -DCMAKE_Fortran_COMPILER=verificarlo-f \
-DCBLAS=ON -DBUILD_SHARED_LIBS=ON .. && \
make -j $(nproc) && \
make install && \
rm -rf /opt/build/*

# Restore default behavior for verificarlo's CC
ENV CC "verificarlo-c"
# Preload the instrumented shared library
ENV VFC_BACKENDS_LOGGER="False"
ENV VFC_BACKENDS_SILENT_LOAD="True"
RUN echo "libinterflop_mca_int.so -m rr" > $VFC_BACKENDS_FROM_FILE

# Preloading the instrumented shared library
ARG FUZZY_LIBMATH_VERSION=standard
RUN set-fuzzy-libmath --version=${FUZZY_LIBMATH_VERSION}

RUN echo "libinterflop_mca.so -m rr" > $VFC_BACKENDS_FROM_FILE && \
set-fuzzy-libmath --version=${FUZZY_LIBMATH_VERSION}

# Set bash shell as entrypoint
ENTRYPOINT [ "/bin/bash"]
49 changes: 24 additions & 25 deletions docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-1-python
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
ARG VERIFICARLO_VERSION=v0.9.1
FROM verificarlo/fuzzy:${VERIFICARLO_VERSION}-lapack
ARG ORG=verificarlo
ARG VERIFICARLO_VERSION=v2.0.0
FROM ${ORG}/fuzzy:${VERIFICARLO_VERSION}-lapack

# Use IEEE mode for compiling with verificarlo
RUN echo "libinterflop_ieee.so" > $VFC_BACKENDS_FROM_FILE

# Remove any existing python packages
RUN apt -y -qqq remove python3
ARG PYTHON_VERSION=3.8.5

## Build Python 3.8.5 from source and the associated pip
RUN cd /opt/build/ && \
wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz && \
tar xvf Python-3.8.5.tgz && \
cd Python-3.8.5 && \
LDFLAGS="--conservative --exclude-file=/tmp/python-vfc-exclude.txt" \
CFLAGS="--conservative --exclude-file=/tmp/python-vfc-exclude.txt" \
# Use IEEE mode for compiling with verificarlo
RUN echo "libinterflop_ieee.so" > $VFC_BACKENDS_FROM_FILE && \
# Remove any existing python packages
apt -y -qqq remove python3 && \
# Build Python from source and the associated pip
cd /opt/build/ && \
wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz && \
tar xvf Python-${PYTHON_VERSION}.tgz && \
cd Python-${PYTHON_VERSION} && \
LDFLAGS="--exclude-file=/tmp/python-vfc-exclude.txt" \
CFLAGS="--exclude-file=/tmp/python-vfc-exclude.txt" \
LDSHARED='verificarlo-c -shared' \
./configure --with-ensurepip=install &&\
make -j $(nproc) &&\
make install &&\
wget https://bootstrap.pypa.io/get-pip.py &&\
python3 get-pip.py

# Remove temporary files
RUN rm -rf /opt/build/*

# Restore default MCA mode
RUN echo "libinterflop_mca_int.so -m rr" > $VFC_BACKENDS_FROM_FILE
./configure --with-ensurepip=install && \
make -j $(nproc) && \
make install && \
wget https://bootstrap.pypa.io/get-pip.py && \
python3 get-pip.py && \
# Remove temporary files
rm -rf /opt/build/* && \
# Restore default MCA mode
echo "libinterflop_mca.so -m rr" > $VFC_BACKENDS_FROM_FILE

# Set entrypoint
ENTRYPOINT [ "/bin/bash"]
49 changes: 24 additions & 25 deletions docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-2-numpy
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
ARG VERIFICARLO_VERSION=v0.9.1
FROM verificarlo/fuzzy:${VERIFICARLO_VERSION}-lapack-python3.8.5
ARG ORG=verificarlo
ARG VERIFICARLO_VERSION=v2.0.0
FROM ${ORG}/fuzzy:${VERIFICARLO_VERSION}-lapack-python3.8.5

# Use IEEE mode for compiling with verificarlo
RUN echo "libinterflop_ieee.so" > $VFC_BACKENDS_FROM_FILE
ARG NUMPY_VERSION=1.22.4

# Copy verificarlo's exclusion file for Python 3
COPY docker/resources/numpy-vfc-exclude.txt /tmp/numpy-vfc-exclude.txt
COPY docker/resources/numpy-sanity-check.py /tmp/numpy-sanity-check.py

# Build numpy from sources and link with the local BLAS and LAPACK
RUN python3 -m pip install cython

RUN cd /opt/build/ &&\
wget https://github.com/numpy/numpy/releases/download/v1.22.0/numpy-1.22.0.tar.gz &&\
tar xvf numpy-1.22.0.tar.gz &&\
cd numpy-1.22.0 &&\
# Use IEEE mode for compiling with verificarlo
RUN echo "libinterflop_ieee.so" > $VFC_BACKENDS_FROM_FILE && \
# Build numpy from sources and link with the local BLAS and LAPACK
python3 -m pip install cython==0.29.30 && \
cd /opt/build/ &&\
wget https://github.com/numpy/numpy/releases/download/v${NUMPY_VERSION}/numpy-${NUMPY_VERSION}.tar.gz &&\
tar xvf numpy-${NUMPY_VERSION}.tar.gz &&\
cd numpy-${NUMPY_VERSION} &&\
CC="verificarlo-c" FC="verificarlo-f" CXX="verificarlo-c++" LDSHARED='verificarlo-c -shared' \
CFLAGS="--conservative --exclude-file=/tmp/numpy-vfc-exclude.txt -Wunused-command-line-argument" \
LDFLAGS="--conservative --exclude-file=/tmp/numpy-vfc-exclude.txt -Wunused-command-line-argument" \
python3 setup.py build -j $(nproc) --disable-optimization install


# Smoked test for vectorization.
# We should run the full numpy test suit in next versions
RUN python3 /tmp/numpy-sanity-check.py

# Remove temporary files
RUN rm -rf /opt/build/*

# Restore default MCA mode
RUN echo "libinterflop_mca_int.so -m rr" > $VFC_BACKENDS_FROM_FILE
CFLAGS="--exclude-file=/tmp/numpy-vfc-exclude.txt -Wunused-command-line-argument" \
FCFLAGS="--exclude-file=/tmp/numpy-vfc-exclude.txt -Wunused-command-line-argument" \
CXXFLAGS="--exclude-file=/tmp/numpy-vfc-exclude.txt -Wunused-command-line-argument" \
LDFLAGS="--exclude-file=/tmp/numpy-vfc-exclude.txt -Wunused-command-line-argument" \
python3 setup.py build -j $(nproc) --disable-optimization install && \
# Smoked test for vectorization.
# We should run the full numpy test suit in next versions
cd && python3 /tmp/numpy-sanity-check.py && \
# Remove temporary files
rm -rf /opt/build/* && \
# Restore default MCA mode
echo "libinterflop_mca.so -m rr" > $VFC_BACKENDS_FROM_FILE

ENTRYPOINT [ "/bin/bash"]
Loading

0 comments on commit c279ce2

Please sign in to comment.