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

[FIX] make a bgzf_thread_count a single variable #2752

Merged
merged 1 commit into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ If possible, provide tooling that performs the changes, e.g. a shell-script.
#### I/O
* Changed default of `output_options::fasta_blank_before_id` to `false`
([\#2769](https://github.com/seqan/seqan3/pull/2769)).
* Changed default of `bgzf_thread_count` to `4` instead of determining the numbers of cores of the
machine it is running on ([\#2911](https://github.com/seqan/seqan3/pull/2911)).
* `bgzf_thread_count` is now a single global variable instead of having an instance per translation unit
([\#2752](https://github.com/seqan/seqan3/pull/2752)).

# 3.1.0

Expand Down
9 changes: 7 additions & 2 deletions doc/cookbook/compression_threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
//![example]
#include <seqan3/io/all.hpp>


// The `bgzf_thread_count` is a variable that can only be changed during run time of the program.
// This does not work, the value must be overwritten within a function.
// seqan3::contrib::bgzf_thread_count = 1u;
// seqan3::contrib::bgzf_thread_count = 1u; // Doesn't work

int main()
{
// Use one thread for (de-)compression.
// Here we change the number of threads to `1`. This is a global
// change and will effect the every future bgzf decompression call
// which doesn't specify an explicit thread count parameter.
// Already running decompression calls are unaffected by this
seqan3::contrib::bgzf_thread_count = 1u;

// Read/Write compressed files.
Expand Down
2 changes: 1 addition & 1 deletion include/seqan3/contrib/stream/bgzf_stream_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace seqan3::contrib

/*!\brief A static variable indicating the number of threads to use for the bgzf-streams. Defaults to 4.
*/
[[maybe_unused]] inline static uint64_t bgzf_thread_count = 4;
[[maybe_unused]] inline uint64_t bgzf_thread_count = 4;

// ============================================================================
// Forwards
Expand Down