Skip to content

Commit

Permalink
Merge branch 'yohanchatelain-interflop'
Browse files Browse the repository at this point in the history
  • Loading branch information
yohanchatelain committed May 10, 2024
2 parents 2c8d5c9 + 8ac7be5 commit 0f1bb25
Show file tree
Hide file tree
Showing 191 changed files with 87,367 additions and 5,535 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
**/#*
**/.DS_Store
**/Makefile
*.in
**/Makefile.in
verificarlo
src/vfcwrapper/vfcwrapper.c
configure
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "src/tools/sigdigits"]
path = src/tools/sigdigits
url = https://github.com/verificarlo/significantdigits
27 changes: 13 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ARG GCC_VERSION=7
ARG GCC_PATH=/usr/lib/gcc/x86_64-linux-gnu/${GCC_VERSION}
ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
ENV PATH /usr/local/bin:$PATH
ENV PYTHONPATH /usr/local/lib/python$PYTHON_VERSION/site-packages/:$PYTHONPATH
ENV PYTHONPATH /usr/local/lib/python${PYTHON_VERSION}/site-packages/:${PYTHONPATH}

# Retrieve dependencies
RUN apt-get -y update && apt-get -y --no-install-recommends install tzdata
Expand All @@ -22,34 +22,33 @@ RUN apt-get -y install --no-install-recommends \
clang-${LLVM_VERSION} llvm-${LLVM_VERSION} llvm-${LLVM_VERSION}-dev \
gcc-${GCC_VERSION} g++-${GCC_VERSION} \
gfortran-${GCC_VERSION} libgfortran-${GCC_VERSION}-dev flang \
python3 python3-pip python3-numpy python3-pandas python3-matplotlib python3-dev cython3 \
parallel && \
python3 python3-pip python3-dev cython3 parallel && \
rm -rf /var/lib/apt/lists/*

WORKDIR /build/

ENV LIBRARY_PATH ${GCC_PATH}:$LIBRARY_PATH

# Install other Python dependencies (not available with apt-get) via pip
RUN ln -s /usr/bin/x86_64-linux-gnu-gcc-7 /usr/bin/x86_64-linux-gnu-gcc && \
pip3 install --upgrade pip && \
pip3 install scipy && \
pip3 install GitPython && \
pip3 install bigfloat && \
pip3 install tables && \
pip3 install jinja2 && \
pip3 install bokeh
RUN ln -s /usr/bin/x86_64-linux-gnu-gcc-7 /usr/bin/x86_64-linux-gnu-gcc

# Download and configure verificarlo from git master
ENV AR=gcc-ar-${GCC_VERSION}
ENV RANLIB=gcc-ranlib-${GCC_VERSION}
ENV CC=gcc-${GCC_VERSION}
ENV CXX=g++-${GCC_VERSION}
COPY . /build/verificarlo/
WORKDIR /build/verificarlo
RUN ./autogen.sh && \
./configure --with-llvm=$(llvm-config-${LLVM_VERSION} --prefix) \

RUN ./install-interflop.sh && \
./autogen.sh && \
./configure \
--with-llvm=$(llvm-config-${LLVM_VERSION} --prefix) \
--with-flang CC=gcc-${GCC_VERSION} CXX=g++-${GCC_VERSION} \
|| cat config.log

# Build verificarlo
RUN make && make install
RUN make && make install

# Setup working directory
VOLUME /workdir
Expand Down
5 changes: 5 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ACLOCAL_AMFLAGS=-I m4
SUBDIRS=src/

dist_bin_SCRIPTS=verificarlo verificarlo-c verificarlo-f verificarlo-c++

edit_script = $(SED) -e 's,%LIBDIR%,$(libdir),'g $(NULL)
Expand All @@ -24,6 +25,10 @@ CLEANFILES = verificarlo
check:
@echo "Tests should be run after install with make installcheck"

install-exec-hook:
$(PYTHON) -m pip install . && \
echo "Run 'source $(setenvdir)/set-env' to set environment variables"

installcheck:
# Run tests
# When successful print simple message
Expand Down
6 changes: 3 additions & 3 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
autoreconf -is

rm -rf src/tools/sigdigits/
git submodule update --init --recursive
mkdir -p m4
cp $(interflop-config --m4dir)/*.m4 m4/
autoreconf -is
42 changes: 8 additions & 34 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ AC_CHECK_HEADERS([mpfr.h], [],
# Reset libs after ac_check_lib We do not want each and every backend or the
# libvfcinstrument frontend to be linked against libgfortran for
# example. -l flags should be added individually in each Makefile.am

LIBS=""

# Check for header files.
Expand Down Expand Up @@ -187,49 +188,22 @@ else
AC_MSG_ERROR([could not find python 2.7 or higher])])
fi

# Check for Python modules
AX_PYTHON_MODULE(numpy, fatal)
AX_PYTHON_MODULE(bigfloat)
AX_PYTHON_MODULE(pandas, fatal)
AX_PYTHON_MODULE(tables, fatal)
AX_PYTHON_MODULE(scipy, fatal)
AX_PYTHON_MODULE(git, fatal)
AX_PYTHON_MODULE(jinja2, fatal)
AX_PYTHON_MODULE(bokeh, fatal)


AC_ARG_ENABLE(wall, AC_HELP_STRING([--enable-wall], [Enable -Wall compilation flag]), [WALL_CFLAGS="yes"])
AM_CONDITIONAL([WALL_CFLAGS], [test "x$WALL_CFLAGS" = "xyes"])
if test "x$WALL_CFLAGS" = "xyes"; then
AC_DEFINE([WALL_CFLAGS], [], ["Enable -Wall compilation flag"])
AC_MSG_NOTICE([-Wall is set])
fi
AX_WARNINGS()
AX_INTERFLOP_STDLIB()

# Generate config files

AC_CONFIG_FILES([Makefile
src/Makefile
src/common/Makefile
src/common/rng/Makefile
src/libvfcinstrument/Makefile
src/libvfcfuncinstrument/Makefile
src/vfcwrapper/Makefile
src/tools/Makefile
src/tools/ci/Makefile
src/tools/ci/vfc_ci_report/Makefile
src/tools/ci/vfc_ci_report/templates/Makefile
src/tools/ci/vfc_ci_report/static/Makefile
src/tools/ci/workflow_templates/Makefile
src/backends/Makefile
src/backends/interflop-ieee/Makefile
src/backends/interflop-mca/Makefile
src/backends/interflop-mca-int/Makefile
src/backends/interflop-cancellation/Makefile
src/backends/interflop-bitmask/Makefile
src/backends/interflop-vprec/Makefile
tests/Makefile
tests/paths.sh
])

AC_CONFIG_FILES([verificarlo.in])
AC_CONFIG_FILES([verificarlo.in
tests/paths.sh
src/vfcwrapper/main.c
],
[chmod +x tests/paths.sh])
AC_OUTPUT
72 changes: 72 additions & 0 deletions install-interflop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash

REPO=interflop
ROOT=$PWD

function check() {
if [[ $? != 0 ]]; then
echo "Error"
exit 1
fi
}

function Clone() {
git clone $1
check
}

function Cd() {
cd $1
check
}

function Autogen() {
./autogen.sh
check
}

function Configure() {
./configure $@
check
}

function Make() {
make
check
}

function MakeInstall() {
make install
check
}

function install_stdlib() {
Cd src/interflop-stdlib
Autogen
Configure --enable-warnings
Make
MakeInstall
Cd ${ROOT}
}

function install_backend() {
Cd src/backends/interflop-backend-$1
Autogen
Configure --enable-warnings
Make
MakeInstall
Cd ${ROOT}
}

# rm -rf src/interflop-stdlib
# rm -rf src/backends/interflop-backend-*
# git submodule update --init --recursive

install_stdlib

backends=(bitmask cancellation ieee mcaint mcaquad vprec)
for backend in ${backends[@]}; do
install_backend $backend
done

export LD_LIBRARY_PATH=$(interflop-config --libdir):$LD_LIBRARY_PATH
62 changes: 62 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[build-system]
requires = ["hatchling", "pathspec"]
build-backend = "hatchling.build"

[project]
name = "verificarlo"
version = "0.9.1"
description = "A tool for debugging and assessing floating point precision and reproducibility."
authors = [
{ name = "Verificarlo contributors", email = "[email protected]" },
]
readme = "README.md"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
]
license = { file = "COPYING" }
dependencies = [
"numpy>=1.19",
"bigfloat",
"pandas",
"tables",
"scipy",
"GitPython",
"jinja2",
"bokeh",
"significantdigits>=0.1.2",
]

[tool.hatch.build]
include = [
"src/tools/ddebug/*.py",
"src/tools/ci/*.py",
"src/tools/ci/vfc_ci_report/*.py",
"src/tools/ci/vfc_ci_report/templates/index.html",
"src/tools/ci/vfc_ci_report/static/index.js",
"src/tools/ci/vfc_ci_report/workflow_templates/*.md",
"src/tools/ci/vfc_ci_report/workflow_templates/*.yml",
]

[tool.hatch.build.sources]
"src/tools" = "verificarlo"
"src/tools/ddebug" = "verificarlo/"
"src/tools/ci" = "verificarlo/ci"
"src/tools/ci/vfc_ci_report" = "verificarlo/ci/vfc_ci_report"
"src/tools/ci/vfc_ci_report/workflow_templates" = "verificarlo/ci/vfc_ci_report/workflow_templates"
"src/tools/ci/vfc_ci_report/static" = "verificarlo/ci/vfc_ci_report/static"


[tool.hatch.build.targets.verificarlo]
packages = ["src/tools/ddebug", "src/tools/ci"]

[project.scripts]
vfc_ddebug = "verificarlo.ddebug.main:main"
vfc_ci = "verificarlo.ci.__main__:main"
vfc_precexp = "verificarlo.optimize.precexp:main"
vfc_report = "verificarlo.optimize.report:main"
vfc_vtk = "verificarlo.vtk.__main__:main"

[project.urls]
"Bug Tracker" = "https://github.com/verificarlo/verificarlo/issues"
4 changes: 2 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
SUBDIRS=common libvfcfuncinstrument libvfcinstrument backends vfcwrapper tools
include_HEADERS=common/interflop.h common/vfc_hashmap.h common/vfc_probes.h
SUBDIRS=common libvfcfuncinstrument libvfcinstrument vfcwrapper
include_HEADERS= common/vfc_probes.h
1 change: 0 additions & 1 deletion src/backends/Makefile.am

This file was deleted.

51 changes: 51 additions & 0 deletions src/backends/interflop-backend-bitmask/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
ACLOCAL_AMFLAGS=-I m4
lib_LTLIBRARIES = libinterflop_bitmask.la libinterflop_bitmask_no-tls.la

if ENABLE_LTO
LTO_FLAGS = -flto
else
LTO_FLAGS =
endif

if ENABLE_WARNINGS
WARNING_FLAGS = -Wall -Wextra -Wno-varargs
else
WARNING_FLAGS =
endif

# Backend version with TLS enabled
libinterflop_bitmask_la_SOURCES = interflop_bitmask.c

libinterflop_bitmask_la_CFLAGS = \
-I@INTERFLOP_INCLUDEDIR@ \
-fno-stack-protector $(LTO_FLAGS) -O3 \
-DRNG_THREAD_SAFE \
$(LTO_FLAGS) -O3 \
$(WARNING_FLAGS)

libinterflop_bitmask_la_LDFLAGS = $(LTO_FLAGS) -O3

libinterflop_bitmask_la_LIBADD = \
@INTERFLOP_LIBDIR@/libinterflop_rng.la \
@INTERFLOP_LIBDIR@/libinterflop_fma.la \
@INTERFLOP_LIBDIR@/libinterflop_logger.la \
@INTERFLOP_LIBDIR@/libinterflop_stdlib.la

# Backend version with TLS disabled
libinterflop_bitmask_no_tls_la_SOURCES = interflop_bitmask.c

libinterflop_bitmask_no_tls_la_CFLAGS = \
-I@INTERFLOP_INCLUDEDIR@ \
-fno-stack-protector $(LTO_FLAGS) -O3 \
$(LTO_FLAGS) -O3 \
$(WARNING_FLAGS)

libinterflop_bitmask_no_tls_la_LIBADD = \
@INTERFLOP_LIBDIR@/libinterflop_rng.la \
@INTERFLOP_LIBDIR@/libinterflop_fma.la \
@INTERFLOP_LIBDIR@/libinterflop_logger.la \
@INTERFLOP_LIBDIR@/libinterflop_stdlib.la

includesdir=$(includedir)/interflop
includes_HEADERS= interflop_bitmask.h

5 changes: 5 additions & 0 deletions src/backends/interflop-backend-bitmask/autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

mkdir -p m4
cp $(interflop-config --m4dir)/*.m4 m4/
autoreconf -is
21 changes: 21 additions & 0 deletions src/backends/interflop-backend-bitmask/configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
AC_INIT([interflop-backend-verrou],[1.0],[[email protected]])
AM_SILENT_RULES([yes])
AC_CONFIG_AUX_DIR(autoconf)
AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign])
AC_CONFIG_MACRO_DIRS([m4])
AC_PROG_CC
AC_PROG_CXX
AM_PROG_AR
AC_CONFIG_HEADERS([config.h])
LT_INIT
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

AX_WARNINGS()
AX_LTO()
AX_INTERFLOP_STDLIB()
AX_INTERFLOP_RNG()

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Loading

0 comments on commit 0f1bb25

Please sign in to comment.