Skip to content

Commit

Permalink
Pre-release v0.9.1 (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
yohanchatelain authored Mar 17, 2023
1 parent 88c54c5 commit 2c4cf81
Show file tree
Hide file tree
Showing 17 changed files with 979 additions and 42 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/build-fuzzy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,32 @@ jobs:
include:
- NAME: Lapack + Libmath
DOCKER_FROM: ""
DOCKER_TO: fuzzy_v0.8.0-lapack
DOCKER_IMAGE: verificarlo/fuzzy:v0.8.0-lapack
DOCKER_TO: fuzzy_v0.9.1-lapack
DOCKER_IMAGE: verificarlo/fuzzy:v0.9.1-lapack
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-0-lapack-libmath

- NAME: Python
DOCKER_FROM: fuzzy_v0.8.0-lapack
DOCKER_TO: fuzzy_v0.8.0-lapack-python3.8.5
DOCKER_IMAGE: verificarlo/fuzzy:v0.8.0-lapack-python3.8.5
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_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-1-python

- NAME: Numpy
DOCKER_FROM: fuzzy_v0.8.0-lapack-python3.8.5
DOCKER_TO: fuzzy_v0.8.0-lapack-python3.8.5-numpy
DOCKER_IMAGE: verificarlo/fuzzy:v0.8.0-lapack-python3.8.5-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_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-2-numpy

- NAME: Scipy
DOCKER_FROM: fuzzy_v0.8.0-lapack-python3.8.5-numpy
DOCKER_TO: fuzzy_v0.8.0-lapack-python3.8.5-numpy-scipy
DOCKER_IMAGE: verificarlo/fuzzy:v0.8.0-lapack-python3.8.5-numpy-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_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-3-scipy

- NAME: Scikit-Learn
DOCKER_FROM: fuzzy_v0.8.0-lapack-python3.8.5-numpy-scipy
DOCKER_TO: fuzzy_v0.8.0-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_IMAGE: verificarlo/fuzzy:v0.8.0-lapack-python3.8.5-numpy-scipy-sklearn
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_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-4-sklearn

name: ${{ matrix.NAME }}
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
docker build ./ -t ${{ matrix.DOCKER_IMAGE }} \
-f ${{ matrix.DOCKER_FILE }} \
--build-arg VERIFICARLO_VERSION=v0.8.0
--build-arg VERIFICARLO_VERSION=v0.9.1
docker save ${{ matrix.DOCKER_IMAGE }} -o /tmp/${{ matrix.DOCKER_TO }}.tar
Expand All @@ -117,9 +117,9 @@ jobs:
runs-on: ubuntu-20.04
env:
RUN_IF_CHANGED: docker
DOCKER_FROM: fuzzy_v0.8.0-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_FROM: fuzzy_v0.9.1-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_IMAGE: verificarlo/fuzzy
DOCKER_FROM_TAG: v0.8.0-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_FROM_TAG: v0.9.1-lapack-python3.8.5-numpy-scipy-sklearn

steps:
- name: Checkout repository
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG VERIFICARLO_VERSION=v0.8.0
ARG VERIFICARLO_VERSION=v0.9.1
FROM verificarlo/verificarlo:${VERIFICARLO_VERSION}

# Setup build dependencies
Expand Down
2 changes: 1 addition & 1 deletion docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-1-python
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG VERIFICARLO_VERSION=v0.8.0
ARG VERIFICARLO_VERSION=v0.9.1
FROM verificarlo/fuzzy:${VERIFICARLO_VERSION}-lapack

# Use IEEE mode for compiling with verificarlo
Expand Down
2 changes: 1 addition & 1 deletion docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-2-numpy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG VERIFICARLO_VERSION=v0.8.0
ARG VERIFICARLO_VERSION=v0.9.1
FROM verificarlo/fuzzy:${VERIFICARLO_VERSION}-lapack-python3.8.5

# Use IEEE mode for compiling with verificarlo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG VERIFICARLO_VERSION=v0.8.0
ARG VERIFICARLO_VERSION=v0.9.1
FROM verificarlo/fuzzy:${VERIFICARLO_VERSION}-lapack

# Use IEEE mode for compiling with verificarlo
Expand Down
6 changes: 3 additions & 3 deletions docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-3-scipy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG VERIFICARLO_VERSION=v0.8.0
ARG VERIFICARLO_VERSION=v0.9.1
FROM verificarlo/fuzzy:${VERIFICARLO_VERSION}-lapack-python3.8.5-numpy

# Load backend IEEE
Expand All @@ -13,7 +13,7 @@ RUN pip3 install joblib pythran pybind11
RUN cp /usr/local/bin/verificarlo-f /usr/bin/gfortran

# Remove debug flag which makes flag crash
RUN sed -i "294s/.*/ llvm_options = llvm_options.replace(\"'-g'\",'') if \"'-g'\" in llvm_options else llvm_options/" $(which verificarlo)
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 &&\
Expand All @@ -25,7 +25,7 @@ RUN cd /opt/build/ &&\
python3 setup.py build --disable-optimization -j $(nproc) install

# Restore original verificarlo
RUN sed -i "294s/ llvm_options = llvm_options.replace(\"'-g'\",'') if \"'-g'\" in llvm_options else llvm_options//" $(which 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG VERIFICARLO_VERSION=v0.8.0
ARG VERIFICARLO_VERSION=v0.9.1
FROM verificarlo/fuzzy:${VERIFICARLO_VERSION}-numpy

# Load backend IEEE
Expand All @@ -12,9 +12,6 @@ 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 "294s/.*/ 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 &&\
Expand All @@ -24,9 +21,6 @@ RUN cd /opt/build/ &&\
LDFLAGS="--conservative -Wunused-command-line-argument" \
python3 setup.py build --disable-optimization -j $(nproc) install

# Restore original verificarlo
RUN sed -i "294s/ 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

Expand Down
2 changes: 1 addition & 1 deletion docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-4-sklearn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG VERIFICARLO_VERSION=v0.8.0
ARG VERIFICARLO_VERSION=v0.9.1
FROM verificarlo/fuzzy:${VERIFICARLO_VERSION}-lapack-python3.8.5-numpy-scipy

# Load backend IEEE
Expand Down
7 changes: 4 additions & 3 deletions docker/resources/build_fuzzy_libmath_dockerfile.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#!/bin/bash

DOCKERFILE=Dockerfile.mcalibmath
FUZZY_IMAGE_DEFAULT=verificarlo/fuzzy:v0.8.0-lapack
FUZZY_IMAGE_DEFAULT=verificarlo/fuzzy:v0.9.1-lapack

generate_docker() {

cat >${DOCKERFILE} <<HERE
# Base image
FROM ${1}
RUN mkdir -p /opt/mca-libmath/{standard,quad,mpfr}
RUN mkdir -p /opt/mca-libmath/{fast,standard,quad,mpfr}
COPY --from=${2} /opt/mca-libmath/set-fuzzy-libmath.py /usr/local/bin/set-fuzzy-libmath
COPY --from=${2} /opt/mca-libmath/fast/libmath.so /opt/mca-libmath/fast/libmath.so
COPY --from=${2} /opt/mca-libmath/standard/libmath.so /opt/mca-libmath/standard/libmath.so
COPY --from=${2} /opt/mca-libmath/quad/libmath.so /opt/mca-libmath/quad/libmath.so
COPY --from=${2} /opt/mca-libmath/mpfr/libmath.so /opt/mca-libmath/mpfr/libmath.so
Expand Down Expand Up @@ -38,7 +39,7 @@ if [[ $# < 2 ]]; then
echo " <DOCKER_IMAGE>: Name of the base docker image to build"
echo " <TAG>: Tag of the new image to build"
echo " [FUZZY_IMAGE]: Name of the fuzzy image to copy from (optional)"
echo " Requires a fuzzy version >= 0.8.0"
echo " Requires a fuzzy version >= 0.9.1"
exit 1
elif [[ $# == 2 ]]; then
BASE_IMAGE=$1
Expand Down
18 changes: 17 additions & 1 deletion docker/resources/libmath/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
# Makefile for the instrumented shared library

.PHONY: tracer
.PHONY: tracer fast

all:
cd fast && $(MAKE)
cd standard && $(MAKE)
cd quad && $(MAKE)
cd mpfr && $(MAKE)

fast:
cd fast && $(MAKE)

standard:
cd standard && $(MAKE)

quad:
cd quad && $(MAKE)

mpfr:
cd mfpr && $(MAKE)


tracer:
cd fast && $(MAKE) tracer
cd standard && $(MAKE) tracer
cd quad && $(MAKE) tracer
cd mpfr && $(MAKE) tracer
Expand All @@ -19,6 +34,7 @@ perf: all
cd tests && $(MAKE) perf

clean:
cd fast && $(MAKE) clean
cd standard && $(MAKE) clean
cd quad && $(MAKE) clean
cd mpfr && $(MAKE) clean
Expand Down
28 changes: 28 additions & 0 deletions docker/resources/libmath/fast/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Makefile for the instrumented shared library

CC = gcc
TRACER_FLAGS = --tracer --tracer-debug-mode --tracer-level=temporary
DEBUG_FLAGS = --save-temps -g
CFLAGS = -Wall -fPIC # C flags
LDFLAGS = -shared # linking flags
LIBS= -ldl
RM = rm -f

TARGET_LIB = libmath.so # target lib

SRCS = src/wrapping_script.c # source files
OBJS = $(SRCS:.c=.o)
ROOT = $(PWD)


.PHONY: tracer

$(TARGET_LIB): $(OBJS)
$(CC) ${LDFLAGS} ${CFLAGS} -o $@ $^ ${LIBS}

tracer:
$(CC) ${TRACER_FLAGS} ${CFLAGS} ${LDFLAGS} -o ${TARGET_LIB} $(SRCS) ${LIBS}

clean:
-${RM} ${TARGET_LIB} ${OBJS} $(SRCS:.c=.d) .vfcwrapper*

128 changes: 128 additions & 0 deletions docker/resources/libmath/fast/src/float_const.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#ifndef __FLOAT_CONST_H__
#define __FLOAT_CONST_H__

// Round to nearest using cast
// Works for standard type, aka double to float, if the ieee rounding flag is
// set to nearest WARNING: For quad to double we notice that the behavior is
// always round toward zero
#define NEAREST_FLOAT(x) ((float)(x))
#define NEAREST_DOUBLE(x) ((double)(x))

// Quad precision sign encoding size
#define QUAD_SIGN_SIZE 1
// Quad precision quiet nan bit encoding size
#define QUAD_QUIET_NAN_SIZE 1
// Quad precision exponent encoding size
#define QUAD_EXP_SIZE 15
// Quad precision pseudo mantissa encoding size
#define QUAD_PMAN_SIZE 112
// Quad precision pseudo mantissa encoding size in the word containing the 64
// msb
#define QUAD_HX_PMAN_SIZE 48
// Quad precison pseudo mantissa encoding size in the word containing the 64 lsb
#define QUAD_LX_PMAN_SIZE 64
// Quad precision pseudo mantissa encoding size for quiet nan in the word
// containing the 64 msb
#define QUAD_HX_PMAN_QNAN_SIZE 47
// Quad precison pseudo mantissa encoding size for quiet nan in the word
// containing the 64 lsb
#define QUAD_LX_PMAN_QNAN_SIZE 64
// Quad precison mantissa size
#define QUAD_PREC 113
// Quad precison exponent complement
#define QUAD_EXP_COMP 16383
// Quad precison max exponent
#define QUAD_EXP_MAX 16383
// Quad precison min exponent
#define QUAD_EXP_MIN 16382
// Quad precison infinite exponent
#define QUAD_EXP_INF 0x7FFF
// Quad precison mask to remove the sign bit
#define QUAD_HX_ERASE_SIGN 0x7fffffffffffffffULL
// Quad precison 64 msb to encode plus infinity
#define QINF_hx 0x7fff000000000000ULL
// Quad precison 64 msb to encode minus infinity
#define QMINF_hx 0x7fff000000000000ULL
// Quad precison 64 lsb to encode plus infinity
#define QINF_lx 0x0000000000000000ULL
// Quad precison 64 lsb to encode minus infinity
#define QMINF_lx 0x0000000000000000ULL
// Quad precision pseudo mantissa msb set to one
#define QUAD_HX_PMAN_MSB 0x0000800000000000ULL

// Double precision encoding size
#define DOUBLE_SIGN_SIZE 1
// Double precision expoenent encoding size
#define DOUBLE_EXP_SIZE 11
// Double precision pseudo-mantissa encoding size
#define DOUBLE_PMAN_SIZE 52
// Double precision mantissa size
#define DOUBLE_PREC 53
// Double precison exponent complement
#define DOUBLE_EXP_COMP 1023
// Double precison max exponent for normal number
#define DOUBLE_NORMAL_EXP_MAX 1023
// Double precison max exponent
#define DOUBLE_EXP_MAX 1024
// Double precison min exponent
#define DOUBLE_EXP_MIN 1022
// Double precison infinite exponent
#define DOUBLE_EXP_INF 0x7FF
// Double precision plus infinity encoding
#define DOUBLE_PLUS_INF 0x7FF0000000000000ULL
// Double precision pseudo matissa msb set to one
#define DOUBLE_PMAN_MSB 0x0008000000000000ULL
// Double precision mask to erase sign bit
#define DOUBLE_ERASE_SIGN 0x7fffffffffffffffULL
// Double precision mask to extract sign bit
#define DOUBLE_GET_SIGN 0x8000000000000000ULL
// Double precision mask to extract the exponent
#define DOUBLE_GET_EXP 0x7ff0000000000000ULL
// Double precision mask to extract the pseudo mantissa
#define DOUBLE_GET_PMAN 0x000fffffffffffffULL
// Double precision high part mantissa
#define DOUBLE_PMAN_HIGH_SIZE 20
// Double precision low part mantissa
#define DOUBLE_PMAN_LOW_SIZE 32
// Double precision mask of 1
#define DOUBLE_MASK_ONE 0xffffffffffffffffULL

// single precision encoding size
#define FLOAT_SIGN_SIZE 1
// Single precision exponent encoding size
#define FLOAT_EXP_SIZE 8
// Single precision pseudo mantisa encoding size
#define FLOAT_PMAN_SIZE 23
// single precision mantissa size
#define FLOAT_PREC 24
// single precison exponent complement
#define FLOAT_EXP_COMP 127
// single precison max exponent for normal number
#define FLOAT_NORMAL_EXP_MAX 127
// single precison max exponent
#define FLOAT_EXP_MAX 128
// single precison min exponent
#define FLOAT_EXP_MIN 126
// single precison infinite exponent
#define FLOAT_EXP_INF 0xFF
// single precision plus infinity encoding
#define FLOAT_PLUS_INF 0x7F800000
// Single precision pseudo matissa msb set to one
#define FLOAT_PMAN_MSB 0x00400000
// Single precision mask to erase sign bit
#define FLOAT_ERASE_SIGN 0x7fffffff
// Single precision mask to extract sign bit
#define FLOAT_GET_SIGN 0x80000000
// Single precision mask to extract the exponent
#define FLOAT_GET_EXP 0x7F800000
// Single precision mask to extract the pseudo mantissa
#define FLOAT_GET_PMAN 0x007fffff
// Single precision mask of 1
#define FLOAT_MASK_ONE 0xffffffffULL

// Sign encoding size
#define SIGN_SIZE 1
// 64bit word with msb set to 1
#define WORD64_MSB 0x8000000000000000ULL

#endif /* __FLOAT_CONST_H__ */
Loading

0 comments on commit 2c4cf81

Please sign in to comment.