Skip to content

Commit 90178a5

Browse files
authored
Fix compilation problem on windows (#58)
* fix compilation problem * cleanup * put print_mutex.h back
1 parent 9d5e7de commit 90178a5

File tree

8 files changed

+13
-14
lines changed

8 files changed

+13
-14
lines changed

src/RcppExports.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ BEGIN_RCPP
5858
END_RCPP
5959
}
6060
// run_bgm_parallel
61-
Rcpp::List run_bgm_parallel(const arma::imat& observations, const arma::ivec& num_categories, double pairwise_scale, const std::string& edge_prior, const arma::mat& inclusion_probability, double beta_bernoulli_alpha, double beta_bernoulli_beta, double dirichlet_alpha, double lambda, const arma::imat& interaction_index_matrix, int iter, int warmup, const arma::imat& counts_per_category, const arma::imat& blume_capel_stats, double main_alpha, double main_beta, bool na_impute, const arma::imat& missing_index, const arma::uvec& is_ordinal_variable, const arma::ivec& baseline_category, bool edge_selection, const std::string& update_method, const arma::imat& pairwise_effect_indices, double target_accept, const arma::imat& pairwise_stats, int hmc_num_leapfrogs, int nuts_max_depth, bool learn_mass_matrix, int num_chains, int nThreads, uint64_t seed, int progress_type);
61+
Rcpp::List run_bgm_parallel(const arma::imat& observations, const arma::ivec& num_categories, double pairwise_scale, const std::string& edge_prior, const arma::mat& inclusion_probability, double beta_bernoulli_alpha, double beta_bernoulli_beta, double dirichlet_alpha, double lambda, const arma::imat& interaction_index_matrix, int iter, int warmup, const arma::imat& counts_per_category, const arma::imat& blume_capel_stats, double main_alpha, double main_beta, bool na_impute, const arma::imat& missing_index, const arma::uvec& is_ordinal_variable, const arma::ivec& baseline_category, bool edge_selection, const std::string& update_method, const arma::imat& pairwise_effect_indices, double target_accept, const arma::imat& pairwise_stats, int hmc_num_leapfrogs, int nuts_max_depth, bool learn_mass_matrix, int num_chains, int nThreads, int seed, int progress_type);
6262
RcppExport SEXP _bgms_run_bgm_parallel(SEXP observationsSEXP, SEXP num_categoriesSEXP, SEXP pairwise_scaleSEXP, SEXP edge_priorSEXP, SEXP inclusion_probabilitySEXP, SEXP beta_bernoulli_alphaSEXP, SEXP beta_bernoulli_betaSEXP, SEXP dirichlet_alphaSEXP, SEXP lambdaSEXP, SEXP interaction_index_matrixSEXP, SEXP iterSEXP, SEXP warmupSEXP, SEXP counts_per_categorySEXP, SEXP blume_capel_statsSEXP, SEXP main_alphaSEXP, SEXP main_betaSEXP, SEXP na_imputeSEXP, SEXP missing_indexSEXP, SEXP is_ordinal_variableSEXP, SEXP baseline_categorySEXP, SEXP edge_selectionSEXP, SEXP update_methodSEXP, SEXP pairwise_effect_indicesSEXP, SEXP target_acceptSEXP, SEXP pairwise_statsSEXP, SEXP hmc_num_leapfrogsSEXP, SEXP nuts_max_depthSEXP, SEXP learn_mass_matrixSEXP, SEXP num_chainsSEXP, SEXP nThreadsSEXP, SEXP seedSEXP, SEXP progress_typeSEXP) {
6363
BEGIN_RCPP
6464
Rcpp::RObject rcpp_result_gen;
@@ -93,7 +93,7 @@ BEGIN_RCPP
9393
Rcpp::traits::input_parameter< bool >::type learn_mass_matrix(learn_mass_matrixSEXP);
9494
Rcpp::traits::input_parameter< int >::type num_chains(num_chainsSEXP);
9595
Rcpp::traits::input_parameter< int >::type nThreads(nThreadsSEXP);
96-
Rcpp::traits::input_parameter< uint64_t >::type seed(seedSEXP);
96+
Rcpp::traits::input_parameter< int >::type seed(seedSEXP);
9797
Rcpp::traits::input_parameter< int >::type progress_type(progress_typeSEXP);
9898
rcpp_result_gen = Rcpp::wrap(run_bgm_parallel(observations, num_categories, pairwise_scale, edge_prior, inclusion_probability, beta_bernoulli_alpha, beta_bernoulli_beta, dirichlet_alpha, lambda, interaction_index_matrix, iter, warmup, counts_per_category, blume_capel_stats, main_alpha, main_beta, na_impute, missing_index, is_ordinal_variable, baseline_category, edge_selection, update_method, pairwise_effect_indices, target_accept, pairwise_stats, hmc_num_leapfrogs, nuts_max_depth, learn_mass_matrix, num_chains, nThreads, seed, progress_type));
9999
return rcpp_result_gen;

src/bgmCompare_parallel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// [[Rcpp::depends(RcppParallel, RcppArmadillo, dqrng)]]
2-
#include <RcppParallel.h>
32
#include <RcppArmadillo.h>
43
#include "bgmCompare_sampler.h"
4+
#include "rng_utils.h" // must be included before RcppParallel
5+
#include <RcppParallel.h>
56
#include <tbb/global_control.h>
67
#include <vector>
78
#include <string>
8-
#include "rng_utils.h"
99
#include "progress_manager.h"
1010
#include "sampler_output.h"
1111
#include "mcmc_adaptation.h"
@@ -219,7 +219,7 @@ struct GibbsCompareChainRunner : public Worker {
219219

220220
try {
221221
// per-chain RNG
222-
SafeRNG rng(chain_rngs[i]);
222+
SafeRNG rng = chain_rngs[i];
223223

224224
// make per-chain copies
225225
std::vector<arma::imat> counts_per_category = counts_per_category_master;

src/bgmCompare_sampler.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "mcmc_nuts.h"
1010
#include "mcmc_rwm.h"
1111
#include "mcmc_utils.h"
12-
#include "print_mutex.h"
1312
#include "rng_utils.h"
1413
#include "sampler_output.h"
1514
#include "explog_switch.h"
@@ -1646,7 +1645,6 @@ SamplerOutput run_gibbs_sampler_bgmCompare(
16461645
);
16471646

16481647
const int total_iter = warmup_schedule.total_warmup + iter;
1649-
const int print_every = std::max(1, total_iter / 10);
16501648

16511649
// --- Main Gibbs sampling loop
16521650
bool userInterrupt = false;

src/bgm_parallel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// [[Rcpp::depends(RcppParallel, RcppArmadillo, dqrng)]]
2-
#include <RcppParallel.h>
32
#include <RcppArmadillo.h>
3+
#include "rng_utils.h" // must be included before RcppParallel
4+
#include <RcppParallel.h>
45
#include "bgm_sampler.h"
56
#include <tbb/global_control.h>
67
#include <vector>
78
#include <string>
8-
#include "rng_utils.h"
99
#include "progress_manager.h"
1010
#include "mcmc_adaptation.h"
1111

@@ -297,7 +297,7 @@ Rcpp::List run_bgm_parallel(
297297
bool learn_mass_matrix,
298298
int num_chains,
299299
int nThreads,
300-
uint64_t seed,
300+
int seed,
301301
int progress_type
302302
) {
303303
std::vector<ChainResult> results(num_chains);

src/bgm_sampler.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <RcppArmadillo.h>
2-
#include <Rcpp.h>
32
#include "bgm_helper.h"
43
#include "bgm_logp_and_grad.h"
54
#include "bgm_sampler.h"

src/mcmc_nuts.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "mcmc_memoization.h"
55
#include "mcmc_nuts.h"
66
#include "mcmc_utils.h"
7-
#include <Rcpp.h>
87
#include "rng_utils.h"
98
using namespace Rcpp;
109

src/rng_utils.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// [[Rcpp::depends(BH)]]
22
#pragma once
33

4+
// the order of these two is mandatory, RcppArmadillo must com before dqrng
45
#include <RcppArmadillo.h>
56
#include <dqrng.h>
67
#include <dqrng_generator.h>
@@ -9,6 +10,8 @@
910
#include <random>
1011
#include <boost/random/beta_distribution.hpp>
1112

13+
// [[Rcpp::depends(dqrng, BH)]]
14+
1215
struct SafeRNG {
1316
dqrng::xoshiro256plusplus eng;
1417

@@ -107,4 +110,5 @@ inline arma::uvec arma_randperm(SafeRNG& rng, arma::uword n) {
107110
std::iota(out.begin(), out.end(), 0);
108111
std::shuffle(out.begin(), out.end(), rng.eng);
109112
return out;
110-
}
113+
}
114+

src/sbm_edge_prior.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <RcppArmadillo.h>
2-
#include <Rcpp.h>
32
#include "rng_utils.h"
43
#include "explog_switch.h"
54

0 commit comments

Comments
 (0)