From 6197fafc4c72129897f478a0083dda57ca3146a4 Mon Sep 17 00:00:00 2001 From: Marcelo Mollinari Date: Mon, 12 Feb 2024 13:02:53 -0500 Subject: [PATCH] Update thread handling in RcppParallel --- R/pairwise_rf.R | 6 ++---- man/add_md_markers.Rd | 2 +- man/paralell_pairwise_discrete_rcpp.Rd | 3 +-- src/RcppExports.cpp | 4 ++-- src/pairwise_estimation_rcppparallel.cpp | 4 +--- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/R/pairwise_rf.R b/R/pairwise_rf.R index e65b0a8e..37a6a7e2 100755 --- a/R/pairwise_rf.R +++ b/R/pairwise_rf.R @@ -467,7 +467,7 @@ est_pairwise_rf2 <- function(input.seq, count.matrix.number = count.matrix.number, count.matrix.pos = count.matrix.pos, count.matrix.length = count.matrix.length, - tol = tol, threads = ncpus) + tol = tol) res[res == -1] = NA colnames(res) = c("Sh_P1","Sh_P2","rf","LOD_rf","LOD_ph") if (verbose) { @@ -508,8 +508,7 @@ paralell_pairwise_discrete_rcpp <- function(mrk.pairs, count.matrix.number, count.matrix.pos, count.matrix.length, - tol = .Machine$double.eps^0.25, - threads) + tol = .Machine$double.eps^0.25) { res <- .Call("pairwise_rf_estimation_disc_rcpp", as.matrix(mrk.pairs), @@ -524,7 +523,6 @@ paralell_pairwise_discrete_rcpp <- function(mrk.pairs, count.matrix.pos, count.matrix.length, tol = tol, - threads = threads, PACKAGE = "mappoly") return(res) ## return(lapply(res, format_rf)) diff --git a/man/add_md_markers.Rd b/man/add_md_markers.Rd index cf7bba54..302fd827 100644 --- a/man/add_md_markers.Rd +++ b/man/add_md_markers.Rd @@ -15,7 +15,7 @@ add_md_markers( thresh = 500, extend.tail = 50, method = c("hmm", "wMDS_to_1D_pc"), - verbose = T + verbose = TRUE ) } \arguments{ diff --git a/man/paralell_pairwise_discrete_rcpp.Rd b/man/paralell_pairwise_discrete_rcpp.Rd index bfe703b4..48c894f1 100644 --- a/man/paralell_pairwise_discrete_rcpp.Rd +++ b/man/paralell_pairwise_discrete_rcpp.Rd @@ -16,8 +16,7 @@ paralell_pairwise_discrete_rcpp( count.matrix.number, count.matrix.pos, count.matrix.length, - tol = .Machine$double.eps^0.25, - threads + tol = .Machine$double.eps^0.25 ) } \arguments{ diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 7e21fe7e..f10427fb 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -72,7 +72,7 @@ RcppExport SEXP est_map_hmm_highprec(void *, void *, void *, void *, void *, voi RcppExport SEXP get_counts_single_parent_cpp(void *, void *, void *, void *, void *, void *); RcppExport SEXP loglike_hmm(void *, void *, void *, void *, void *, void *); RcppExport SEXP pairwise_rf_estimation_disc(void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP pairwise_rf_estimation_disc_rcpp(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *); +RcppExport SEXP pairwise_rf_estimation_disc_rcpp(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *); RcppExport SEXP pairwise_rf_estimation_prob(void *, void *, void *, void *, void *, void *, void *, void *); RcppExport SEXP poly_hmm_est_CPP(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *); @@ -94,7 +94,7 @@ static const R_CallMethodDef CallEntries[] = { {"get_counts_single_parent_cpp", (DL_FUNC) &get_counts_single_parent_cpp, 6}, {"loglike_hmm", (DL_FUNC) &loglike_hmm, 6}, {"pairwise_rf_estimation_disc", (DL_FUNC) &pairwise_rf_estimation_disc, 7}, - {"pairwise_rf_estimation_disc_rcpp", (DL_FUNC) &pairwise_rf_estimation_disc_rcpp, 13}, + {"pairwise_rf_estimation_disc_rcpp", (DL_FUNC) &pairwise_rf_estimation_disc_rcpp, 12}, {"pairwise_rf_estimation_prob", (DL_FUNC) &pairwise_rf_estimation_prob, 8}, {"poly_hmm_est_CPP", (DL_FUNC) &poly_hmm_est_CPP, 13}, {NULL, NULL, 0} diff --git a/src/pairwise_estimation_rcppparallel.cpp b/src/pairwise_estimation_rcppparallel.cpp index c586bd49..1ec3dcc8 100755 --- a/src/pairwise_estimation_rcppparallel.cpp +++ b/src/pairwise_estimation_rcppparallel.cpp @@ -416,8 +416,7 @@ RcppExport SEXP pairwise_rf_estimation_disc_rcpp(SEXP mrk_pairs_R, SEXP count_matrix_number_R, SEXP count_matrix_pos_R, SEXP count_matrix_length_R, - SEXP tol_R, - SEXP threads_R) + SEXP tol_R) { NumericMatrix mrk_pairs = mrk_pairs_R; NumericMatrix geno = geno_R; @@ -432,7 +431,6 @@ RcppExport SEXP pairwise_rf_estimation_disc_rcpp(SEXP mrk_pairs_R, NumericMatrix out(mrk_pairs.ncol(), 5); int m = as(m_R); double tol = as(tol_R); - int threads = as(threads_R); int n_ind = geno.ncol(); rf_two_point_parallel RF_two_point_parallel(mrk_pairs, geno, dP, dQ, count_vector,