Skip to content
Open
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: 3 additions & 1 deletion src/commons/DBReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,9 @@ void DBReader<T>::decomposeDomainByAminoAcid(size_t worldRank, size_t worldSize,
sumCharsAssignedToCurrRank = 0;
currentRank++;
}
sumCharsAssignedToCurrRank += index[i].length;
// Add the sequence length at position i (after any sorting)
// This is identical to index[i].length when the reader is unsorted
sumCharsAssignedToCurrRank += getEntryLen(i);
entriesPerWorker[currentRank] += 1;
}

Expand Down
13 changes: 10 additions & 3 deletions src/util/makepaddedseqdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ int makepaddedseqdb(int argc, const char **argv, const Command &command) {
#pragma omp parallel
{
unsigned int thread_idx = 0;
unsigned int thread_count = 1;
#ifdef OPENMP
thread_idx = static_cast<unsigned int>(omp_get_thread_num());
thread_count = static_cast<unsigned int>(omp_get_num_threads());
#endif
Masker masker(subMat);
std::string result;
Expand All @@ -55,8 +57,13 @@ int makepaddedseqdb(int argc, const char **argv, const Command &command) {
charSequence = (unsigned char*)malloc(charSeqBufferSize * sizeof(char));
}

#pragma omp for schedule(static)
for (size_t i = 0; i < dbr.getSize(); i++) {
size_t rangeStart = 0, rangeSize = 0;
// Processing cost scales with sequence length, so balance total bytes instead
dbr.decomposeDomainByAminoAcid(thread_count - 1 - thread_idx, thread_count, &rangeStart, &rangeSize);
// The reader processes longest first, but the loop below processes shortest first
// This keeps the GPU database sorted by increasing sequence length
rangeStart = dbr.getSize() - rangeStart - rangeSize;
for (size_t i = rangeStart; i < rangeStart + rangeSize; i++) {
progress.updateProgress();

if (firstIt == SIZE_MAX) {
Expand Down Expand Up @@ -151,4 +158,4 @@ int makepaddedseqdb(int argc, const char **argv, const Command &command) {
}
dbr.close();
return EXIT_SUCCESS;
}
}