From 4c9a584ae9b80549d3a19d61f7ecdea6a3d8535f Mon Sep 17 00:00:00 2001 From: Joyjit Daw Date: Mon, 23 Sep 2019 18:08:58 -0400 Subject: [PATCH 1/3] [aligner] improve GPU/CPU alignment overlapping --- src/cuda/cudaaligner.cpp | 27 +++------------------------ src/cuda/cudaaligner.hpp | 8 +++----- src/cuda/cudapolisher.cpp | 18 +++++++++++------- vendor/ClaraGenomicsAnalysis | 2 +- 4 files changed, 18 insertions(+), 37 deletions(-) diff --git a/src/cuda/cudaaligner.cpp b/src/cuda/cudaaligner.cpp index f219629..3062058 100644 --- a/src/cuda/cudaaligner.cpp +++ b/src/cuda/cudaaligner.cpp @@ -39,7 +39,7 @@ CUDABatchAligner::CUDABatchAligner(uint32_t max_query_size, aligner_ = claragenomics::cudaaligner::create_aligner(max_query_size, max_target_size, max_alignments, - claragenomics::cudaaligner::AlignmentType::global, + claragenomics::cudaaligner::AlignmentType::global_alignment, stream_, device_id); } @@ -68,9 +68,7 @@ bool CUDABatchAligner::addOverlap(Overlap* overlap, std::vector(std::string(q, q + q_len), - std::string(t, t + t_len))); - cpu_overlaps_.push_back(overlap); + // Do nothing as this case will be handled by CPU aligner. } else if (s != claragenomics::cudaaligner::StatusType::success) { @@ -86,21 +84,9 @@ bool CUDABatchAligner::addOverlap(Overlap* overlap, std::vectoralign_all(); - compute_cpu_overlaps(); } -void CUDABatchAligner::compute_cpu_overlaps() -{ - for(std::size_t a = 0; a < cpu_overlaps_.size(); a++) - { - // Run CPU version of overlap. - Overlap* overlap = cpu_overlaps_[a]; - overlap->align_overlaps(cpu_overlap_data_[a].first.c_str(), cpu_overlap_data_[a].first.length(), - cpu_overlap_data_[a].second.c_str(), cpu_overlap_data_[a].second.length()); - } -} - -void CUDABatchAligner::find_breaking_points(uint32_t window_length) +void CUDABatchAligner::generate_cigar_strings() { aligner_->sync_alignments(); @@ -113,19 +99,12 @@ void CUDABatchAligner::find_breaking_points(uint32_t window_length) for(std::size_t a = 0; a < alignments.size(); a++) { overlaps_[a]->cigar_ = alignments[a]->convert_to_cigar(); - overlaps_[a]->find_breaking_points_from_cigar(window_length); - } - for(Overlap* overlap : cpu_overlaps_) - { - // Run CPU version of breaking points. - overlap->find_breaking_points_from_cigar(window_length); } } void CUDABatchAligner::reset() { overlaps_.clear(); - cpu_overlaps_.clear(); cpu_overlap_data_.clear(); aligner_->reset(); } diff --git a/src/cuda/cudaaligner.hpp b/src/cuda/cudaaligner.hpp index a1b4816..2df6d51 100644 --- a/src/cuda/cudaaligner.hpp +++ b/src/cuda/cudaaligner.hpp @@ -49,10 +49,11 @@ class CUDABatchAligner virtual void alignAll(); /** - * @brief Find breaking points in alignments. + * @brief Generate cigar strings for overlaps that were successfully + * copmuted on the GPU. * */ - virtual void find_breaking_points(uint32_t window_length); + virtual void generate_cigar_strings(); /** * @brief Resets the state of the object, which includes @@ -74,13 +75,10 @@ class CUDABatchAligner CUDABatchAligner(const CUDABatchAligner&) = delete; const CUDABatchAligner& operator=(const CUDABatchAligner&) = delete; - void compute_cpu_overlaps(); - std::unique_ptr aligner_; std::vector overlaps_; - std::vector cpu_overlaps_; std::vector> cpu_overlap_data_; // Static batch count used to generate batch IDs. diff --git a/src/cuda/cudapolisher.cpp b/src/cuda/cudapolisher.cpp index 1c3afdd..9f784dc 100644 --- a/src/cuda/cudapolisher.cpp +++ b/src/cuda/cudapolisher.cpp @@ -85,12 +85,7 @@ std::vector CUDAPolisher::calculate_batches_per_gpu(uint32_t batches, void CUDAPolisher::find_overlap_breaking_points(std::vector>& overlaps) { - if (cudaaligner_batches_ < 1) - { - // TODO: Kept CPU overlap alignment right now while GPU is a dummy implmentation. - Polisher::find_overlap_breaking_points(overlaps); - } - else + if (cudaaligner_batches_ >= 1) { // TODO: Experimentally this is giving decent perf const uint32_t MAX_ALIGNMENTS = 200; @@ -137,7 +132,10 @@ void CUDAPolisher::find_overlap_breaking_points(std::vectoralignAll(); - batch->find_breaking_points(window_length_); + + // Generate CIGAR strings for successful alignments. The actual breaking points + // will be calculate by the overlap object. + batch->generate_cigar_strings(); // logging bar { @@ -193,6 +191,12 @@ void CUDAPolisher::find_overlap_breaking_points(std::vectorlog(); + Polisher::find_overlap_breaking_points(overlaps); } void CUDAPolisher::polish(std::vector>& dst, diff --git a/vendor/ClaraGenomicsAnalysis b/vendor/ClaraGenomicsAnalysis index 416af9f..aea29fb 160000 --- a/vendor/ClaraGenomicsAnalysis +++ b/vendor/ClaraGenomicsAnalysis @@ -1 +1 @@ -Subproject commit 416af9f1817a4a70745b3f7cdb7418125159f75c +Subproject commit aea29fbc06655ee7888ec779761223147fdeb661 From d9cf3da9ec4cb114c4635d6365802ed879577e8c Mon Sep 17 00:00:00 2001 From: Joyjit Daw Date: Mon, 23 Sep 2019 18:42:23 -0400 Subject: [PATCH 2/3] [ci] fix CI environment --- ci/common/build.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ci/common/build.sh b/ci/common/build.sh index 84ef8e4..4244ed6 100755 --- a/ci/common/build.sh +++ b/ci/common/build.sh @@ -37,6 +37,14 @@ g++ --version # FIX Added to deal with Anancoda SSL verification issues during conda builds conda config --set ssl_verify False +conda install \ + -c conda-forge \ + -c sarcasm \ + -c bioconda \ + doxygen \ + ninja \ + cmake + CUDA_REL=${CUDA:0:3} if [ "${CUDA:0:2}" == '10' ]; then # CUDA 10 release From 9a9585fa4b6b11b3e10f8d5075023012bbd2518c Mon Sep 17 00:00:00 2001 From: Joyjit Daw Date: Wed, 9 Oct 2019 15:24:52 -0400 Subject: [PATCH 3/3] [vendor] update CGA submodule --- vendor/ClaraGenomicsAnalysis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/ClaraGenomicsAnalysis b/vendor/ClaraGenomicsAnalysis index aea29fb..957d449 160000 --- a/vendor/ClaraGenomicsAnalysis +++ b/vendor/ClaraGenomicsAnalysis @@ -1 +1 @@ -Subproject commit aea29fbc06655ee7888ec779761223147fdeb661 +Subproject commit 957d4497f8867f1368382c096e2cf7523dd847fb