nmslib / hnswlib

Header-only C++/python library for fast approximate nearest neighbors
https://github.com/nmslib/hnswlib
Apache License 2.0
4.12k stars 609 forks source link

Usage of built index across different CPU arch #496

Closed wilsonzlin closed 9 months ago

wilsonzlin commented 10 months ago

Thanks for this great library. I'm curious if there's any limitation or issues if I build an index on, say, aarch64, save it somewhere using the standard save_index method, and then load it on an x86_64 machine and query the index from there? Is the index format machine-independent? I'm using the standard Python bindings library.

yurymalkov commented 9 months ago

Sorry for a very late reply. The index might be dependent on little endian vs big endian encoding. Other than that there should be no difference. As far as I understand both x86_64 and typical arch architecture are both little endian, so they should be compatible

wilsonzlin commented 9 months ago

Awesome, thanks for the update. If endianness is the only concern then it should be OK; as you pointed out, x86_64 and aarch64 should both be little endian.