57 questions
0
votes
1
answer
107
views
How to resolve the error: Error: package or namespace load failed for 'my_package' etc
R package using RcppParallel builds but fails to install due to undefined TBB symbols
Body:
I'm developing an R package using RcppParallel to compute distance matrix. The package builds successfully, ...
1
vote
0
answers
80
views
RcppParellel and RcppArmadillo seeds problems
I have an RcppArmadillo code that runs sequentially and I am trying to adapt it for parallel compilation with RcppParellel.
The code is a copy paste of sequential code and actually runs faster. Yet ...
0
votes
1
answer
68
views
Why does Rcpp + RcppParallel with Rcpp::List throw me a fatal error?
I run R + Rcpp + RcppParallel from RStudio.
I run a parallel loop that works if I do not use a Rcpp::List in the worker, but throws an abort if I use the Rcpp::List in the worker (even in a trivial ...
0
votes
1
answer
100
views
Cannot compile with RcppParallel on Windows
I have installed Rcpp, RcppParallel and I was testing simple function, written in .cpp file.
#include <RcppParallel.h>
#include <Rcpp.h>
#include <vector>
using namespace ...
1
vote
0
answers
96
views
Thread safe parallel list computation using RcppParallel
I'm attempting to write code in C++ that loops over an Rcpp::List of IntegerVectors. The computation itself is complicated to explain, but for the sake of example let's suppose that I wanted to take ...
0
votes
3
answers
507
views
Issue with library(RcppParallel) with {renv} in R
Problem: In R, I can run library(RcppParallel) in the usual way without issues but in an RStudio Project that uses {renv} for local dependency management, after running renv::install("...
1
vote
0
answers
86
views
R mclapply attempt in Rcpp
I would like someone who understands better than me to help me implement a mclapply with rcpp in a project I am working on. The fragment I want to transfer is this one, where data_by is a list of data....
0
votes
0
answers
55
views
How to convert a NumericVector to RcppParallel::RVector<float> or a NumericMatrix to RcppParallel::RMatrix<float>?
In a parallel code with Rcpp, I convert a NumericVector variable to RcppParallel::RVector<double>. I also convert a NumericMatrix variable to RcppParallel::RMatrix<double>.
To speed up the ...
1
vote
1
answer
122
views
Exporting RcppParallel::RVector vs std::vector
Consider the following serial example function:
// [[Rcpp::plugins(cpp20)]]
#include <Rcpp.h>
// [[Rcpp::export]]
Rcpp::NumericVector example_fun(int n) {
Rcpp::NumericVector result (n);
...
1
vote
1
answer
785
views
Impossible to install RcppParallel package
To install the package rstan in R, the package RcppParallel is required, but I'm not able to install it in R/4.3 on a Linux machine (cluster). I tried different solutions proposed (e.g., install from ...
0
votes
0
answers
74
views
Can Eigen vector and matrix classes be used directly within an RcppParallel worker?
I am fitting a statistical model whose likelihood and gradient evaluation depend on many complicated matrix operations, for which the Eigen library is very well-suited. I am working within Rcpp and ...
1
vote
0
answers
45
views
Sum on a RcppParallel::RMatrix<double>::Row gives wrong results
I have rewritten the example given in the package RcppParallel for the function ParallelReduce, to understand how it works. Instead of summing a RVector to a double, I've tried to sum each row of a ...
0
votes
1
answer
307
views
How do I resolve compile error in RcppParallel function which points to an RcppParallel header file
I'm trying to speed up numeric computation in my R code using RcppParallel and am attempting to edit an example that uses the Cpp sqrt() function to take the square root of each element of a matrix. ...
0
votes
0
answers
161
views
How to iterate a List in parallel with RcppParallel?
One of my inputs is a List of NumericVector. If I declare this as I would with regular (non paralllel) Rcpp code, I get a correct result at the end, but with the stack imbalance warnings.
Warning: ...
0
votes
1
answer
246
views
Why does my RcppParallel implementation of a user-defined function crash unexpectedly?
I have developed a dual chain markov monte carlo model designed to forecast loan portfolios in the excellent package Rcpp but have run into an issue trying to implement a parallelised version of these ...
3
votes
0
answers
170
views
RcppParallel equivalent of .combine=rbind
I would like to parallelize a for loop using parallelReduce of RcppParallel but struggle with joining the results because the dimension of the parallel output for each iteration is not known a priori. ...
0
votes
2
answers
264
views
Add RcppParallel requisites to the NAMESPACE of an R package automatically when compiling the package
I'm using RcppParallel in my own R package.
I know that I need to add Imports: RcppParallel to the DESCRIPTION file and importFrom(RcppParallel, RcppParallelLibs) to the NAMESPACE file.
My current ...
0
votes
0
answers
2k
views
Having installation issues with RcppParallel ( R)
I am a newbie/student to rstanarm and I having issues installing RcppParallel.
I have tried devtools::install_github("RcppCore/RcppParallel") and
install.packages("RcppParallel", ...
0
votes
0
answers
91
views
RcppParallel using References in workers
I have been experiment with using references for speed improvements. The (not working) trivial example below, probably won't see any improvements. However, I think by not copying the data into a ...
1
vote
1
answer
120
views
Accessing begin and end in RcppParallel (exmaple calculating the mean of a vector)
I'm having a problem while trying to learn RcppParallel.
I tried to modify the code form https://rcppcore.github.io/RcppParallel/ for the vector summation to calculate the mean of a vector instead, to ...
0
votes
0
answers
55
views
How to debug persistent perfomance issues with RcppParallel
I have have c++ code in which I parallelize some Monte Carlo Simulations using Rcpp and RcppParallel's parallelFor. The execution is, as expected, much faster then when using a non-parallel loop.
...
3
votes
1
answer
332
views
Parallelizing a non-trivial Gibbs Sampler in R: RcppThread vs. RcppParallel
Overview:
I'm interested in parallelizing (across chains) a Gibbs sampler for a non-trivial regression problem that I've already implemented in serial via Rcpp/RcppEigen. I've read the documentation ...
2
votes
1
answer
241
views
RcppParallel no matching function for call to 'transform'
I have a package posted on CRAN which uses multiple cores through the RcppParallel framework. It has the problem being installed on r-devel-linux-x86_64-fedora-clang and r-patched-solaris-x86. I get ...
0
votes
1
answer
301
views
RcppParallel worker with additional arguments
This is my first try with the RcppParallel package and I have to work with C++17 (Ubuntu)
I tried to stay close to the ParallelFor example of the developers site, but I need an additional (non-...
0
votes
0
answers
100
views
Inconsistent results between dqrng and R API for PRNG in RCPP
I am attempting to implement a particle filter within Rcpp and use OpenMP to parallelise the transition step. I am using dqrng to create threadsafe RNG with using the boost distribution functions as ...
1
vote
1
answer
280
views
RcppParallel to estimate distances between rows of two matrix in R
I am trying to use RcppParrallel to estimate distances between rows of two 3D-matrix and return a new matrix. I saw examples of Parallel Distance Matrix Calculation using parallelFor, but these ...
1
vote
1
answer
64
views
Can I dodge 'abstract class' in repeated 1-D integration using RcppNumerical
I am looking for a deterministic threadsafe Rcpp algorithm for 2-D numerical integration. RcppNumerical provides a partial interface to Cuba for multidimensional integration, but from my trials that ...
2
votes
1
answer
108
views
Not getting all() quicker using Rcpp
As I'm a bit new to Rcpp, I might be missing a trick here.
Let's create two matrices:
library(Rcpp)
library(microbenchmark)
P <- matrix(0, 200,500)
for(i in 1:500) P[,i] <- rep(rep(sample(0:1)...
0
votes
0
answers
364
views
R session aborted using RcppParallel
I'm trying to build an R package implementing Dijkstra algorithm using Rcpp and RcppParallel. You can see my work here. Now I want to add a new function and a strange behavior appears. When I compile ...
0
votes
1
answer
279
views
RcppParallel result changes with multiple threads
I'm new to Rcpp and RcppParallel. I'm trying to use RcppParallel to optimize my R code and now I'm making some toy codes for studying them.
Now I made a RcppParallel code and the result is different ...
0
votes
0
answers
130
views
convert RMatrix::Column to a NumericVector
How do you convet an RMatrix::Column to a NumericVector in RcppParallel?
e.g.
// [[Rcpp::depends(RcppParallel)]]
// [[Rcpp::plugins("cpp11")]]
#include <Rcpp.h>
#include <RcppParallel.h>
...
2
votes
1
answer
260
views
How to pass lambda function in a c++ functor?
I am pretty new at Rccp and Rccpparallel and I have trouble figuring out where I made mistake. So I want to create a function that do a power element wise in a matrix in parallel. I am following ...
0
votes
1
answer
71
views
Adding function pointers to Parallel Worker
Building off the example here Parallel Worker in namespace, I would like to employ function pointers with the Parallel Worker.
The code below produces an error along the lines of: "cannot initialize ...
0
votes
2
answers
159
views
Parallel Worker in namespace
This example is a follow up example from this earlier post. I am trying to move the Parallel Worker to its own cpp file and and declare it in the header file.
Calling 'mypackage' function ...
3
votes
2
answers
447
views
Fastest way to multithread doing quickselect on all columns or all rows of a matrix in Rcpp - OpenMP, RcppParallel or RcppThread
I was using this Rcpp code to do a quickselect on a vector of values, i.e. obtain the kth largest element from a vector in O(n) time (I saved this as qselect.cpp):
// [[Rcpp::depends(RcppArmadillo)]]
...
0
votes
1
answer
144
views
Rcpp::Function in parellel for section
I am trying to parallelize for cycle computing fitness value of individuals. For this whole algorithm I am using Rcpp, but fitness function is passed from R.
So I am trying to do something like this:
...
0
votes
0
answers
128
views
Nested namespaces in Rcpp
I have a working R package including the necessary R/Cpp working. My question here is more of a 'good practices' when using nested namespace.
Currently, my package has; 1) cost functions, 2) ...
0
votes
1
answer
846
views
Apply function to multiple groups using Rcpp and R function
I'm trying to apply a function to multiple groups/id's in r using the foreach package. It's taking forever to run using parallel processing via %dopar%, so I was wondering if it's possible to run the ...
4
votes
1
answer
188
views
Parallel Addition of Vectors using RcppParallel
I am trying to parallelise the addition of (large) vectors using RcppParallel. That's what I've come up with.
// [[Rcpp::depends(RcppParallel)]]
#include <RcppParallel.h>
#include <Rcpp.h>...
0
votes
1
answer
283
views
std::mt19937 in Rcpp
This problem arose from testing my R (RcppParallel) package on windows through the win-builder-r, as for my mac there is not a problem.
"error: 'mt19937' is not a member of 'std'"
Additionally, ...
0
votes
0
answers
292
views
Can we pass Rcpp::List or a vector of vectors to RcppParallel function?
I have an R list which I convert to vector of vectors in Rcpp. Now I want to use RcppParallel to use multiple cores. Can I pass such a list or vector of vectors to RcppParallel similar to ...
1
vote
2
answers
157
views
Calling 'mypackage' function within public worker
I know the problem I have is a thread-safety issue. As the code I have now will execute with 'seThreadOptions(1)'. My question is what would be a good practice to overcome this.
I know this: ...
0
votes
2
answers
347
views
Threadsafe function pointer with Rcpp and RcppParallel via std::shared_ptr
I would like to use a threadsafe function pointer to be applied in an RcppPrallel worker. But I have already problems with this tiny example. No matter if I use it in a package and add ...
1
vote
0
answers
228
views
R packages with Rcpp and nloptr
I have been building an r-package that runs RcppParallel and calls nloptr from the cpp in parallel. Currently, the package will not build as it can't find the 'nloptrAPI.h' file.
The build log ...
0
votes
1
answer
526
views
Rcppparallel bootstrap
I presume, or rather hope, that I have a singular fixable problem or perhaps many smaller ones and should give up. Either way I am relatively new to Rcpp and extremely uninformed on parallel ...
2
votes
2
answers
767
views
Seeding for multithreaded unif_rand()
I want to seed R's internal unif_rand() in a multithreaded environment. The code below generates a 2-column matrix of uniform random numbers within 2 threads. The results are interesting.
struct ...
2
votes
0
answers
185
views
Print to terminal in a multithreaded environment for CRAN R package
I am updating a CRAN package that needs C++ compilation. CRAN forbids std::cout << but allows Rcpp::Rcout <<. The latter however crashes the program in a multithreaded environment. I am ...
5
votes
1
answer
894
views
Rcpp Parallel or openmp for matrixvector product
I am trying to program the naive parallel version of Conjugate gradient, so I started with the simple Wikipedia algorithm, and I want to change the dot-products and MatrixVector products by their ...
1
vote
1
answer
408
views
RcppParallel RVector push_back or something similar?
I am using RcppParallel to speed up some calculations. However, I am running out of memory in the process, so I would like to save results within the Parallel loop that are pass some relevance ...
6
votes
1
answer
1k
views
Euclidean distance matrix performance between two shapes
The problem I am having is that I have to calculate a Euclidean distance matrix between shapes that can range from 20,000 up to 60,000 points, which produces 10-20GB amounts of data. I have to run ...