Skip to content

Commit

Permalink
Search vs consolidation time
Browse files Browse the repository at this point in the history
  • Loading branch information
eaasna committed Sep 26, 2023
1 parent 8899b64 commit a1e8527
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
10 changes: 5 additions & 5 deletions include/valik/search/iterate_queries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void iterate_distributed_queries(search_arguments const & arguments,
start = std::chrono::high_resolution_clock::now();
prefilter_queries_parallel(ibf, arguments, query_records, thresholder, queue);
end = std::chrono::high_resolution_clock::now();
time_statistics.prefilter_time += std::chrono::duration_cast<std::chrono::duration<double>>(end - start).count();
time_statistics.search_time += std::chrono::duration_cast<std::chrono::duration<double>>(end - start).count();
}
}

Expand Down Expand Up @@ -101,7 +101,7 @@ void iterate_short_queries(search_arguments const & arguments,
auto start = std::chrono::high_resolution_clock::now();
prefilter_queries_parallel<shared_query_record<seqan2::String<seqan2::Dna>>>(ibf, arguments, query_records, thresholder, queue);
auto end = std::chrono::high_resolution_clock::now();
time_statistics.prefilter_time += std::chrono::duration_cast<std::chrono::duration<double>>(end - start).count();
time_statistics.search_time += std::chrono::duration_cast<std::chrono::duration<double>>(end - start).count();
query_records.clear();
}
}
Expand All @@ -112,7 +112,7 @@ void iterate_short_queries(search_arguments const & arguments,
auto start = std::chrono::high_resolution_clock::now();
prefilter_queries_parallel<shared_query_record<seqan2::String<seqan2::Dna>>>(ibf, arguments, query_records, thresholder, queue);
auto end = std::chrono::high_resolution_clock::now();
time_statistics.prefilter_time += std::chrono::duration_cast<std::chrono::duration<double>>(end - start).count();
time_statistics.search_time += std::chrono::duration_cast<std::chrono::duration<double>>(end - start).count();
}

/**
Expand Down Expand Up @@ -175,7 +175,7 @@ void iterate_split_queries(search_arguments const & arguments,
auto start = std::chrono::high_resolution_clock::now();
prefilter_queries_parallel<shared_query_record<seqan2::String<seqan2::Dna>>>(ibf, arguments, query_records, thresholder, queue);
auto end = std::chrono::high_resolution_clock::now();
time_statistics.prefilter_time += std::chrono::duration_cast<std::chrono::duration<double>>(end - start).count();
time_statistics.search_time += std::chrono::duration_cast<std::chrono::duration<double>>(end - start).count();
query_records.clear();
}
}
Expand All @@ -188,7 +188,7 @@ void iterate_split_queries(search_arguments const & arguments,
auto start = std::chrono::high_resolution_clock::now();
prefilter_queries_parallel<shared_query_record<seqan2::String<seqan2::Dna>>>(ibf, arguments, query_records, thresholder, queue);
auto end = std::chrono::high_resolution_clock::now();
time_statistics.prefilter_time += std::chrono::duration_cast<std::chrono::duration<double>>(end - start).count();
time_statistics.search_time += std::chrono::duration_cast<std::chrono::duration<double>>(end - start).count();
}

} // namespace valik::app
12 changes: 7 additions & 5 deletions include/valik/search/search_time_statistics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ struct search_time_statistics
double index_io_time{0.0};
std::vector<double> cart_processing_times;
double reads_io_time{0.0};
double prefilter_time{0.0};
double search_time{0.0};
double consolidation_time{0.0};

double get_cart_min() const
{
Expand Down Expand Up @@ -41,22 +42,23 @@ inline void write_time_statistics(search_time_statistics const & time_statistics
std::filesystem::path file_path{time_file};
std::ofstream file_handle(file_path, std::ofstream::app);

file_handle << "Ref I/O\tIBF I/O\tReads I/O\tPrefilter\tMin cart time\tAvg cart time\tMax cart time\tNr carts\n";
file_handle << "Ref I/O\tIBF I/O\tReads I/O\tSearch\tMin cart time\tAvg cart time\tMax cart time\tNr carts\tConsolidation\n";
file_handle << std::fixed
<< std::setprecision(2)
<< time_statistics.ref_io_time << '\t'
<< time_statistics.index_io_time << '\t'
<< time_statistics.reads_io_time << '\t'
<< time_statistics.prefilter_time << '\t';
<< time_statistics.search_time << '\t';
if (!time_statistics.cart_processing_times.empty())
{
file_handle << time_statistics.get_cart_min() << '\t'
<< time_statistics.get_cart_avg() << '\t'
<< time_statistics.get_cart_max() << '\t'
<< time_statistics.cart_processing_times.size() << '\n';

<< time_statistics.cart_processing_times.size() << '\t';
}

file_handle << time_statistics.consolidation_time << '\n';

}

} // namespace valik::app
3 changes: 3 additions & 0 deletions src/valik_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ void valik_search(search_arguments const & arguments)
}

// Consolidate matches (not necessary when searching a metagenomic database)
auto start = std::chrono::high_resolution_clock::now();
if (!arguments.ref_meta_path.empty())
{
consolidate_matches(arguments);
Expand All @@ -53,6 +54,8 @@ void valik_search(search_arguments const & arguments)
std::cerr << "Could not clean up intermediate file: \t" << std::string(arguments.all_matches) << '\n';
failed = failed || error_in_delete;
}
auto end = std::chrono::high_resolution_clock::now();
time_statistics.consolidation_time += std::chrono::duration_cast<std::chrono::duration<double>>(end - start).count();

if (arguments.write_time)
write_time_statistics(time_statistics, arguments.out_file.string() + ".time");
Expand Down

0 comments on commit a1e8527

Please sign in to comment.