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.0.tar.gz
(14.2 kB
view hashes)
Built Distributions
Close
Hashes for slsdm-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 482060552692719ae8deaea7faec33035315498df2fec6deb705e7a92abf5186 |
|
MD5 | 6df641eeaf939be9a1e24f3dacaae8e5 |
|
BLAKE2b-256 | 681715f77525a705a4ff7941318b31286b2e055e731a45ee2a3a811786796055 |
Close
Hashes for slsdm-0.2.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3b6ce56ea91dc6c9bdc2a191e2357cfd8fa12a8db0bb944e6c3490923e29b94 |
|
MD5 | 4f08cb7d5e01927b47ee4b79683d731c |
|
BLAKE2b-256 | 158b7826dedeb7a8708f8ac89f476a16b84ee339ed79ac3c95453d1ff7cd5f1a |
Close
Hashes for slsdm-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f24a5441ca5517759ec59028425a40fecd5fb5b14f7e751772b92316e78bed9 |
|
MD5 | f1ec1d15a854741318783b035244b559 |
|
BLAKE2b-256 | b83fb8259e1ff3df436a3557cd5986cc9f4b8a414697c6efc3d291b7fb22d7eb |
Close
Hashes for slsdm-0.2.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16da2de4d2e32af76e066e58a2decac3c3207069afd4c7db8ad84e9d817d2d94 |
|
MD5 | e0b014da6e9f6a37f123b6ff0dbcd0e9 |
|
BLAKE2b-256 | 4cfe555080b1703799fa458e91ed2133120ecebd9853ba936647577a0790bd8d |
Close
Hashes for slsdm-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a40c7677dfb7ca0d291a11565d2d13e91012059b300e648926d0ef63f0cbdec1 |
|
MD5 | 7b799eb698516533f21213789a2248ce |
|
BLAKE2b-256 | 40180f9b5336399873ee6280b90c8b44f041b091409f7eaae29052be5f5d1b13 |
Close
Hashes for slsdm-0.2.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84a6c9c22b873ea14621ede1eb080497d2fb1f270064c43953d5ecdfa83c8ab7 |
|
MD5 | d578993d7ea24a1ae520838aa5ebb1fb |
|
BLAKE2b-256 | 3b53f28fab0f63d89f048ee5a46edbad9a4ac252fca10840749ea28efb350399 |
Close
Hashes for slsdm-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9c667c17938a011352aeb06edf594641e6e0bdb5a9d1976d2d72e8e8b3ef6f9 |
|
MD5 | 9306445b9d672ed82b474d9bfddffb2b |
|
BLAKE2b-256 | 4fd6e93d5ce781d7c2b807b5ec6bfb0b1a374829fea4ad6fbd2e99767ae10688 |
Close
Hashes for slsdm-0.2.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f197921ac77f866b1c11028f9efbb486bc32d87a7d31d3ddf2346f095328e42 |
|
MD5 | 10bbedceb8b0d853fee05952d18decd3 |
|
BLAKE2b-256 | e406f0396d49551e5223b08eccdba36a48da05b5e6869aa3994cdc1a5a4d5667 |