Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://subversion.renater.fr/anonscm/svn/fullswof-2d
13 April 2021, 17:02:37 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    No releases to show
  • 56f377c
  • /
  • trunk
  • /
  • doc
  • /
  • AppNote
  • /
  • FloatingPoints.tex
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:7a81884e9f74414e880e8d78950eb7bcd6da76ad
origin badgedirectory badge
swh:1:dir:adb5448bcc73f70010b590324950b035caf0325d
origin badgerevision badge
swh:1:rev:f0d2c4ea29c8923198d21ac3f64a48eeae9bfb55
origin badgesnapshot badge
swh:1:snp:0b5ec9ba5beee743d28d9984aa27fdced8d4bc64

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: f0d2c4ea29c8923198d21ac3f64a48eeae9bfb55 authored by fdarboux on 09 July 2020, 15:20:26 UTC
Update of HowtoRelease document
Tip revision: f0d2c4e
FloatingPoints.tex
% !TEX encoding = UTF-8 Unicode
% !TEX spellcheck = en_US

\documentclass[a4paper, 11pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[margin=2cm]{geometry}
\usepackage{enumitem}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[hyphens]{url}
\usepackage{hyperref}



%% Specific commands
% the only place to specify version number (for consistency) - the date is the last modif for the code
\newcommand{\version}{1.04.10 (2014-02-05)}
\newcommand{\FullSWOF}{\emph{FullSWOF\_2D}}
\newcommand{\contactFullName}{Christian \textsc{Laguerre}, Fr\'ed\'eric \textsc{Darboux} and Carine \textsc{Lucas}}
\newcommand{\contactEmail}{ \href{mailto:christian.laguerre@math.cnrs.fr}{christian.laguerre@math.cnrs.fr}, \href{mailto:frederic.darboux@orleans.inra.fr}{frederic.darboux@orleans.inra.fr}, \href{mailto:carine.lucas@univ-orleans.fr}{carine.lucas@univ-orleans.fr}}
\newcommand{\MainWebSite}{\url{https://sourcesup.renater.fr/projects/fullswof-1d/}}
\newtheorem{cl}{Conclusion}

% Headers and footers
\lhead{\FullSWOF{} v\version}
\rhead{MAPMO --- INRA}
\cfoot{\thepage /\pageref{LastPage}}
\pagestyle{fancy}

% Lists: no spacing between items
\setlist{noitemsep}

\title{Improving the accuracy of floating-point computations
in~\FullSWOF{}.}

\author{\contactFullName\\ \contactEmail}
\date{2014-02-05} % Last modif for the note

\begin{document}

\maketitle

\thispagestyle{fancy}

This report contains a study of the influence of compiler options on the benchmark results.\\ 
It is similar to the report \texttt{Floating\_Points.pdf} (\url{https://sourcesup.renater.fr/docman/?group_id=877&view=listfile&dirid=1052}) which was performed on the software \emph{\textit{FullSWOF\_1D}}.
 Indeed, when running the 8~benchmarks of \emph{\textit{FullSWOF\_2D}} on several computers, we noticed differences in the results for one benchmark: the bump at rest. 
Performing some further testing, we also uncover some problems of symmetry: for example, inverting the geometry of the dam break from left-to-right to right-to-left did more than simply inverted the results.

These differences originated from approximations in the floating-point computations, and these approximations depended on the computer. After a diagnosis phase, various changes were made, both in the code and in the compiler options. In this report, we run \FullSWOF{} to determine the impact of these changes.

\section*{Testing \& Changes}

The first change we made was to replace each $x^2-y^2$ by $(x-y)(x+y)$. This modification affected the main part of the numerical scheme (see \texttt{scheme.cpp})
for the time evolution of the discharge and some fluxes. 
It is well-known that this way of computing reduces floating-point errors. 
For more details, we refer to \url{http://www.codeproject.com/Articles/29637/Five-Tips-for-Floating-Point-Programming}
and references therein. 

In order to solve symmetry problems, we had to use long doubles in some parts of the code. Namely, 
a computation with long double is now done in \FullSWOF{} in \texttt{hll.cpp}, \texttt{muscl.cpp}, \texttt{scheme.cpp}.
Moreover, the compilation option \texttt{-ffloat-store} was added. 

Let us study the influence of these changes on the results. In the following, we make a distinction between a 64-bit computer  and a 32-bit computer under Linux Ubuntu.
GNU C++ was used in both cases.

Only one out of the eight benchmarks differed depending on the float type and compilation option: the bump at rest. 
This test case involves very small perturbations of water height, and null velocities, so this may explain the difficulties to catch the analytic solution.

This study (see tables~\ref{Mac}-\ref{Linux}) shows that each long double is necessary to obtain results exactly identical to the reference solution. 
Moreover, it points out that the \texttt{-ffloat-store} option improves the result accuracy but roughly doubles the computation time. 
However, excepted for some specific points and output variables (especially the Froude number), most of differences were relatively small.

\section*{Conclusions \& Recommendations}

\begin{itemize}
\item There are still differences whether you run \FullSWOF{} under a 32-bit or a 64-bit operating system.

\item The option \texttt{-ffloat-store} helps in obtaining accurate results for very small water heights. This is useful in order to compare the numerical results with analytic solutions. 
But if you want to compare the numerical results with experimental results, you can remove this option to save computation time, especially if very shallow flows are not involved.
In particular, you should keep in mind that this option is very time consuming and you must balance the accuracy versus the computation time. 

\item Other improvements could be done. Do not hesitate to suggest modifications!

\item Currently, only the HLL and the MUSCL reconstruction have been tested and modified. Tests should also be done for the other fluxes and reconstructions. 
\end{itemize}


\begin{table}[htbp]
\begin{tabular}{ccccccc}
\hline
& & & & & Difference& Computation \\
Experiment & Long double & Long double & Long double & -ffloat&with reference& time (Mega\\
number & HLL & MUSCL & scheme & -store&  (bump at rest)  & clock ticks)  \\
& & & & & & \\
\hline
reference & yes & yes & yes &yes &&467\\
1 & no & yes & yes &yes & yes&428\\
2 & no & yes & yes &no & yes =1&192\\
3 & yes & no & yes &yes &no&470\\
4 & yes & no & yes &no &no&200\\
5 & yes & yes & no &yes &yes&444\\
6 & yes & yes & no &no &yes =5&199\\
7 & yes & yes & yes &no &no&197\\
\hline
\end{tabular}
\caption{Linux - 64 bits}
\label{Mac}
\end{table}

\begin{table}[htbp]
\begin{tabular}{ccccccc}
\hline
& & & & & Difference& Computation \\
Experiment & Long double & Long double & Long double & -ffloat&with reference& time (Mega\\
number & HLL & MUSCL & scheme & -store&  (bump at rest)  & clock ticks)  \\
& & & & & & \\
\hline
reference & yes & yes & yes &yes && 977\\
1 & no & yes & yes &yes & yes& 919\\
2 & no & yes & yes &no & yes& 520\\
3 & yes & no & yes &yes &no&987\\
4 & yes & no & yes &no &yes& 482\\
5 & yes & yes & no &yes &yes& 964\\
6 & yes & yes & no &no &yes&457\\
7 & yes & yes & yes &no &yes =6& 465\\
\hline
\end{tabular}
\caption{Linux - 32 bits}
\label{Linux}
\end{table}
\end{document}

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API