Skip to content

Commit

Permalink
Moving pragmas around
Browse files Browse the repository at this point in the history
  • Loading branch information
gvegayon committed Oct 5, 2023
1 parent 9f96dc4 commit f7d239d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion include/barry/model-meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ inline void Model<Array_Type,Data_Counter_Type,Data_Rule_Type, Data_Rule_Dyn_Typ
);

#if defined(__OPENMP) || defined(_OPENMP)
#pragma omp parallel for simd num_threads(ncores) \
#pragma omp parallel for num_threads(ncores) collapse(1) \
shared(n_params, pset_stats, pset_probs, normalizing_constants, pset_sizes, \
params) \
default(none)
Expand All @@ -238,6 +238,9 @@ inline void Model<Array_Type,Data_Counter_Type,Data_Rule_Type, Data_Rule_Dyn_Typ
size_t pset_start = pset_locations[s];

// Looping over observations of the pset
#if defined(__OPENMP) || defined(_OPENMP)
#pragma omp simd
#endif
for (size_t a = 0u; a < pset_sizes[s]; ++a)
{

Expand Down
7 changes: 4 additions & 3 deletions include/barry/models/geese/geese-meat-likelihood.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ inline void pset_loop(
if (!x.is_dense())
throw std::logic_error("This is only supported for dense arrays.");

const std::vector< size_t > & location_x = locations[n];
const size_t * location_x = &locations[n][0u];

// Extracting the possible values of each offspring
double off_mult = 1.0;
Expand Down Expand Up @@ -65,7 +65,7 @@ inline void pset_loop(
}

// Retrieving the location to the respective set of probabilities
off_mult *= n_off->subtree_prob[location_x[o]];
off_mult *= n_off->subtree_prob[*(location_x + o)];

}

Expand Down Expand Up @@ -154,6 +154,7 @@ inline double Geese::likelihood(
// Starting the prob
size_t array_id = node.narray[s];
size_t support_id = arrays2support[array_id];
const double * psetsprobs_s = &psetprobs[pset_locations[support_id]];

// Retrieving the sets of arrays
const std::vector< PhyloArray > & psets =
Expand All @@ -173,7 +174,7 @@ inline double Geese::likelihood(
pset_loop(
n, s, nfunctions, node_id, array_id, totprob_n,
par0, states, psets, locations,
node_offspring, &psetprobs[pset_locations[support_id]]
node_offspring, psetsprobs_s
);
}

Expand Down

0 comments on commit f7d239d

Please sign in to comment.