Skip to content

Commit

Permalink
Pre-release v2.0.0
Browse files Browse the repository at this point in the history
 - 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
  • Loading branch information
yohanchatelain committed May 15, 2024
1 parent f2018c2 commit cadbf0d
Show file tree
Hide file tree
Showing 15 changed files with 226 additions and 232 deletions.
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"]
49 changes: 24 additions & 25 deletions docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-2-numpy-only
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
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
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 --upgrade pip && python3 -m pip install --ignore-installed cython==0.29.24

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"]
62 changes: 31 additions & 31 deletions docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-3-scipy
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
ARG VERIFICARLO_VERSION=v0.9.1
FROM verificarlo/fuzzy:${VERIFICARLO_VERSION}-lapack-python3.8.5-numpy
ARG ORG=verificarlo
ARG VERIFICARLO_VERSION=v2.0.0
FROM ${ORG}/fuzzy:${VERIFICARLO_VERSION}-lapack-python3.8.5-numpy

# Load backend IEEE
RUN echo "libinterflop_ieee.so" > $VFC_BACKENDS_FROM_FILE
ARG SCIPY_VERSION=1.7.3

# Copy sanity check for SciPy
COPY docker/resources/numpy-sanity-check.py /tmp/scipy-sanity-check.py

# Install SciPy dependencies
RUN pip3 install joblib pythran pybind11
# Replace gfortran with verificarlo-f
RUN cp /usr/local/bin/verificarlo-f /usr/bin/gfortran

# Remove debug flag which makes flag crash
RUN sed -i "302s/.*/ llvm_options = llvm_options.replace(\"'-g'\",'') if \"'-g'\" in llvm_options else llvm_options/" $(which verificarlo)

RUN cd /opt/build/ &&\
wget https://github.com/scipy/scipy/releases/download/v1.7.3/scipy-1.7.3.tar.gz &&\
tar xvf scipy-1.7.3.tar.gz &&\
cd scipy-1.7.3 &&\
CC="verificarlo-c" FC="verificarlo-f" CXX="verificarlo-c++" LDSHARED='verificarlo-c -shared' \
CFLAGS="--conservative -Wunused-command-line-argument" \
LDFLAGS="--conservative -Wunused-command-line-argument" \
python3 setup.py build --disable-optimization -j $(nproc) install
COPY docker/resources/scipy-sanity-check.py /tmp/

# Restore original verificarlo
RUN sed -i "302s/ llvm_options = llvm_options.replace(\"'-g'\",'') if \"'-g'\" in llvm_options else llvm_options//" $(which verificarlo)

# Sanity check
RUN python3 /tmp/scipy-sanity-check.py

# Remove temporary files
RUN rm -rf /opt/build/*
# Load backend IEEE
RUN echo "libinterflop_ieee.so" > $VFC_BACKENDS_FROM_FILE && \
# Install SciPy dependencies
pip3 install joblib pythran pybind11 && \
# Replace gfortran with verificarlo-f
cp /usr/local/bin/verificarlo-f /usr/bin/gfortran && \
# Remove debug flag which makes compilation crash
sed -i "397s/.*/ llvm_options = llvm_options.replace(\"'-g'\",'') if \"'-g'\" in llvm_options else llvm_options/" $(which verificarlo) && \
cd /opt/build/ &&\
wget https://github.com/scipy/scipy/releases/download/v${SCIPY_VERSION}/scipy-${SCIPY_VERSION}.tar.gz &&\
tar xvf scipy-${SCIPY_VERSION}.tar.gz &&\
cd scipy-${SCIPY_VERSION} &&\
CC="verificarlo-c" FC="verificarlo-f" CXX="verificarlo-c++" \
LDSHARED='verificarlo-c -shared' \
CFLAGS="-Wunused-command-line-argument" \
CXXFLAGS="-Wunused-command-line-argument" \
FCFLAGS="-Wunused-command-line-argument" \
LDFLAGS="-Wunused-command-line-argument" \
python3 setup.py build --disable-optimization -j $(nproc) install && \
# Restore original verificarlo
sed -i "397s/ llvm_options = llvm_options.replace(\"'-g'\",'') if \"'-g'\" in llvm_options else llvm_options//" $(which verificarlo) && \
# Set default MCA mode
echo "libinterflop_mca.so -m rr" > $VFC_BACKENDS_FROM_FILE && \
# Sanity check
cd && python3 /tmp/scipy-sanity-check.py && \
rm -rf /opt/build/*

# Restore default behavior for verificarlo's CC
ENV CC "verificarlo-c"
RUN echo "libinterflop_mca_int.so -m rr" > $VFC_BACKENDS_FROM_FILE

ENTRYPOINT [ "/bin/bash"]
Loading

0 comments on commit cadbf0d

Please sign in to comment.