Skip to content

Commit

Permalink
Copy query table only once and reset after use
Browse files Browse the repository at this point in the history
  • Loading branch information
milot-mirdita committed Jun 28, 2023
1 parent c814cd7 commit aab6657
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/sra/comparekmertables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,16 +366,14 @@ int comparekmertables(int argc, const char **argv, const Command &command) {

#pragma omp parallel num_threads(localThreads) default(none) shared(par, resultFiles, qTable, targetTables, std::cerr, std::cout, maximumNumOfBlocksPerDB)
{
Timer timer;
std::vector<QueryTableEntry> localQTable(qTable); //creates a deep copy of the queryTable
Debug(Debug::INFO) << "Deep copy time: " << timer.lap() << "\n";
#pragma omp for schedule(dynamic, 1)
for (size_t i = 0; i < targetTables.size(); ++i) {
Timer timer;
std::vector<QueryTableEntry> localQTable(qTable); //creates a deep copy of the queryTable
Debug(Debug::INFO) << "Deep copy time: " << timer.lap() << "\n";
QueryTableEntry *startPosQueryTable = localQTable.data();
QueryTableEntry *endQueryPos = startPosQueryTable + localQTable.size();

const std::string& targetName = targetTables[i];

timer.reset();
#if !defined(O_DIRECT)
const int mode = (O_RDONLY | O_SYNC);
Expand Down Expand Up @@ -615,6 +613,14 @@ int comparekmertables(int argc, const char **argv, const Command &command) {
}
writer.close();
Debug(Debug::INFO) << "Result write time: " << timer.lap() << "\n";
timer.reset();

QueryTableEntry *qTableStart = localQTable.data();
#pragma GCC unroll 8
for (size_t i = 0; i < localQTable.size(); ++i) {
qTableStart[i].targetSequenceID = UINT_MAX;
}
Debug(Debug::INFO) << "Query table reset: " << timer.lap() << "\n";

delete[] resultTable;
resultTable = nullptr;
Expand Down

0 comments on commit aab6657

Please sign in to comment.