Skip to content

Commit

Permalink
add setMaxNumThreads and setMinOffsetsPerThread methods to the `W…
Browse files Browse the repository at this point in the history
…FAligner` class
  • Loading branch information
AndreaGuarracino committed Aug 14, 2022
1 parent 8327065 commit a9eedba
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 2 deletions.
9 changes: 9 additions & 0 deletions bindings/cpp/WFAligner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,15 @@ void WFAligner::setMaxMemory(
const uint64_t maxMemoryAbort) {
wavefront_aligner_set_max_memory(wfAligner,maxMemoryResident,maxMemoryAbort);
}
// Parallelization
void WFAligner::setMaxNumThreads(
const int maxNumThreads) {
wavefront_aligner_set_max_num_threads(wfAligner, maxNumThreads);
}
void WFAligner::setMinOffsetsPerThread(
const int minOffsetsPerThread) {
wavefront_aligner_set_min_offsets_per_thread(wfAligner, minOffsetsPerThread);
}
/*
* Accessors
*/
Expand Down
5 changes: 5 additions & 0 deletions bindings/cpp/WFAligner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ class WFAligner {
void setMaxMemory(
const uint64_t maxMemoryResident,
const uint64_t maxMemoryAbort);
// Parallelization
void setMaxNumThreads(
const int maxNumThreads);
void setMinOffsetsPerThread(
const int minOffsetsPerThread);
// Accessors
int getAlignmentScore();
int getAlignmentStatus();
Expand Down
18 changes: 18 additions & 0 deletions wavefront/wavefront_aligner.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,24 @@ void wavefront_aligner_set_max_memory(
wf_aligner->bialigner,max_memory_resident,max_memory_abort);
}
}
void wavefront_aligner_set_max_num_threads(
wavefront_aligner_t* const wf_aligner,
const int max_num_threads) {
wf_aligner->system.max_num_threads = max_num_threads;
if (wf_aligner->bialigner != NULL) {
wavefront_bialigner_set_max_num_threads(
wf_aligner->bialigner,max_num_threads);
}
}
void wavefront_aligner_set_min_offsets_per_thread(
wavefront_aligner_t* const wf_aligner,
const int min_offsets_per_thread) {
wf_aligner->system.min_offsets_per_thread = min_offsets_per_thread;
if (wf_aligner->bialigner != NULL) {
wavefront_bialigner_set_min_offsets_per_thread(
wf_aligner->bialigner,min_offsets_per_thread);
}
}
/*
* Utils
*/
Expand Down
7 changes: 6 additions & 1 deletion wavefront/wavefront_aligner.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,12 @@ void wavefront_aligner_set_max_memory(
wavefront_aligner_t* const wf_aligner,
const uint64_t max_memory_resident,
const uint64_t max_memory_abort);

void wavefront_aligner_set_max_num_threads(
wavefront_aligner_t* const wf_aligner,
const int max_num_threads);
void wavefront_aligner_set_min_offsets_per_thread(
wavefront_aligner_t* const wf_aligner,
const int min_offsets_per_thread);
/*
* Utils
*/
Expand Down
14 changes: 14 additions & 0 deletions wavefront/wavefront_bialigner.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,17 @@ void wavefront_bialigner_set_max_memory(
wf_bialigner->alg_subsidiary->system.max_memory_resident = max_memory_resident;
wf_bialigner->alg_subsidiary->system.max_memory_abort = max_memory_abort;
}
void wavefront_bialigner_set_max_num_threads(
wavefront_bialigner_t* const wf_bialigner,
const int max_num_threads) {
wf_bialigner->alg_forward->system.max_num_threads = max_num_threads;
wf_bialigner->alg_reverse->system.max_num_threads = max_num_threads;
wf_bialigner->alg_subsidiary->system.max_num_threads = max_num_threads;
}
void wavefront_bialigner_set_min_offsets_per_thread(
wavefront_bialigner_t* const wf_bialigner,
const int min_offsets_per_thread) {
wf_bialigner->alg_forward->system.min_offsets_per_thread = min_offsets_per_thread;
wf_bialigner->alg_reverse->system.min_offsets_per_thread = min_offsets_per_thread;
wf_bialigner->alg_subsidiary->system.min_offsets_per_thread = min_offsets_per_thread;
}
7 changes: 6 additions & 1 deletion wavefront/wavefront_bialigner.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,10 @@ void wavefront_bialigner_set_max_memory(
wavefront_bialigner_t* const wf_bialigner,
const uint64_t max_memory_resident,
const uint64_t max_memory_abort);

void wavefront_bialigner_set_max_num_threads(
wavefront_bialigner_t* const wf_bialigner,
const int max_num_threads);
void wavefront_bialigner_set_min_offsets_per_thread(
wavefront_bialigner_t* const wf_bialigner,
const int min_offsets_per_thread);
#endif /* WAVEFRONT_BIALIGNER_H_ */

0 comments on commit a9eedba

Please sign in to comment.