Skip to content

Commit b8e45c6

Browse files
V2.1.0 (#50)
* Update fuzzy to Verificarlo v2.1.0: - Update python version to 3.8.20 - Update numpy version to 1.24.4 - Update scipy version to 1.10.1 - Update scikit-learn version to 1.2.2 * Add fuzzy pytorch docker image * Update verificarlo version in github workflow * update workflow * Fix docker image for pytorch * Update workflow * Update README + fix build_fuzzy_libmath script * update verificarlo version * Add missing files * Add blas test * Update fuzzy pytorch * Add the patched version of verificarlo
1 parent 7be081b commit b8e45c6

17 files changed

+750
-245
lines changed

.github/workflows/build-fuzzy.yml

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches: ['*']
66

77
env:
8-
VERIFICARLO_VERSION: v2.0.0
8+
VERIFICARLO_VERSION: v2.1.0
99

1010
jobs:
1111
fuzzy:
@@ -18,32 +18,32 @@ jobs:
1818
include:
1919
- NAME: Lapack + Libmath
2020
DOCKER_FROM: ""
21-
DOCKER_TO: fuzzy_v2.0.0-lapack
22-
DOCKER_IMAGE: verificarlo/fuzzy:v2.0.0-lapack
21+
DOCKER_TO: fuzzy_v2.1.0-lapack
22+
DOCKER_IMAGE: verificarlo/fuzzy:v2.1.0-lapack
2323
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-0-lapack-libmath
2424

2525
- NAME: Python
26-
DOCKER_FROM: fuzzy_v2.0.0-lapack
27-
DOCKER_TO: fuzzy_v2.0.0-lapack-python3.8.5
28-
DOCKER_IMAGE: verificarlo/fuzzy:v2.0.0-lapack-python3.8.5
26+
DOCKER_FROM: fuzzy_v2.1.0-lapack
27+
DOCKER_TO: fuzzy_v2.1.0-lapack-python3.8.20
28+
DOCKER_IMAGE: verificarlo/fuzzy:v2.1.0-lapack-python3.8.20
2929
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-1-python
3030

3131
- NAME: Numpy
32-
DOCKER_FROM: fuzzy_v2.0.0-lapack-python3.8.5
33-
DOCKER_TO: fuzzy_v2.0.0-lapack-python3.8.5-numpy
34-
DOCKER_IMAGE: verificarlo/fuzzy:v2.0.0-lapack-python3.8.5-numpy
32+
DOCKER_FROM: fuzzy_v2.1.0-lapack-python3.8.20
33+
DOCKER_TO: fuzzy_v2.1.0-lapack-python3.8.20-numpy
34+
DOCKER_IMAGE: verificarlo/fuzzy:v2.1.0-lapack-python3.8.20-numpy
3535
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-2-numpy
3636

3737
- NAME: Scipy
38-
DOCKER_FROM: fuzzy_v2.0.0-lapack-python3.8.5-numpy
39-
DOCKER_TO: fuzzy_v2.0.0-lapack-python3.8.5-numpy-scipy
40-
DOCKER_IMAGE: verificarlo/fuzzy:v2.0.0-lapack-python3.8.5-numpy-scipy
38+
DOCKER_FROM: fuzzy_v2.1.0-lapack-python3.8.20-numpy
39+
DOCKER_TO: fuzzy_v2.1.0-lapack-python3.8.20-numpy-scipy
40+
DOCKER_IMAGE: verificarlo/fuzzy:v2.1.0-lapack-python3.8.20-numpy-scipy
4141
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-3-scipy
4242

4343
- NAME: Scikit-Learn
44-
DOCKER_FROM: fuzzy_v2.0.0-lapack-python3.8.5-numpy-scipy
45-
DOCKER_TO: fuzzy_v2.0.0-lapack-python3.8.5-numpy-scipy-sklearn
46-
DOCKER_IMAGE: verificarlo/fuzzy:v2.0.0-lapack-python3.8.5-numpy-scipy-sklearn
44+
DOCKER_FROM: fuzzy_v2.1.0-lapack-python3.8.20-numpy-scipy
45+
DOCKER_TO: fuzzy_v2.1.0-lapack-python3.8.20-numpy-scipy-sklearn
46+
DOCKER_IMAGE: verificarlo/fuzzy:v2.1.0-lapack-python3.8.20-numpy-scipy-sklearn
4747
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-4-sklearn
4848

4949
name: ${{ matrix.NAME }}
@@ -56,57 +56,58 @@ jobs:
5656
id: changes
5757

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

6161
- name: If Dockerfiles have been updated, cancel running upstream jobs
62-
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
62+
if: contains(steps.changes.outputs.all_changed_files, '${{ env.RUN_IF_CHANGED }}')
6363
continue-on-error: true
6464
uses: n1hility/cancel-previous-runs@v3
6565
with:
66-
token: ${{ secrets.GH_ACCESS_TOKEN }}
66+
token: ${{ secrets.GITHUB_TOKEN }}
6767

6868
- name: Determine if images will be pushed to Docker, and login as needed
69-
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
69+
if: contains(steps.changes.outputs.all_changed_files, '${{ env.RUN_IF_CHANGED }}')
7070
run: |
7171
if ([ "${{github.event_name}}" == "push" ] && [ "${{github.ref}}" == "refs/heads/master" ])
7272
then
7373
echo This is a push to master: we will push to Docker Hub
7474
echo "PUSH=true" >> "$GITHUB_ENV"
75+
export PUSH=true
7576
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
7677
else
7778
echo This is a PR or non-master push: we will not push to Docker Hub
7879
echo "PUSH=false" >> "$GITHUB_ENV"
7980
fi
8081
8182
- name: Download Docker artifacts, if available
82-
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
83+
if: contains(steps.changes.outputs.all_changed_files, '${{ env.RUN_IF_CHANGED }}') && matrix.DOCKER_FROM != ''
84+
continue-on-error: true
8385
uses: actions/download-artifact@v4
8486
with:
8587
name: ${{ matrix.DOCKER_FROM }}
8688
path: /tmp
8789

88-
- name: (optionally) Load, Build, and (optionally) Push Docker image
89-
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
90+
- name: Build and Push Docker image
91+
if: contains(steps.changes.outputs.all_changed_files, '${{ env.RUN_IF_CHANGED }}')
9092
run: |
91-
if [ ! -z ${{ matrix.DOCKER_FROM }} ]
93+
if [ -n "${{ matrix.DOCKER_FROM }}" ] && [ -f "/tmp/${{ matrix.DOCKER_FROM }}.tar" ]
9294
then
9395
docker load --input /tmp/${{ matrix.DOCKER_FROM }}.tar
9496
docker image ls -a
9597
fi
9698
9799
docker build ./ -t ${{ matrix.DOCKER_IMAGE }} \
98100
-f ${{ matrix.DOCKER_FILE }} \
99-
--build-arg VERIFICARLO_VERSION=v2.0.0
101+
--build-arg VERIFICARLO_VERSION=v2.1.0
100102
101103
docker save ${{ matrix.DOCKER_IMAGE }} -o /tmp/${{ matrix.DOCKER_TO }}.tar
102-
103-
if ${{ env.PUSH }}
104+
if [ "$PUSH" = "true" ]
104105
then
105106
docker push ${{ matrix.DOCKER_IMAGE }}
106107
fi
107108
108109
- name: Upload Docker artifacts
109-
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
110+
if: contains(steps.changes.outputs.all_changed_files, '${{ env.RUN_IF_CHANGED }}')
110111
uses: actions/upload-artifact@v4
111112
with:
112113
name: ${{ matrix.DOCKER_TO }}
@@ -117,9 +118,9 @@ jobs:
117118
runs-on: ubuntu-20.04
118119
env:
119120
RUN_IF_CHANGED: docker
120-
DOCKER_FROM: fuzzy_v2.0.0-lapack-python3.8.5-numpy-scipy-sklearn
121+
DOCKER_FROM: fuzzy_v2.1.0-lapack-python3.8.20-numpy-scipy-sklearn
121122
DOCKER_IMAGE: verificarlo/fuzzy
122-
DOCKER_FROM_TAG: v2.0.0-lapack-python3.8.5-numpy-scipy-sklearn
123+
DOCKER_FROM_TAG: v2.1.0-lapack-python3.8.20-numpy-scipy-sklearn
123124

124125
steps:
125126
- name: Checkout repository
@@ -130,16 +131,16 @@ jobs:
130131
id: changes
131132

132133
- name: Print list of changed files
133-
run: echo ${{ steps.changes.outputs.all }}
134+
run: echo ${{ steps.changes.outputs.all_changed_files }}
134135

135136
- name: If Dockerfiles have been updated, cancel running upstream jobs
136-
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
137+
if: contains(steps.changes.outputs.all_changed_files, '${{ env.RUN_IF_CHANGED }}')
137138
uses: n1hility/cancel-previous-runs@v3
138139
with:
139-
token: ${{ secrets.GH_ACCESS_TOKEN }}
140+
token: ${{ secrets.GITHUB_TOKEN }}
140141

141142
- name: Determine if images will be pushed to Docker, and login as needed
142-
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
143+
if: contains(steps.changes.outputs.all_changed_files, '${{ env.RUN_IF_CHANGED }}')
143144
run: |
144145
if ([ "${{github.event_name}}" == "push" ] && [ "${{github.ref}}" == "refs/heads/master" ])
145146
then
@@ -152,22 +153,22 @@ jobs:
152153
fi
153154
154155
- name: Download Docker artifacts, if available
155-
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
156+
if: contains(steps.changes.outputs.all_changed_files, '${{ env.RUN_IF_CHANGED }}')
156157
uses: actions/download-artifact@v4
157158
with:
158159
name: ${{ env.DOCKER_FROM }}
159160
path: /tmp
160161

161-
- name: (optionally) Load, Rename, and Push Docker image
162-
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
162+
- name: Load, Rename, and Push Docker image
163+
if: contains(steps.changes.outputs.all_changed_files, '${{ env.RUN_IF_CHANGED }}')
163164
run: |
164165
docker load --input /tmp/${{ env.DOCKER_FROM }}.tar
165166
docker image ls -a
166167
167168
docker image tag ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_FROM_TAG }} \
168169
${{ env.DOCKER_IMAGE }}:latest
169170
170-
if ${{ env.PUSH }}
171+
if [ "$PUSH" = "true" ]
171172
then
172173
docker push ${{ env.DOCKER_IMAGE }}:latest
173-
fi
174+
fi

