Skip to content

[BUG] mg_index doesn't write output values when used on single GPU with default parameters #904

@achirkin

Description

@achirkin

When built for a single GPU, mg_index doesn't write the outputs during search with default parameters.

The culprit is the sharded-tree-merge search implementation that is designed for even number of GPUs.
With rank == 1 (single GPU) the code for copying the data to output is never reached:

if (remaining <= 1) {
raft::copy(neighbors.data_handle() + output_offset,
tmp_neighbors.data_handle(),
part_size,
raft::resource::get_cuda_stream(dev_res));
raft::copy(distances.data_handle() + output_offset,
tmp_distances.data_handle(),
part_size,
raft::resource::get_cuda_stream(dev_res));
resource::sync_stream(dev_res);
}

...because it's nested under the following loop:
int64_t remaining = index.num_ranks_;
int64_t radix = 2;
while (remaining > 1) {

That is, if one builds and searches an SNMG index using ANN_BENCH tool with default parameters and a single GPU, the recall is always zero.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions