Skip to content

Commit

Permalink
Merge branch 'development' into 'master'
Browse files Browse the repository at this point in the history
Release v1.0.1

See merge request keszocze/aarith!93
  • Loading branch information
Oliver Keszoecze committed Feb 27, 2022
2 parents d1e4a43 + c45a6cc commit 22bbdb9
Show file tree
Hide file tree
Showing 58 changed files with 2,592 additions and 1,017 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Checks:
'*,-llvm-else-after-return,-readability-else-after-return,-fuchsia-trailing-return,-fuchsia-default-arguments-declarations,-fuchsia-default-arguments,-hicpp-use-auto,-modernize-use-auto,-modernize-use-trailing-return-type,-fuchsia-overloaded-operator,-fuchsia-default-arguments-calls,-llvm-header-guard,-llvmlibc-*'
'*,-bugprone-easily-swappable-parameters,-llvm-else-after-return,-readability-else-after-return,-fuchsia-trailing-return,-fuchsia-default-arguments-declarations,-fuchsia-default-arguments,-hicpp-use-auto,-modernize-use-auto,-modernize-use-trailing-return-type,-fuchsia-overloaded-operator,-fuchsia-default-arguments-calls,-llvm-header-guard,-altera-*,-llvmlibc-*'
WarningsAsErrors: ''
HeaderFilterRegex: '.'
...
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=${{ matrix.compiler }}
cmake $GITHUB_WORKSPACE -DUSE_CLANGTIDY=OFF -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=${{ matrix.compiler }}
- name: Build
working-directory: ${{github.workspace}}/build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=${{ matrix.compiler }}
cmake $GITHUB_WORKSPACE -DUSE_CLANGTIDY=OFF -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=${{ matrix.compiler }}
- name: Build
working-directory: ${{github.workspace}}/build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: |
cmake $GITHUB_WORKSPACE -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=$BUILD_TYPE
cmake $GITHUB_WORKSPACE -DUSE_CLANGTIDY=OFF -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=$BUILD_TYPE
- name: Build
working-directory: ${{github.workspace}}/build
Expand Down
22 changes: 2 additions & 20 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ variables:
GIT_DEPTH: 0
GIT_SUBMODULE_STRATEGY: recursive
MPIR_PARAMS: "-DMPIR_INCLUDE_DIR=/opt/software/usr/local/include -DMPIR_LIBRARIES=/opt/software/usr/local/lib/libmpir.a"
BUILD_PARAMS: "-DBUILD_BENCHMARKS=OFF -DBUILD_TESTS=ON -DUSE_FULL_RANGE_IN_TESTS=OFF -DBUILD_EXAMPLES=ON -DBUILD_EXPERIMENTS=ON -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DBENCHMARK_ENABLE_TESTING=OFF"
BUILD_PARAMS: "-DUSE_CLANGTIDY=OFF -DBUILD_BENCHMARKS=OFF -DBUILD_TESTS=ON -DUSE_FULL_RANGE_IN_TESTS=OFF -DBUILD_EXAMPLES=ON -DBUILD_EXPERIMENTS=ON -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DBENCHMARK_ENABLE_TESTING=OFF"

stages:
- compile
Expand All @@ -27,7 +27,7 @@ compile_gcc:
- echo ${BUILD_PARAMS}
- echo ${MPIR_PARAMS}
- CC=gcc-9 CXX=g++-9 cmake ${BUILD_PARAMS} ${MPIR_PARAMS} ../..
- /opt/sonar-build-wrapper/build-wrapper-linux-x86-64 --out-dir bw_output make -j $(nproc) all
- make -j $(nproc) all

compile_clang:
extends: .ciconf
Expand All @@ -44,24 +44,6 @@ compile_clang:
- CC=clang-9 CXX=clang++-9 cmake ${BUILD_PARAMS} ${MPIR_PARAMS} ../..
- make -j $(nproc)

.run_sonarqube:
extends: .ciconf
stage: quality
variables:
GIT_STRATEGY: none
dependencies:
- test_gcc
needs:
- test_gcc
script:
- echo $CI_COMMIT_REF_NAME
- chmod +x scripts/mk_sonar_config.sh
- scripts/mk_sonar_config.sh $CI_COMMIT_REF_NAME > sonar-project.properties
- scripts/mk_sonar_config.sh $CI_COMMIT_REF_NAME
- ls .
- ls build
- /opt/sonar-scanner/bin/sonar-scanner


test_clang:
extends: .ciconf
Expand Down
17 changes: 16 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,22 @@ option(BUILD_CORRECTNESS_EXPERIMENTS "build correctness experiments" OFF)
option(BUILD_TESTS "build tests" ON)
option(BUILD_EXAMPLES "build examples" ON)
option(BUILD_DOCUMENTATION "Build documentation" OFF)
option(USE_CLANGTIDY "Use clang-tidy" OFF)
option(USE_CLANGTIDY "Use clang-tidy" ON)

