shibatch / sleef

SIMD Library for Evaluating Elementary Functions, vectorized libm and DFT
https://sleef.org
Boost Software License 1.0
669 stars 132 forks source link
aarch64 android arm avx avx512 cuda elementary-functions fft ios math-library neon powerpc quadruple-precision s390x simd sse2 sve vector-math vectorization vsx

SLEEF

DOI:10.1109/TPDS.2019.2960333 License CMake Spack SourceForge Downloads

SLEEF is a library that implements vectorized versions of C standard math functions. This library also includes DFT subroutines.

Supported environment

Test matrix

The following table summarises currently supported vector extensions, compilers and OS-es.

:green_circle: : Tested extensively in CI.

:yellow_circle: : Tested partially in CI.

:x: : Currently failing some tests in CI.

:white_circle: : Not tested in CI. Might have passed tests in previous CI framework.

This issue tracks progress on improving test coverage. Compilation of SLEEF on previously supported environments might still be safe, we just cannot verify it yet.

OS/Compiler
Linux

macOS

Windows


Arch. Vector Extensions gccllvmicc gccllvm gccllvm-gnullvm-msvcmsvc
x86_64SSE2, SSE4,
AVX, AVX2, AVX512F
:green_circle::green_circle::white_circle: :white_circle::green_circle: :white_circle::yellow_circle::white_circle::white_circle:
x86 32bit
(i386)
SSE :white_circle::white_circle::white_circle: N/A :white_circle::white_circle::white_circle::white_circle:
AArch64
(arm)
Neon, SVE :green_circle::green_circle:N/A N/A:green_circle: N/A:white_circle::white_circle::white_circle:
AArch32
(armhf)
NEON :green_circle::green_circle:N/A N/A N/A
PowerPC
(ppc64el)
VSX, VSX3 :green_circle::green_circle:N/A N/A N/A
IBM/Z
(s390x)
VXE, VXE2 :green_circle::green_circle:N/A N/A N/A
RISC-V
(riscv64)
RVV1, RVV2 :green_circle::green_circle:N/A N/A N/A

Component support

The above table is valid for libm in single, double and quadruple precision, as well as fast Discrete Fourier Transform (DFT).

Generation of inline headers is also supported for most vector extensions.

LTO is not tested in CI yet, except on Windows.

Compiler support

Results are displayed for gcc 14 and llvm 17, the compiler versions used in CI tests with GitHub Actions.

Older versions should be supported too, while newer ones are either not tested or have known issues.

Some compiler versions simply do not support certain vector extensions, for instance SVE is only supported for gcc version 9 onwards.

Similarly, the RISC-V interface in SLEEF is based on version 1.0 of the intrinsics, which is only supported from llvm version 17 and gcc version 14 onwards.

Toolchain files provide some information on supported compiler versions.

OS support

Only Linux distributions and macOS are fully tested in CI and thus officially supported.

Only AArch64 and x86_64 vector extensions are built and tested natively on Linux and macOS. Other architectures/vector extensions are cross-compiled on Linux.

Native AArch64 tests on Linux are using gcc 11 (default in Ubuntu 22.04), while native x86_64 and cross-compiled tests use gcc 14.

Building SLEEF for Windows on x86 machines was officially supported ( :white_circle: ), as of 3.5.1, however it is only partially tested due to known limitations of the test suite with MinGW or MSYS2. As a result tests for Windows on x86 only include DFT for now (other tests are disabled in build system), but all components are built.

Support for iOS and Android is only preliminary on AArch64.

SVE is not supported on Darwin-based system and therefore automatically disabled by SLEEF on Darwin.

More on supported environment

Refer to our web page for more on supported environment.

Install SLEEF dependencies

The library itself does not have any additional dependency.

However some tests require:

These tests can be disabled if necessary.

How to build SLEEF

We recommend relying on CMake as much as possible in the build process to ensure portability. CMake 3.18+ is the minimum required.

  1. Check out the source code from our GitHub repository
git clone https://github.com/shibatch/sleef
  1. Make a separate directory to create an out-of-source build
cd sleef && mkdir build
  1. Run cmake to configure the project
cmake -S . -B build

By default this will generate shared libraries. In order to generate static libraries, pass option -DBUILD_SHARED_LIBS=OFF.

For more verbose output add option -DSLEEF_SHOW_CONFIG=ON.

  1. Run make to build the project
cmake --build build -j --clean-first
  1. Run tests using ctests
ctest --test-dir build -j

For more detailed build instructions please refer to the dedicated section on CMake or to our web page.

Install SLEEF

From source

Assuming following instructions were followed.

  1. Install to specified directory <prefix>
cmake --install build --prefix=<prefix>

Using Spack

SLEEF can also be directly installed using Spack.

spack install sleef@master

Uninstall

In order to uninstall SLEEF library and headers run

sudo xargs rm -v < build/install_manifest.txt

License

The software is distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt. Contributions to this project are accepted under the same license.

Copyright © 2010-2024 SLEEF Project, Naoki Shibata and contributors.