From 4d0b0b03b0fbe5ca5f9b51dddb1f4031ae77f0ec Mon Sep 17 00:00:00 2001 From: computations Date: Wed, 29 Apr 2020 10:45:40 +0200 Subject: [PATCH] Improves the parallel sections of model.cpp --- src/model.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/model.cpp b/src/model.cpp index ba23ae8..dcbfcc5 100644 --- a/src/model.cpp +++ b/src/model.cpp @@ -356,15 +356,13 @@ void model_t::update_pmatrices(const std::vector &pmatrix_indices, } for (size_t part_index = 0; part_index < _partitions.size(); ++part_index) { auto part = _partitions[part_index]; -#pragma omp parallel for collapse(2) schedule(static) default(shared) - for (size_t i = 0; i < part->rate_cats; ++i) { - for (size_t branch = 0; branch < branch_lengths.size(); ++branch) { - auto param_index = _param_indicies[part_index]; - auto matrix_index = pmatrix_indices[branch]; - auto branch_length = branch_lengths[branch]; - pll_update_prob_matrices(part, param_index.data(), &matrix_index, - &branch_length, 1); - } +#pragma omp parallel for collapse(1) schedule(static) + for (size_t branch = 0; branch < branch_lengths.size(); ++branch) { + auto param_index = _param_indicies[part_index]; + auto matrix_index = pmatrix_indices[branch]; + auto branch_length = branch_lengths[branch]; + pll_update_prob_matrices(part, param_index.data(), &matrix_index, + &branch_length, 1); } } }