set(default_build_type "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release")
endif()

if (USE_CLANGTIDY)
set(CMAKE_CXX_CLANG_TIDY "clang-tidy")
endif()


list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/lib")
find_package(MPIR)
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ To make usage of Aarith more convenient, the following type aliases are shipped
```c++
using half_precision = floating_point<5, 10, uint64_t>;
using single_precision = floating_point<8, 23, uint64_t>;
using double_precison = floating_point<11, 52, uint64_t>;
using double_precision = floating_point<11, 52, uint64_t>;
using quadruple_precision = floating_point<15, 112, uint64_t>;
using bfloat16 = floating_point<8, 7, uint64_t>;
using tensorfloat32 = floating_point<8, 10, uint64_t>;
Expand Down
4 changes: 4 additions & 0 deletions docs/api/core/traits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ Type Traits

**Header** ``aarith/core/traits.hpp``

Unfortunately, adding specializations for type traits such as ``is_integral`` `is undefined <https://en.cppreference.com/w/cpp/types/is_integral>`_.

Hence we copy the relevant traits into the ``aarith`` namespace.

.. doxygenfile:: traits.hpp
4 changes: 3 additions & 1 deletion docs/api/float/class.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Flaoting-Point Numbers
Floating-Point Numbers
======================

.. _floating_point:

**Header** ``aarith/float/floating_point.hpp``

The template class ``floating_point`` represents a floating-point number of arbitrary, but compile-time static precision.
Expand Down
34 changes: 0 additions & 34 deletions docs/api/integer.rst

This file was deleted.

16 changes: 16 additions & 0 deletions docs/api/integer/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Two's Complement Integers
=========================

**Header** ``aarith/integer/integers.hpp``

The template classes ``integer`` and ``uinteger`` represent signed and unsigned integers of arbitrary,
but compile-time static, precision stored in two's complement format

The aarith integers exhibit the usual overflow/underflow behavior (i.e. modulo 2^n) which is ``not`` undefined behavior!

.. doxygenclass:: aarith::uinteger
:members:


.. doxygenclass:: aarith::integer
:members:
6 changes: 6 additions & 0 deletions docs/api/integer/comparisons.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Comparison Operations
=====================

**Header** ``aarith/integer/integer_comparisons.hpp``

.. doxygenfile:: integer_comparisons.hpp
7 changes: 7 additions & 0 deletions docs/api/integer/operations.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Arithmetic & Logic Operations
=============================

**Header** ``aarith/integer/integer_operations.hpp``


.. doxygenfile:: integer_operations.hpp
14 changes: 14 additions & 0 deletions docs/approx/anytime.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Anytime Instructions
====================

See [Brand2019]_ and [Brand2020]_ for details.

**Header** ``aarith/float/float_approx_operations.hpp``

.. doxygenfunction:: anytime_add

.. doxygenfunction:: anytime_sub

.. doxygenfunction:: anytime_mul

.. doxygenfunction:: anytime_div
30 changes: 30 additions & 0 deletions docs/approx/fau.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
The FAU Adder
=============

When computing with unsigned integers
-------------------------------------

The FAU adder is an adder that speed up the computation of the sum by splitting the carry chain.
In order to keep the error small, some bits of the least-significant part are used in a carry prediction
unit.

See :ref:`the uses cases <fau_adder>` and [Echavarria2016]_ for details.

**Header** ``aaarith/integer/integer_approx_operations.hpp``

.. doxygenfunction:: FAUadder

.. doxygenfunction:: FAUsubtractor


When computing with floating_points
-----------------------------------

The FAU adder can also be used when computing with :ref:`floating_point <floating_point>` numbers. Here, the FAU adder
ist used to approximately compute the mantissa.

**Header** ``aaarith/float/float_approx_operations.hpp``

.. doxygenfunction:: FAU_add

.. doxygenfunction:: FAU_sub
28 changes: 28 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Changelog
=========

v1.0.1 -- 27.02.2022
-------------

**Added:**

* Add specializations for ``std::numeric_limits`` for the ``aarith::floating_point`` numbers
* Add a constructor for ``aarith::word_array`` that takes a bit string as a parameter
* Add a constructor for ``aarith::floating_point`` that takes a bit string as a parameter
* Switched to Apache 2 license

**Changed:**

* Update to Catch2 v2.13.18

**Removed:**

**Fixed:**

v1.0.0 -- 15.03.2021
--------------------

First public release of Aarith containing

* Signed and unsigned arbitrary precision Two's Complement integers
* Arbitrary precision (for the exponent and mantissa) IEEE 754 floating-point like floating-point numbers
13 changes: 10 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ Aarith currently supports
usecases
philosophy
literature
changelog


.. toctree::
:maxdepth: 1
:caption: Integers

api/integer
api/integer/class
api/integer/operations
api/integer/comparisons

