|
| 1 | +.. Copyright (c) 2016, xsimd contributors |
| 2 | +
|
| 3 | + Distributed under the terms of the BSD 3-Clause License. |
| 4 | +
|
| 5 | + The full license is in the file LICENSE, distributed with this software. |
| 6 | +
|
| 7 | +
|
| 8 | +Build Options |
| 9 | +============= |
| 10 | + |
| 11 | +Some macros can be set to configure the behaviour of xsimd at compulte time. |
| 12 | + |
| 13 | +Changing Default Architecture |
| 14 | +----------------------------- |
| 15 | + |
| 16 | +You can change the default instruction set used by xsimd (when none is provided |
| 17 | +explicitly) by setting the ``XSIMD_DEFAULT_ARCH`` macro to, say, ``xsimd::avx2``. |
| 18 | +A common usage is to set it to ``xsimd::unsupported`` as a way to detect |
| 19 | +instantiation of batches with the default architecture. |
| 20 | + |
| 21 | +This will change the value of ``xsimd::default_arch`` used as default template parameter for |
| 22 | +:ref:`batch <xsimd-batch-ref>`. |
| 23 | +See :ref:`arch-manipulation` for all available architectures. |
| 24 | + |
| 25 | +In CMake, this can be done with the following. |
| 26 | + |
| 27 | +.. code:: cmake |
| 28 | +
|
| 29 | + target_add_compile_definitions(myproject PRIVATE XSIMD_DEFAULT_ARCH=xsimd::avx2) |
| 30 | +
|
| 31 | +
|
| 32 | +Enabling emulated architecture |
| 33 | +------------------------------ |
| 34 | + |
| 35 | +When the compiler macro ``XSIMD_WITH_EMULATED`` is set to ``1``, xsimd also |
| 36 | +exhibits an emulated architecture. |
| 37 | + |
| 38 | +See :ref:`emulated-mode` for all available architectures. |
| 39 | + |
| 40 | +In CMake, this can be done with the following. |
| 41 | + |
| 42 | +.. code:: cmake |
| 43 | +
|
| 44 | + target_add_compile_definitions(myproject PRIVATE XSIMD_WITH_EMULATED=1) |
| 45 | +
|
| 46 | +
|
| 47 | +Enabling complex support with ``xtl`` |
| 48 | +------------------------------------- |
| 49 | + |
| 50 | +If the preprocessor token ``XSIMD_ENABLE_XTL_COMPLEX`` is defined, ``xsimd`` |
| 51 | +provides constructors of ``xsimd::batch<std::complex<T>, A>`` from |
| 52 | +``xtl::xcomplex``, similar to those for ``std::complex``. |
| 53 | +This requires the `xtl <https://github.com/xtensor-stack/xtl>`_ library to be installed |
| 54 | +and in the project include directories. |
| 55 | + |
| 56 | +In CMake, this can be done with an option before the package search (xsimd 14.3 onwards). |
| 57 | +It will link the ``xtl`` library as well as adding the macro definition to ``xsimd`` interface. |
| 58 | + |
| 59 | +.. code:: cmake |
| 60 | +
|
| 61 | + option(XSIMD_ENABLE_XTL_COMPLEX "Enable xtl complex support" ON) |
| 62 | + find_package(xsimd REQUIRED) |
0 commit comments