Backend Selection

Warning

This is an advanced topic that may affect application performance or even lead to mysterious crashes. This section is meant for educational purposes and for those who wish to dig a little deeper.

The C++ library makes extensive use of AVX-512 instructions both in the form of direct intrinsics and through the EVE SIMD library. Along with design decisions around generic programming and static dimensionality, this makes it quite difficult to surgically extract the portions of the library that are accelerated by these instructions. In order to support multiple CPU micro-architectures including those that lack AVX-512 support, we instead ship multiple versions of the backing shared library, each targeting a different micro-architecture. At run-time, the pysvs Python module tries to select the best backend for the current CPU.

There are several environment variables that can be set prior to loading the library that can influence this behavior.

  • PYSVS_QUIET=YES

    The pysvs loading logic may emit warnings when loading the backend. This can occur either when the loaded backend is targeting an old architecture and may have poor performance, or when the selection logic is explicitly bypassed and the resulting backend may not be compatible with the current CPU.

    These warning are suppressed when this environment variable is defined.

  • PYSVS_OVERRIDE_BACKEND=<backend-name>

    Explicitly bypass the backend selection logic. See the pysvs.loader.available_backends() for a list of valid strings for this variable. Misusing this feature can cause the application to not load or crash.

Documentation for functions regarding backend selection and the current backend are given below.

pysvs.loader.available_backends()

Return a list of the available backends that where compiled when this module was built.

Each backend in the list may be used to initialize PYSVS_OVERRIDE_BACKEND environment variable prior to application start to override the default loading logic.

pysvs.loader.current_backend()

Return the name of the current backend.

pysvs.loader.library()

Return the library backend as a module. Dynamically loads the library when first called.

Dynamically loading the library may trigger warnings related to correctness or performance. If you really really don’t want these warnings, they can be suppressed by defining the environemtn variable PYSVS_QUIET=YES prior to application start.