.. toctree::
:maxdepth: 1
Expand All @@ -45,12 +48,17 @@ Aarith currently supports
api/float/comparisons
api/float/utilities

.. toctree::
:maxdepth: 1
:caption: Approximate Computing

approx/anytime
approx/fau


Publication
-----------


If you use Aarith (e.g., in your publication), please cite

Oliver Keszocze, Marcel Brand, Christian Heidorn, und Jürgen Teich. „Aarith: An Arbitrary Precision Number Library“,
Expand All @@ -71,7 +79,6 @@ Bibtex:




.. toctree::
:maxdepth: 1
:caption: Core & Utilities
Expand Down
7 changes: 6 additions & 1 deletion docs/literature.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ Literature
series = {{{SAC}}'21}
}
.. [Brand2020] Brand, M., Witterauf, M., Bosio, A., & Teich, J. (2020, July). `Anytime Floating-Point Addition and Multiplication-Concepts and Implementations <https://ieeexplore.ieee.org/abstract/document/9153237>`_. In 2020 IEEE 31st International Conference on Application-specific Systems, Architectures and Processors (ASAP) (pp. 157-164). IEEE.
.. [Brand2019] Brand, M., Witterauf, M., Hannig, F., & Teich, J. (2019, April). `Anytime instructions for programmable accuracy floating-point arithmetic <https://dl.acm.org/doi/abs/10.1145/3310273.3322833>`_. In Proceedings of the 16th ACM International Conference on Computing Frontiers (pp. 215-219).
.. [Burgess2019] Burgess, N., Milanovic, J., Stephens, N., Monachopoulos, K., & Mansell, D. (2019, June). `Bfloat16 processing for neural networks <https://ieeexplore.ieee.org/abstract/document/8877390/>`_. In 2019 IEEE 26th Symposium on Computer Arithmetic (ARITH) (pp. 88-91). IEEE.
.. [IEEE754] `754-2019 - IEEE Standard for Floating-Point Arithmetic <https://ieeexplore.ieee.org/document/8766229>`_
.. [Echavarria2016] Echavarria, J., Wildermann, S., Becher, A., Teich, J., & Ziener, D. (2016, December). `Fau: Fast and error-optimized approximate adder units on lut-based fpgas <https://ieeexplore.ieee.org/abstract/document/7929536/>`_. In 2016 International Conference on Field-Programmable Technology (FPT) (pp. 213-216). IEEE.
.. [Echavarria2016] Echavarria, J., Wildermann, S., Becher, A., Teich, J., & Ziener, D. (2016, December). `Fau: Fast and error-optimized approximate adder units on lut-based fpgas <https://ieeexplore.ieee.org/abstract/document/7929536/>`_. In 2016 International Conference on Field-Programmable Technology (FPT) (pp. 213-216). IEEE.
8 changes: 0 additions & 8 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
if (USE_CLANGTIDY)
set(CMAKE_CXX_CLANG_TIDY "clang-tidy")
endif()

cmake_minimum_required(VERSION 3.13)



add_executable(sqrt_example sqrt.cpp)
target_link_libraries(sqrt_example aarith::Library)

Expand Down
2 changes: 1 addition & 1 deletion examples/fau_adder.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <aarith/integer/approx_operations.hpp>
#include <aarith/integer/integer_approx_operations.hpp>
#include <aarith/integer_no_operators.hpp>

using namespace aarith;
Expand Down
2 changes: 1 addition & 1 deletion examples/invert.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <aarith/float.hpp>
#include <aarith/float/approx_operations.hpp>
#include <aarith/float/float_approx_operations.hpp>
#include <cmath>

using namespace aarith;
Expand Down
2 changes: 1 addition & 1 deletion examples/sqrt.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <aarith/float.hpp>
#include <aarith/float/approx_operations.hpp>
#include <aarith/float/float_approx_operations.hpp>
#include <cmath>

using namespace aarith;
Expand Down
2 changes: 1 addition & 1 deletion experiments/eval_approximations.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <aarith/float.hpp>
#include <aarith/float/approx_operations.hpp>
#include <aarith/float/float_approx_operations.hpp>
#include <aarith/integer.hpp>
#include <chrono>
#include <cmath>
Expand Down
2 changes: 1 addition & 1 deletion experiments/eval_fau_adder.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <aarith/integer.hpp>
#include <aarith/integer/approx_operations.hpp>
#include <aarith/integer/integer_approx_operations.hpp>
#include <sstream>

#include "../tests/integer/fau_adder.hpp"
Expand Down
2 changes: 1 addition & 1 deletion experiments/heron_anytime.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <aarith/float.hpp>
#include <aarith/float/approx_operations.hpp>
#include <aarith/float/float_approx_operations.hpp>
#include <chrono>
#include <cmath>
#include <iomanip>
Expand Down

0 comments on commit 22bbdb9

Please sign in to comment.