Re: [Rcpp-devel] Using Rcpp::Function in parallel with TBB mutex lock & a reference.

2025-02-07 Thread Kumar MS
Thank you Dirk. Your observation is correct. I am left with two questions. As always, I appreciate your answers. 1. Except for this single step of calling an R function (model matrix-like objects that are being created by an external library in R), all my other computations are now implemented in

Re: [Rcpp-devel] Using Rcpp::Function in parallel with TBB mutex lock & a reference.

2025-02-07 Thread Dirk Eddelbuettel
Hi Kumar, >From a quick look you borrow the 'Worker' object from RcppParallel. But where (as far as I recall) all posted examples of RcppParallel do _not_ put any R objects inside a Worker instance, you put some there. That violates the recommendation in Writing R Extensions. So I think the outc

[Rcpp-devel] Using Rcpp::Function in parallel with TBB mutex lock & a reference.

2025-02-07 Thread Kumar MS
Hello Rcpp developers, The following R/Rcpp code attempts to take in a data frame, a model formula (passed as string), and uses Rcpp::Function to call R's model matrix function to create model matrices B times in parallel. Each time a model matrix is created, it is formed after permuting a given