A set of SIMD-accelerated DistanceMetric implementations
Project description
# Scikit-Learn SIMD DistanceMetrics (SLSDM)
## Install from pip
Run `pip install slsdm`. Note that the premade wheels are only built with support for `SSE2, SSE3` instructions.
## Install From Source:
1. Create a new environment with `xsimd`: `conda create -n <env_name> -c conda-forge python~=3.10.0 compilers`
2. Activate the environment: `conda activate <env_name>`
3. Run `pip install -e .`
**Warning**: At this point, building from source only works with `gcc`. Support for `clang` and `MSVC` is in progress.
## Specify SIMD Target Architectures
By default, `slsdm` will be built with `{SSE3, SSE2}` support. The preferred architectures can be specified at build time using the `SLSDM_SIMD_ARCH` environment variable by passing a comma-separated list of architecture specification tokens. Currently, only `x86_64` CPU features are supported. Specifically, the following features are available:
```
Instruction Set | Specification Tokens
======================================
AVX512BW | avx512bw
AVX512DQ | avx512dq
AVX512CD | avx512cd
AVX512F | avx512f
FMA4 | fma4
FMA3 + AVX2 | fma3, avx2
AVX2 | avx2
FMA3 + AVX | fma3, avx
AVX | avx
FMA3 + SSE4.2 | fma3, sse4_2
SSE4.2 | sse4_2
SSE4.1 | sse4_1
SSSE3 | ssse3
SSE3 | sse3
SSE2 | sse2
```
For example, to build for `{SSE3, AVX, FMA 3 + AVX, AVX2}` one would specify `SLSDM_SIMD_ARCH="sse3, avx, fma3<xs::avx>, avx2"`.
You may also prefer to specify features *up to*, and optionally including, a certain instruction. For that, you may prepend a specification token with `<` (exclusive) or `<=` (inclusive). For example, to build for `{SSE2, SSE3, SSSE3, AVX2}` one would specify `SLSDM_SIMD_ARCH="<=ssse3, avx2"`.
You can also disable specific features that would otherwise be enabled by your specification by prepending the `~` symbol to the specification token. For example, to build for `{SSE4_2, SSE4_1, SSE3, SSE2}`, one would specify `SLSDM_SIMD_ARCH="<=sse4_2, !ssse3"`. Note that the specification will be resolved in a left-to-right order, so `SLSDM_SIMD_ARCH="!ssse3, <=sse4_2"` would not produce equivalent results, and indeed still generates `SSSE3` instructions.
To include `FMA3` combination instruction sets, include `fma3` in the `SLSDM_SIMD_ARCH` specification and any compatible instruction sets will automatically be enabled. For example, `SLSDM_SIMD_ARCH="fma3, <=avx"` will enable `{FMA3 + AVX, AVX, FMA3 + SSE4.2, SSE4.2, SSE4.1, SSSE3, SSE3, SSE2}`.
**Warning**: Runtime dispatch is not yet correctly supported. When distributing to other machines, please build only with SIMD sets that all target machines support.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
slsdm-0.2.1.tar.gz
(14.4 kB
view hashes)
Built Distributions
Close
Hashes for slsdm-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8689398d2ab28f4adba0729f3fada71cf57045f9ef2ee3971f955661fa9455c7 |
|
MD5 | f9b6aaf311c7d2837a22b76968241b1d |
|
BLAKE2b-256 | 66d680d9cbebb533d57fa841359ef3445b609a0702da7f489e9d5180edf6ed19 |
Close
Hashes for slsdm-0.2.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3a1bb067c37dfa7f5206dface0bc08c69aa2c6dcdbe275a7978c14e2b4c44c1 |
|
MD5 | fc7fb8e2412bc65b780c7e8e22427e14 |
|
BLAKE2b-256 | da30f4457d29606785c2de088d5e5b30062f16416fb76366f5e6ae12209ea754 |
Close
Hashes for slsdm-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c59f9d1667d91a2df9559d3a0352da432fea8f15871a280fcf44fd9fb2877048 |
|
MD5 | 941323e89ec352bc3c5818ebb095e18a |
|
BLAKE2b-256 | 770db4546398cf3863b595a0986f8b7cac5dfb82fc88d54681742c62d8f8407d |
Close
Hashes for slsdm-0.2.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | afcef34b58440e5b6309a761bc152c1898c49c16fb7938701cc17ca593a24aaf |
|
MD5 | c086bb85b5eba56be379f603922a8a7d |
|
BLAKE2b-256 | 58590c3183abe70e5b3b4c9bd4ebd6a9a2292dc8a746700380cb02e83d160dff |
Close
Hashes for slsdm-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35074e2db01b8eb54192aab4ac9e64b68b1dfd902077467cb2b6cd2a87c7509d |
|
MD5 | 3ef18a167d5f0d190a4ad89cdccc84b7 |
|
BLAKE2b-256 | 565f2471777761bb16779f5841e4f85e3cc3e70c48891cc12879208a5250b320 |
Close
Hashes for slsdm-0.2.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03bb6f3a31d33fce10f226f047e3ca4fb5220df1ac270a7afab3324c6b23b298 |
|
MD5 | 660fcb7a6faac7d4d40f8e23d892714e |
|
BLAKE2b-256 | a603c444207bf662431fabb31e5c48b1baa91f67c1b317f7945762309cb551d8 |
Close
Hashes for slsdm-0.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14b20fce8b222bf82675786c51cc50ab9ef545e01a9abe1ef10e7578be596e66 |
|
MD5 | 7628555cc853a295f437b5b27481d0fb |
|
BLAKE2b-256 | 2fdc616d82af73af115d37b049b0375edb9f2a1cafc88062e70e0668cc6262a0 |
Close
Hashes for slsdm-0.2.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f746399586a1d116956778961e42e57a5aeea1a03d122aa6f232170f506c0a6 |
|
MD5 | 273844354b3aef948f8b3b6ac1de9383 |
|
BLAKE2b-256 | e72182f718eaa998b1291a76d6e49e27d9ab9a2368019a9f516433ff8a64ad66 |