diff options
| author | Sayed Adel <seiko@imavr.com> | 2023-01-03 19:18:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-03 19:18:24 +0200 |
| commit | 8e28d03618cbacaafa07210b0c7e5e96d8e9a7fa (patch) | |
| tree | 8210fe694f0e40034ac47e50975bb0dfe4f193b7 | |
| parent | ba89ef960bec42d7078374181069dfb37279bae1 (diff) | |
| parent | 196783619982cc77d0fa5c5f912ed2d52ff9d9a2 (diff) | |
| download | numpy-8e28d03618cbacaafa07210b0c7e5e96d8e9a7fa.tar.gz | |
Merge pull request #22917 from mattip/NPY_DISABLE_CPU_FEATURES
DOC: document NPY_DISABLE_CPU_FEATURES
| -rw-r--r-- | doc/source/reference/global_state.rst | 5 | ||||
| -rw-r--r-- | doc/source/reference/simd/build-options.rst | 19 | ||||
| -rw-r--r-- | doc/source/reference/simd/how-it-works.rst | 4 |
3 files changed, 22 insertions, 6 deletions
diff --git a/doc/source/reference/global_state.rst b/doc/source/reference/global_state.rst index 81685ec7d..f5c96c355 100644 --- a/doc/source/reference/global_state.rst +++ b/doc/source/reference/global_state.rst @@ -49,6 +49,11 @@ is to use madvise on Kernels 4.6 and newer. These kernels presumably experience a large speedup with hugepage support. This flag is checked at import time. +SIMD feature selection +---------------------- + +Setting ``NPY_DISABLE_CPU_FEATURES`` will exclude simd features at runtime. +See :ref:`runtime-simd-dispatch`. Interoperability-Related Options ================================ diff --git a/doc/source/reference/simd/build-options.rst b/doc/source/reference/simd/build-options.rst index 0994f15aa..d1e2e6b8e 100644 --- a/doc/source/reference/simd/build-options.rst +++ b/doc/source/reference/simd/build-options.rst @@ -333,7 +333,7 @@ and here is how it looks on x86_64/gcc: .. literalinclude:: log_example.txt :language: bash -As you see, there is a separate report for each of ``build_ext`` and ``build_clib`` +There is a separate report for each of ``build_ext`` and ``build_clib`` that includes several sections, and each section has several values, representing the following: **Platform**: @@ -371,6 +371,17 @@ that includes several sections, and each section has several values, representin - The lines that come after the above property and end with a ':' on a separate line, represent the paths of c/c++ sources that define the generated optimizations. -Runtime Trace -------------- -To be completed. +.. _runtime-simd-dispatch: + +Runtime dispatch +---------------- +Importing NumPy triggers a scan of the available CPU features from the set +of dispatchable features. This can be further restricted by setting the +environment variable ``NPY_DISABLE_CPU_FEATURES`` to a comma-, tab-, or +space-separated list of features to disable. This will raise an error if +parsing fails or if the feature was not enabled. For instance, on ``x86_64`` +this will disable ``AVX2`` and ``FMA3``:: + + NPY_DISABLE_CPU_FEATURES="AVX2,FMA3" + +If the feature is not available, a warning will be emitted. diff --git a/doc/source/reference/simd/how-it-works.rst b/doc/source/reference/simd/how-it-works.rst index 19b3dba45..dac80dd02 100644 --- a/doc/source/reference/simd/how-it-works.rst +++ b/doc/source/reference/simd/how-it-works.rst @@ -1,6 +1,6 @@ -********************************** +********************************* How does the CPU dispatcher work? -********************************** +********************************* NumPy dispatcher is based on multi-source compiling, which means taking a certain source and compiling it multiple times with different compiler |
