Skip to content

Using the sleef backend for SIMD mathematical functions

Roman edited this page Oct 12, 2020 · 2 revisions

Sleef backend for SIMD mathematical functions

Fastor is a stand-alone library and does not depend on any external library for it's mathematical functions. However, given that Fastor's primary focus is on speeding up operations on small tensors, it also provides switching backeneds to sleef and MKL JIT for fast SIMD mathematical functions if need be. This is specifically useful in cases where performance portability is important.

To activate sleef backend, you need to first download and build sleef as a static or dynamic shared library and then compile your Fastor's code by issuing -DFASTOR_USE_SLEEF flag to the compiler. You then need to link to sleef as -L/path/to/sleef/lib/ -lsleef. Fastor will automatically switch to sleef for all mathematical functions.

Based on your requirement, you can also choose to use the ULP35 -DFASTOR_USE_SLEEF_U35 or ULP10 -DFASTOR_USE_SLEEF_U10 variants of the sleef functions. The default switch -DFASTOR_USE_SLEEF activates ULP10. If you want faster execution times you should use -DFASTOR_USE_SLEEF_U35.