Skip to content

Commit

Permalink
Merge pull request #403 from eseiler/misc/shuffle
Browse files Browse the repository at this point in the history
[MISC] Shuffle records in search
  • Loading branch information
eseiler committed Nov 2, 2023
2 parents 8ff2c44 + 2997d93 commit cf2d859
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions include/raptor/search/search_singular_ibf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#pragma once

#include <random>

#include <seqan3/search/views/minimiser_hash.hpp>

#include <raptor/adjust_seed.hpp>
Expand Down Expand Up @@ -140,6 +142,8 @@ void search_singular_ibf(search_arguments const & arguments, index_t && index)
records.clear();
arguments.query_file_io_timer.start();
std::ranges::move(chunked_records, std::back_inserter(records));
// Very fast, improves parallel processing when chunks of the query belong to the same bin.
std::ranges::shuffle(records, std::mt19937_64{0u});
arguments.query_file_io_timer.stop();

cereal_future.get();
Expand Down
4 changes: 4 additions & 0 deletions src/search/search_partitioned_ibf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* \author Enrico Seiler <enrico.seiler AT fu-berlin.de>
*/

#include <random>

#include <seqan3/search/views/minimiser_hash.hpp>

#include <raptor/adjust_seed.hpp>
Expand Down Expand Up @@ -55,6 +57,8 @@ void search_partitioned_ibf(search_arguments const & arguments)
records.clear();
arguments.query_file_io_timer.start();
std::ranges::move(chunked_records, std::back_inserter(records));
// Very fast, improves parallel processing when chunks of the query belong to the same bin.
std::ranges::shuffle(records, std::mt19937_64{0u});
arguments.query_file_io_timer.stop();

cereal_future.get();
Expand Down
2 changes: 1 addition & 1 deletion test/include/raptor/test/cli_test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ struct raptor_base : public cli_test
ASSERT_EQ(line, "#QUERY_NAME\tUSER_BINS");

std::string const query_prefix{"query"};
for (char i : {'1', '2', '3'})
for (char i : {'3', '1', '2'})
{
ASSERT_TRUE(std::getline(search_result, line));
std::string_view line_view{line};
Expand Down

1 comment on commit cf2d859

@vercel
Copy link

@vercel vercel bot commented on cf2d859 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

raptor – ./

seqan-raptor.vercel.app
raptor-seqan.vercel.app
raptor-git-main-seqan.vercel.app

Please sign in to comment.