Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed seeds for deterministic results #144

Open
mikepcw opened this issue Jul 17, 2023 · 1 comment
Open

Fixed seeds for deterministic results #144

mikepcw opened this issue Jul 17, 2023 · 1 comment

Comments

@mikepcw
Copy link

mikepcw commented Jul 17, 2023

Somewhat related to #117.

I am also seeing non-deterministic results when parallelising multiple queries across OpenMP threads. But as I saw in #117 this may be a consequence of randomly selecting leaf nodes, and not an issue with threads.

Is there a way to fix the seed so that results are always deterministic? If this is not ideal during production, at least during testing, so results can be debugged more easily.

@masajiro
Copy link
Member

It is a little difficult to avoid the randomness of the seeds.

If you request more than 100 vectors as a result, the result is deterministic. This number 100 depends on the maximum number of objects in the leaf node of the tree index. The number is written in this line.
If 10 is set to this, even when you request only 10 vectors, the result remains deterministic. However, altering the number might affect the search performance.

Alternatively, if the following line is added in define.h.in, it might be possible to obtain deterministic results.
#define NGT_DISABLE_SRAND_FOR_RANDOM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants