fastq_to_fasta
A template for creation of SeqAn3 apps, with a FASTQ to FASTA example app.
call_parallel_on_bins.hpp
Go to the documentation of this file.
1// --------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2022, Knut Reinert & MPI für molekulare Genetik
4// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5// shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md
6// --------------------------------------------------------------------------------------------------
7
8#pragma once
9
10#include <seqan3/core/algorithm/detail/execution_handler_parallel.hpp>
11#include <seqan3/utility/views/chunk.hpp>
12#include <seqan3/utility/views/zip.hpp>
13
15
16namespace raptor
17{
18
19template <typename algorithm_t>
20void call_parallel_on_bins(algorithm_t && worker, build_arguments const & arguments)
21{
22 // GCOVR_EXCL_START
23 size_t const chunk_size = std::clamp<size_t>(std::bit_ceil(arguments.bins / arguments.threads), 8u, 64u);
24 // GCOVR_EXCL_STOP
25 auto chunked_view = seqan3::views::zip(arguments.bin_path, std::views::iota(0u)) | seqan3::views::chunk(chunk_size);
26 seqan3::detail::execution_handler_parallel executioner{arguments.threads};
27 executioner.bulk_execute(std::move(worker), std::move(chunked_view), []() {});
28}
29
30} // namespace raptor
Definition: adjust_seed.hpp:13
void call_parallel_on_bins(algorithm_t &&worker, build_arguments const &arguments)
Definition: call_parallel_on_bins.hpp:20
Definition: build_arguments.hpp:21
uint8_t threads
Definition: build_arguments.hpp:44
std::vector< std::vector< std::string > > bin_path
Definition: build_arguments.hpp:42
uint64_t bins
Definition: build_arguments.hpp:34