README.md

Lines changed: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Fuzzy v2.0.0
1+
# Fuzzy v2.1.0
22

33
[![DOI](https://zenodo.org/badge/218554957.svg)](https://zenodo.org/badge/latestdoi/218554957)
44
[![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)
@@ -7,7 +7,28 @@
77

88
*A fuzzy ecosystem for evaluating the effect of numerical error on computational tools.*
99

10-
[![Fuzzy Marimo](https://github.com/verificarlo/fuzzy/raw/master/img/fuzzy.png)](./img/fuzzy.png)
10+
<div align="center">
11+
<a href="./img/fuzzy.png">
12+
<img src="https://github.com/verificarlo/fuzzy/raw/master/img/fuzzy.png" alt="Fuzzy Marimo">
13+
</a>
14+
</div>
15+
16+
## Table of Contents
17+
- [Fuzzy v2.1.0](#fuzzy-v210)
18+
- [Table of Contents](#table-of-contents)
19+
- [Motivation](#motivation)
20+
- [Usage](#usage)
21+
- [Building \& booting the environment](#building--booting-the-environment)
22+
- [Adding your software](#adding-your-software)
23+
- [Fuzzy-libmath](#fuzzy-libmath)
24+
- [Using Fuzzy in Multi-stage builds](#using-fuzzy-in-multi-stage-builds)
25+
- [Running Fuzzy workflows](#running-fuzzy-workflows)
26+
- [Quick overview of Monte Carlo Arithmetic](#quick-overview-of-monte-carlo-arithmetic)
27+
- [Common failures](#common-failures)
28+
- [Contributing](#contributing)
29+
- [Presentation](#presentation)
30+
- [References](#references)
31+
- [License](#license)
1132

1233
## Motivation
1334

@@ -40,7 +61,7 @@ programs can be evaluated, reducing the overhead on both tool developers and con
4061
You can get started with *Fuzzy* quite simply, just launch a
4162
[Docker](https://www.docker.com/) container as follows:
4263

43-
```
64+
```bash
4465
docker run -ti verificarlo/fuzzy
4566
```
4667

@@ -54,7 +75,7 @@ build chain, you'll find instrumented versions of `libmath`, `lapack`, `python3`
5475
`numpy`, and several other recompiled libraries.
5576

5677
An example for how to verify your installation for Python could be the following:
57-
```
78+
```bash
5879
$ python3 -c "print([sum([.001]*1000) for _ in range(3)])"
5980
[1.0, 0.9999999999999997, 1.0000000000000007, 1.0000000000000002]
6081
```
@@ -70,7 +91,7 @@ The next step is to make sure the environment is configured to introduce perturb
7091
the way you expect. You can start with a configuration which performs perturbations
7192
akin to randomizing machine error with the following:
7293

73-
```
94+
```bash
7495
echo "libinterflop_mca.so -m mca --precision-binary32=24 --precision-binary64=53" > $VFC_BACKENDS_FROM_FILE
7596
```
7697

@@ -113,7 +134,7 @@ the fastest and can be used if one does not require high accuracy. To switch
113134
from one version to another, please use the `set-fuzzy-libmath` tool already
114135
installed in the docker image as follow:
115136

116-
```
137+
```bash
117138
usage: set-fuzzy-libmath [-h] --version {no-fuzzy,standard,quad,mpfr}
118139

119140
optional arguments:
@@ -133,14 +154,47 @@ Fuzzy libmath version to use:
133154
Slowest version but gives the correct rounding.
134155
```
135156

157+
158+
> [!TIP]
159+
> The script [build_fuzzy_libmath_dockerfile.sh](docker/resources/build_fuzzy_libmath_dockerfile.sh) helps you turn your Docker image into a fuzzy-libmath one.
160+
161+
```bash
162+
usage: ./build_fuzzy_libmath_dockerfile.sh <DOCKER_IMAGE> <TAG> [FUZZY_IMAGE]
163+
<DOCKER_IMAGE>: Name of the base Docker image to build
164+
<TAG>: Tag of the new image to build
165+
[FUZZY_IMAGE]: Name of the fuzzy image to copy from (optional)
166+
Requires a fuzzy version >= 0.9.1
167+
```
168+
169+
To test your instrumentation:
170+
171+
**Python**
172+
```python
173+
>>> import math
174+
>>> from collections import Counter
175+
>>> Counter( math.cos(42) for i in range(1000) )
176+
Counter({-0.39998531498835127: 506, -0.3999853149883513: 249, -0.3999853149883512: 245})
177+
```
178+
179+
**Octave**
180+
```matlab
181+
>>> x = repmath(42, 1000);
182+
>>> y = cos(x);
183+
>>> printf("%.17f\n", unique(y))
184+
-0.39998531498835133
185+
-0.39998531498835127
186+
-0.39998531498835121
187+
```
188+
189+
136190
#### Using Fuzzy in Multi-stage builds
137191
Fuzzy provides a set of recompiled shared objects and tools that facilitate adding
138192
Monte Carlo Arithmetic to tools. If you've got a Docker container which relies on
139193
some of these libraries, you can easily add *Fuzzy* with a [Multi-stage Docker build](https://docs.docker.com/develop/develop-images/multistage-build/).
140194

141195
For example:
142196

143-
```
197+
```bash
144198
FROM verificarlo/fuzzy:latest as fuzzy
145199

146200
# Your target image

0 commit comments

Comments
 (0)