Skip to content

Commit

Permalink
Release v0.8.0 (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
yohanchatelain authored Jul 16, 2022
1 parent 04d93a9 commit 88c54c5
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 13 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Unrealesed
# [v0.8.0] 2022/07/15

## Changed
* Change mecanisme to introduce noise in libmath. Now it uses a direct call to the inexact function, allowing to perturb libmath results within RR mode.

* Change verificarlo version to compile fuzzy images [v0.6.0 -> v0.8.0]
## Fixed
* l_gammaf_r test that failed due to uninitialized pointer value

Expand Down
52 changes: 48 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Fuzzy
# Fuzzy v0.8.0

[![DOI](https://zenodo.org/badge/218554957.svg)](https://zenodo.org/badge/latestdoi/218554957)
[![Build Fuzzy Environments](https://github.com/verificarlo/fuzzy/actions/workflows/build-fuzzy.yml/badge.svg?branch=master)](https://github.com/verificarlo/fuzzy/actions/workflows/build-fuzzy.yml)
Expand Down Expand Up @@ -89,6 +89,43 @@ prior to performing your experiments! *Fuzzy* should print a log message to the
terminal when you run your commands, including the configuration, so you can verify
that the parameters were properly specified.

#### Fuzzy-libmath

Since version v0.8.0, fuzzy-libmath comes with three modes (standard, quad, and
mpfr). Internally, the fuzzy-libmath computes the actual result of the math
function using the standard library of the OS and then perturbs the output by
adding MCA noise. Since the accuracy of the `libm` used can vary from one
version to another (see this
[article](https://hal.inria.fr/hal-03141101v2/document)), one
can use higher precision to ensure accurate intermediate computations.
These modes specify the library used:
- `standard`: uses the standard libm provided by the OS. (fastest)
- `quad`: uses the libquadmath.so library
- `mpfr`: uses the MPFR library with 113 bits of precision, equivalent to
the binary128 precision (slowest)

Note that a higher precision implies a larger slowdown. The `standard` mode is
the fastest and can be used if one does not require high accuracy. To switch
from one version to another, please use the `set-fuzzy-libmath` tool already
installed in the docker image as follow:

```
usage: set-fuzzy-libmath [-h] --version {no-fuzzy,standard,quad,mpfr}
optional arguments:
-h, --help show this help message and exit
--version {no-fuzzy,standard,quad,mpfr}
Fuzzy libmath version to use:
- no-fuzzy: Disable fuzzy libmath
- standard: Use the standard libmath available on the system.
Fastest instrumentation but possibly not accurate
- quad: Use the libquadmath for intermediate results.
Slower than the standard version but more accurate.
- mpfr: Use the mpfr library for intermediate results.
Slowest version but gives the correct rounding.
```

#### Using Fuzzy in Multi-stage builds
Fuzzy provides a set of recompiled shared objects and tools that facilitate adding
Monte Carlo Arithmetic to tools. If you've got a Docker container which relies on
Expand All @@ -103,14 +140,21 @@ FROM verificarlo/fuzzy:latest as fuzzy
FROM user/image:version
# Copy libmath fuzzy environment from fuzzy image, for example
RUN mkdir -p /opt/mca-libmath
COPY --from=fuzzy /opt/mca-libmath/libmath.so /opt/mca-libmath/
COPY --from=fuzzy /usr/local/lib/libinterflop* /usr/local/lib/
RUN mkdir -p /opt/mca-libmath/{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/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
COPY --from=${2} /usr/local/lib/libinterflop* /usr/local/lib/
# If you will also want to recompile more libraries with verificarlo, add these lines
COPY --from=fuzzy /usr/local/bin/verificarlo* /usr/local/bin/
COPY --from=fuzzy /usr/local/include/* /usr/local/include/
# Preloading the instrumented shared library
ARG FUZZY_LIBMATH_VERSION=standard
RUN set-fuzzy-libmath --version=${FUZZY_LIBMATH_VERSION}
ENV VFC_BACKENDS 'libinterflop_mca.so --precision-binary32=24 --precision-binary64=53 --mode=mca'
```

Expand Down
23 changes: 16 additions & 7 deletions docker/resources/build_fuzzy_libmath_dockerfile.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
#!/bin/bash

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

generate_docker() {

cat >${DOCKERFILE} <<HERE
# Base image
FROM ${1}
# Copy fuzzy environment from fuzzy image
RUN mkdir -p /opt/mca-libmath
COPY --from=${2} /opt/mca-libmath/standard/libmath.so /opt/mca-libmath/
RUN mkdir -p /opt/mca-libmath/{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/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
COPY --from=${2} /usr/local/lib/libinterflop* /usr/local/lib/
# Set environment variables
ENV VFC_BACKENDS 'libinterflop_mca.so --precision-binary32=24 --precision-binary64=53 --mode=mca'
ENV LD_PRELOAD '/opt/mca-libmath/standard/libmath.so'
# If you will also want to recompile more libraries with verificarlo, add these lines
COPY --from=${2} /usr/local/bin/verificarlo* /usr/local/bin/
COPY --from=${2} /usr/local/include/* /usr/local/include/
# Preloading the instrumented shared library
ARG FUZZY_LIBMATH_VERSION=standard
RUN set-fuzzy-libmath --version=${FUZZY_LIBMATH_VERSION}
ENV VFC_BACKENDS 'libinterflop_mca.so --precision-binary32=24 --precision-binary64=53 --mode=rr'
HERE

}
Expand All @@ -30,6 +38,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"
exit 1
elif [[ $# == 2 ]]; then
BASE_IMAGE=$1
Expand Down

0 comments on commit 88c54c5

Please sign in to comment.