Skip to content

Commit

Permalink
fix lack of openmp with macos
Browse files Browse the repository at this point in the history
  • Loading branch information
helske committed Sep 6, 2024
1 parent 07cadaa commit 6bebc7f
Show file tree
Hide file tree
Showing 21 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/EM.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// EM algorithm for non-mixture hidden Markov models

#include "forward_backward.h"
#include <omp.h>
#include "useomp.h"
// [[Rcpp::export]]

Rcpp::List EM(const arma::mat& transition_, const arma::cube& emission_, const arma::vec& init_,
Expand Down
2 changes: 1 addition & 1 deletion src/EMx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "forward_backward.h"
#include "optcoef.h"
#include "reparma.h"
#include <omp.h>
#include "useomp.h"

// [[Rcpp::export]]
Rcpp::List EMx(const arma::mat& transition_, const arma::cube& emission_, const arma::vec& init_,
Expand Down
2 changes: 1 addition & 1 deletion src/forwardbackward.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Forward-backward algorithm for non-mixture hidden Markov models
#include "forward_backward.h"
#include <omp.h>
#include "useomp.h"
// [[Rcpp::export]]
Rcpp::List forwardbackward(const arma::mat& transition, const arma::cube& emission,
const arma::vec& init, const arma::ucube& obs, bool forwardonly, unsigned int threads) {
Expand Down
2 changes: 1 addition & 1 deletion src/forwardbackwardx.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Forward-backward algorithm for mixture hidden Markov models
#include "forward_backward.h"
#include "reparma.h"
#include <omp.h>
#include "useomp.h"

// [[Rcpp::export]]
Rcpp::List forwardbackwardx(const arma::mat& transition, const arma::cube& emission,
Expand Down
2 changes: 1 addition & 1 deletion src/internalBackward.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Internal backward algorithms for HMMs and MHMMs
#include "forward_backward.h"
#include <omp.h>
#include "useomp.h"

void internalBackward(const arma::mat& transition, const arma::cube& emission,
const arma::ucube& obs, arma::cube& beta, const arma::mat& scales,
Expand Down
2 changes: 1 addition & 1 deletion src/internalForward.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Internal forward algorithms for HMMs and MHMMs

#include "forward_backward.h"
#include <omp.h>
#include "useomp.h"

void internalForward(const arma::mat& transition_t, const arma::cube& emission, const arma::vec& init,
const arma::ucube& obs, arma::cube& alpha, arma::mat& scales, unsigned int threads) {
Expand Down
2 changes: 1 addition & 1 deletion src/logLikHMM.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// log-likelihood of HMM
#include <RcppArmadillo.h>
#include <omp.h>
#include "useomp.h"

// [[Rcpp::export]]
Rcpp::NumericVector logLikHMM(const arma::mat& transition, const arma::cube& emission,
Expand Down
2 changes: 1 addition & 1 deletion src/logLikMixHMM.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// log-likelihood of MHMM using log-space
#include <RcppArmadillo.h>
#include "reparma.h"
#include <omp.h>
#include "useomp.h"

// [[Rcpp::export]]
Rcpp::NumericVector logLikMixHMM(const arma::mat& transition, const arma::cube& emission,
Expand Down
2 changes: 1 addition & 1 deletion src/log_EM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "log_forward_backward.h"
#include "logsumexp.h"
#include <omp.h>
#include "useomp.h"
// [[Rcpp::export]]
Rcpp::List log_EM(const arma::mat& transition_, const arma::cube& emission_,
const arma::vec& init_, const arma::ucube& obs, const arma::uvec& nSymbols,
Expand Down
2 changes: 1 addition & 1 deletion src/log_EMx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "optcoef.h"
#include "logsumexp.h"
#include "reparma.h"
#include <omp.h>
#include "useomp.h"

// [[Rcpp::export]]
Rcpp::List log_EMx(const arma::mat& transition_, const arma::cube& emission_,
Expand Down
2 changes: 1 addition & 1 deletion src/log_forwardbackward.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Forward-backward algorithm for non-mixture hidden Markov models using log-space

#include "log_forward_backward.h"
#include <omp.h>
#include "useomp.h"

// [[Rcpp::export]]
Rcpp::List log_forwardbackward(const arma::mat& transition_, const arma::cube& emission_,
Expand Down
2 changes: 1 addition & 1 deletion src/log_forwardbackwardx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "log_forward_backward.h"
#include "reparma.h"
#include <omp.h>
#include "useomp.h"

// [[Rcpp::export]]
Rcpp::List log_forwardbackwardx(const arma::mat& transition_,
Expand Down
2 changes: 1 addition & 1 deletion src/log_internalBackward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "forward_backward.h"
#include "logsumexp.h"
#include <omp.h>
#include "useomp.h"

void log_internalBackward(const arma::mat& transition, const arma::cube& emission,
const arma::ucube& obs, arma::cube& beta, unsigned int threads) {
Expand Down
2 changes: 1 addition & 1 deletion src/log_internalForward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "forward_backward.h"
#include "logsumexp.h"
#include <omp.h>
#include "useomp.h"

void log_internalForward(const arma::mat& transition, const arma::cube& emission,
const arma::vec& init, const arma::ucube& obs, arma::cube& alpha, unsigned int threads) {
Expand Down
2 changes: 1 addition & 1 deletion src/log_logLikHMM.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// log-likelihood of HMM using log-space

#include "logsumexp.h"
#include <omp.h>
#include "useomp.h"

// [[Rcpp::export]]
Rcpp::NumericVector log_logLikHMM(const arma::mat& transition_, const arma::cube& emission_,
Expand Down
2 changes: 1 addition & 1 deletion src/log_logLikMixHMM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "logsumexp.h"
#include "reparma.h"
#include <omp.h>
#include "useomp.h"

// [[Rcpp::export]]
Rcpp::NumericVector log_logLikMixHMM(arma::mat transition, arma::cube emission, arma::vec init,
Expand Down
2 changes: 1 addition & 1 deletion src/log_objective.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "log_forward_backward.h"
#include "logsumexp.h"
#include <omp.h>
#include "useomp.h"

// [[Rcpp::export]]
Rcpp::List log_objective(const arma::mat& transition, const arma::cube& emission,
Expand Down
2 changes: 1 addition & 1 deletion src/log_objectivex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "logsumexp.h"
#include "reparma.h"

#include <omp.h>
#include "useomp.h"
// [[Rcpp::export]]
Rcpp::List log_objectivex(const arma::mat& transition, const arma::cube& emission,
const arma::vec& init, const arma::ucube& obs, const arma::umat& ANZ,
Expand Down
2 changes: 1 addition & 1 deletion src/objective.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// log-likelihood and gradients of HMM
#include "optcoef.h"
#include "forward_backward.h"
#include <omp.h>
#include "useomp.h"

// [[Rcpp::export]]
Rcpp::List objective(const arma::mat& transition, const arma::cube& emission,
Expand Down
2 changes: 1 addition & 1 deletion src/objectivex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "optcoef.h"
#include "forward_backward.h"
#include "reparma.h"
#include <omp.h>
#include "useomp.h"

// [[Rcpp::export]]
Rcpp::List objectivex(const arma::mat& transition, const arma::cube& emission,
Expand Down
3 changes: 3 additions & 0 deletions src/useomp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#ifdef _OPENMP
#include <omp.h>
#endif

0 comments on commit 6bebc7f

Please sign in to comment.