microsoft / SPTAG

A distributed approximate nearest neighborhood search (ANN) library which provides a high quality vector index build, search and distributed online serving toolkits for large scale vector search scenario.
MIT License
4.78k stars 582 forks source link

test failure when building on Linux in tmpfs due to the use of `O_DIRECT` #329

Open pabs3 opened 2 years ago

pabs3 commented 2 years ago

When building SPTAG on Linux in a tmpfs (a RAM-only filesystem), the tests fail because they open files with O_DIRECT but that isn't supported on tmpfs by current versions of Linux.

1: [4] Failed to create file handle: SPANN/SPTAGFullList.bin: Invalid argument
1: [4] Cannot open file:SPANN/SPTAGFullList.bin!
1: [4] Cannot Load SSDIndex!
1: ./Test/src/AlgoTest.cpp(45): error: in "AlgoTest/SPANNTest": check SPTAG::ErrorCode::Success == vecIndex->SaveIndex(out) has failed
pabs3 commented 2 years ago

I suggest detecting when the file open failed due to missing O_DIRECT support and opening the file again without using O_DIRECT.