Skip to content

Commit

Permalink
Fix: Check only relevant symbols in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvardanian committed Sep 2, 2023
1 parent 850a0e8 commit aa77e12
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 20 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"dtypes",
"kann",
"maccs",
"simd",
"simsimd",
"tanimoto",
"unsw"
Expand Down
52 changes: 32 additions & 20 deletions python/test.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
import simsimd as sisi
import platform

import simsimd as simd


def test_non_null():
assert sisi.to_int(sisi.dot_f32_sve) != 0
assert sisi.to_int(sisi.dot_f32x4_neon) != 0
assert sisi.to_int(sisi.cos_f32_sve) != 0
assert sisi.to_int(sisi.cos_f16_sve) != 0
assert sisi.to_int(sisi.cos_f16x4_neon) != 0
assert sisi.to_int(sisi.cos_i8x16_neon) != 0
assert sisi.to_int(sisi.cos_f32x4_neon) != 0
assert sisi.to_int(sisi.cos_f16x16_avx512) != 0
assert sisi.to_int(sisi.cos_f32x4_avx2) != 0
assert sisi.to_int(sisi.l2sq_f32_sve) != 0
assert sisi.to_int(sisi.l2sq_f16_sve) != 0
assert sisi.to_int(sisi.hamming_b1x8_sve) != 0
assert sisi.to_int(sisi.hamming_b1x128_sve) != 0
assert sisi.to_int(sisi.hamming_b1x128_avx512) != 0
assert sisi.to_int(sisi.tanimoto_b1x8_naive) != 0
assert sisi.to_int(sisi.tanimoto_maccs_naive) != 0
assert sisi.to_int(sisi.tanimoto_maccs_neon) != 0
assert sisi.to_int(sisi.tanimoto_maccs_sve) != 0
assert sisi.to_int(sisi.tanimoto_maccs_avx512) != 0
# Some distance functions are provided for every platform
assert simd.to_int(simd.tanimoto_b1x8_naive) != 0
assert simd.to_int(simd.tanimoto_maccs_naive) != 0

# Arm Neon variants should be precompiled for any 64-bit Arm machine:
if platform.machine() == "arm64":
assert simd.to_int(simd.cos_f16x4_neon) != 0
assert simd.to_int(simd.cos_i8x16_neon) != 0
assert simd.to_int(simd.cos_f32x4_neon) != 0
assert simd.to_int(simd.dot_f32x4_neon) != 0
assert simd.to_int(simd.tanimoto_maccs_neon) != 0

# Arm SVE variants should be precompiled for 64-bit Arm machines running Linux:
if platform.machine() == "arm64" and platform.system().lower() == "linux":
assert simd.to_int(simd.dot_f32_sve) != 0
assert simd.to_int(simd.cos_f32_sve) != 0
assert simd.to_int(simd.cos_f16_sve) != 0
assert simd.to_int(simd.l2sq_f32_sve) != 0
assert simd.to_int(simd.l2sq_f16_sve) != 0
assert simd.to_int(simd.hamming_b1x8_sve) != 0
assert simd.to_int(simd.hamming_b1x128_sve) != 0
assert simd.to_int(simd.tanimoto_maccs_sve) != 0

# x86 AVX2 and AVX-512 variants are precompiled for every 64-bit x86 platform:
if platform.machine() == "x86_64":
assert simd.to_int(simd.cos_f32x4_avx2) != 0
assert simd.to_int(simd.cos_f16x16_avx512) != 0
assert simd.to_int(simd.hamming_b1x128_avx512) != 0
assert simd.to_int(simd.tanimoto_maccs_avx512) != 0

0 comments on commit aa77e12

Please sign in to comment.