Skip to content

Commit

Permalink
minor fix in num_bits and bump pthash
Browse files Browse the repository at this point in the history
  • Loading branch information
jermp committed Jun 21, 2024
1 parent 11dc8f2 commit 2d1c27b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The query times are relative to the following configuration:

### Space in bits/kmer

| Dictionary |elegans ||| cod ||| kesterl ||| human |||
| Dictionary |elegans ||| cod ||| kestrel ||| human |||
|:------------------|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:-----:|:-------:|:-----:|
| | k=31 | k=47 | k=63 | k=31 | k=47 | k=63 | k=31 | k=47 | k=63 | k=31 | k=47 | k=63 |
| SSHash, **regular** | 5.86 | 4.29 | 3.51 | 7.84 | 5.17 | 4.26 | 7.53 | 4.67 | 3.76 | 8.70 | 5.65 | 4.64 |
Expand Down
5 changes: 3 additions & 2 deletions include/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ uint64_t skew_index::print_info() const {
}

void dictionary::print_space_breakdown() const {
std::cout << "total index size: " << essentials::convert((num_bits() + 7) / 8, essentials::MB)
<< " [MB]" << '\n';
const uint64_t num_bytes = (num_bits() + 7) / 8;
std::cout << "total index size: " << num_bytes << " [B] -- "
<< essentials::convert(num_bytes, essentials::MB) << " [MB]" << '\n';
std::cout << "SPACE BREAKDOWN:\n";
std::cout << " minimizers: " << static_cast<double>(m_minimizers.num_bits()) / size()
<< " [bits/kmer]\n";
Expand Down
4 changes: 3 additions & 1 deletion include/skew_index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ struct skew_index {

uint64_t num_bits() const {
uint64_t n =
(sizeof(min_log2) + sizeof(max_log2) + sizeof(log2_max_num_super_kmers_in_bucket)) * 8;
(sizeof(min_log2) + sizeof(max_log2) + sizeof(log2_max_num_super_kmers_in_bucket) +
2 * sizeof(size_t) /* for std::vector::size */) *
8;
for (uint64_t partition_id = 0; partition_id != mphfs.size(); ++partition_id) {
auto const& mphf = mphfs[partition_id];
auto const& P = positions[partition_id];
Expand Down
8 changes: 4 additions & 4 deletions src/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ void random_kmer(char* kmer, uint64_t k) {
}

void load_dictionary(dictionary& dict, std::string const& index_filename, bool verbose) {
uint64_t num_bytes_read = essentials::load(dict, index_filename.c_str());
const uint64_t num_bytes_read = essentials::load(dict, index_filename.c_str());
if (verbose) {
std::cout << "index size: " << essentials::convert(num_bytes_read, essentials::MB)
<< " [MB] (" << (num_bytes_read * 8.0) / dict.size() << " [bits/kmer])"
<< std::endl;
std::cout << "total index size: " << num_bytes_read << " [B] -- "
<< essentials::convert(num_bytes_read, essentials::MB) << " [MB] ("
<< (num_bytes_read * 8.0) / dict.size() << " [bits/kmer])" << std::endl;
dict.print_info();
}
}
Expand Down

0 comments on commit 2d1c27b

Please sign in to comment.