unum-cloud / usearch

Fast Open-Source Search & Clustering engine × for Vectors & 🔜 Strings × in C++, C, Python, JavaScript, Rust, Java, Objective-C, Swift, C#, GoLang, and Wolfram 🔍
https://unum-cloud.github.io/usearch/
Apache License 2.0
1.92k stars 109 forks source link

Bug: 'Illegal Instruction' while restoring an index from disk #446

Closed Stefano-t closed 1 week ago

Stefano-t commented 1 week ago

Describe the bug

Restoring a previously saved index on disk triggers an 'Illegal Instruction' on Mac M2 chip.

The bug was not present before version 2.9.2. All versions starting from 2.10 seem to have this bug.

This bug seems somehow correlated to issue #423 .

Steps to reproduce

The minimal working code is:

import numpy as np
from usearch.index import Index, MetricKind

ndim = 256

arr = np.random.randint(0, 256, (100, ndim // 8), dtype="uint8")

index = Index(
    ndim=ndim,
    metric=MetricKind.Tanimoto,
)

index.add(np.arange(len(arr)), arr)

index.save("./index.usearch")

restored = Index.restore("./index.usearch")  # <- this triggers 'Illegal instruction'

Tried also with view=True and by creating an empty Index and view or load on it.

Trying the same on Google Colab works fine without problems.

Expected behavior

Index restoring should not trigger an illegal instruction on Mac.

USearch version

= 2.10

Operating System

MacOS 13.3.1

Hardware architecture

Arm

Which interface are you using?

Python bindings

Contact Details

stefano.taverni@digitiamo.com

Are you open to being tagged as a contributor?

Is there an existing issue for this?

Code of Conduct

Stefano-t commented 1 week ago

Okay, sorry to bother with this issue but I was wrong: I'm running the code inside a docker container. Trying to run the above snippet on bare MacOS doesn't trigger the illegal instruction. So it seems more of a docker issue.

Thanks for the great work!

Closing this issue since is not relevant.