Coder Social home page Coder Social logo

fbenz / fpdebug Goto Github PK

View Code? Open in Web Editor NEW
21.0 4.0 9.0 21.38 MB

Dynamic Program Analysis based on Valgrind to find Floating-Point Accuracy Problems

License: GNU General Public License v2.0

C 34.68% C++ 0.71% Shell 63.83% Makefile 0.42% Dockerfile 0.35%
valgrind floating-point mpfr pldi-artifact pldi

fpdebug's Introduction

FpDebug

GNU General Public License

FpDebug is a heavyweight Valgrind tool for detecting floating-point accuracy problems.

The tool uses MPFR for its side-by-side computation in higher precision. Because MPFR is run with the tool on top of Valgrind, it has only access to the partial C library provided by Valgrind. Thus, a patch for MPFR is provided that adjusts it to run on top of Valgrind. As GMP is used by MFPR, a patch for GMP is also provided.

Origin

This project was started during my Bachelor’s thesis (winter 2010/11). The results have been published in:

A Dynamic Program Analysis to find Floating-Point Accuracy Problems [PDF]
Florian Benz, Andreas Hildebrandt, and Sebastian Hack
PLDI '12: Proceedings of the 2012 ACM SIGPLAN Conference on Programming Language Design and Implementation

Quick start

The docker folder contains Dockfiles for several systems that can be used to build and play around. During the build a small example program is also built and analyzed to check that everything works.

Build and run Docker image
sudo docker build -t fpdebug .
sudo docker run -it fpdebug /bin/bash

Build from source

Note
The version on master runs with Valgrind 3.7 and might not work on more recent systems than Ubuntu 12.04. However, a version for Valgrind 3.12 can be found here: #2 . But so far it has only been tested on small examples. Tests have been performed on Ubuntu 16.04 and Ubuntu 16.10.
Note
Only 64bit systems are supported.

The following installation instructions are for Ubuntu 12.04.5 LTS (64bit). The instructions should be similar for most other Linux systems.

Install build dependencies
# Git is only needed to check out the sources
sudo apt-get install git
# m4 is a dependency of GMP
sudo apt-get install m4
# libc6-dbg is required for Valgrind (otherwise it fails at runtime)
sudo apt-get install libc6-dbg
Get the sources
git clone [email protected]:fbenz/FpDebug.git
Install patched GMP 5.0.1
./install_gmp.sh
Install patched MPFR 3.0.0
./install_mpfr.sh
Install Valgrind with FpDebug
./install_valgrind.sh

Running FpDebug

Build an example
cd valgrind/fpdebug/examples
gcc test_1.c -O0 -g -o test_1.out
(or $ gcc test_1.c -O0 -g -mfpmath=387 -o test_1.out )
Run FpDebug
./valgrind/install/bin/valgrind --tool=fpdebug valgrind/fpdebug/examples/test_1.out
FpDebug output
==7041== FpDebug-0.1, Floating-point arithmetic debugger
==7041== Copyright (C) 2010-2011 by Florian Benz.
==7041== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==7041== Command: valgrind/fpdebug/examples/test_1.out
==7041==
==7041== precision=120
==7041== mean-error=yes
==7041== ignore-libraries=no
==7041== ignore-accurate=yes
==7041== sim-original=no
==7041== analyze-all=yes
==7041== bad-cancellations=yes
==7041== ignore-end=no
Test program: machine epsilon, client request
Sum: 1.0000000e+00
Running on valgrind
==7041== (float) sum PRINT ERROR OF: 0x7FF0000F4
==7041== (float) sum ORIGINAL:          1.00000000000000 * 10^0, 1/120 bit
==7041== (float) sum SHADOW VALUE:      1.00000025000000 * 10^0, 49/120 bit
==7041== (float) sum ABSOLUTE ERROR:    2.50000002921524 * 10^-7, 27/120 bit
==7041== (float) sum RELATIVE ERROR:    2.49999940421539 * 10^-7, 120/120 bit
==7041== (float) sum CANCELED BITS:     0
==7041== (float) sum Last operation: 0x4007AD: main (test_1.c:14)
==7041== (float) sum Operation count (max path): 5
==7041== DUMP GRAPH (test_1_sum.vcg): successful
==7041==
==7041== DUMP GRAPH (valgrind/fpdebug/examples/test_1.out_1_0.vcg): successful
==7041== SHADOW VALUES (valgrind/fpdebug/examples/test_1.out_shadow_values_relative_error_1): successful
==7041== SHADOW VALUES (valgrind/fpdebug/examples/test_1.out_shadow_values_canceled_1): successful
==7041== SHADOW VALUES (valgrind/fpdebug/examples/test_1.out_shadow_values_special_1): successful
==7041== MEAN ERRORS (valgrind/fpdebug/examples/test_1.out_mean_errors_addr_1): successful
==7041== MEAN ERRORS (valgrind/fpdebug/examples/test_1.out_mean_errors_canceled_1): successful
==7041== MEAN ERRORS (valgrind/fpdebug/examples/test_1.out_mean_errors_intro_1): successful

License

FpDebug is Open Source software released under the GNU General Public License, version 2.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.