Questions tagged [rcppparallel]

RcppParallel provides a system for R programmers to easily develop portable parallel algorithms.

The RcppParallel homepage contains usage instructions and examples.

53 questions
1
vote
1 answer

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 see if I understand the general principle. My…
Jakob J
  • 13
  • 4
1
vote
1 answer

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 calculations come from a single matrix with a fixed…
1
vote
1 answer

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 appears not to be threadsafe in RcppParallel, and…
1
vote
2 answers

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: Threadsafe function pointer with Rcpp and RcppParallel…
skatz
  • 115
  • 7
1
vote
0 answers

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 outputs: * checking dependencies in R code ...…
skatz
  • 115
  • 7
1
vote
1 answer

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 threshold. Below is a toy example to illustrate my…
thc
  • 9,527
  • 1
  • 24
  • 39
1
vote
1 answer

RcppParallel Parallelizing distance computation: segfault

I have a matrix, for which I want to compute the distance (let's say Euclidean) between the ith row and every other row(i.e. I want the ith row of the pairwise distance matrix). #include #include #include #include…
user2804929
  • 117
  • 1
  • 7
1
vote
0 answers

Is it possible to use RcppParallel with Eigen's SparseMatrix?

I'm trying to port a function that transforms all non-zero entries in a sparsematrix using RcppEigen to run in parallel with RcppParallel but I can't get it to work. I.e. with this source: #include #include using…
jtatria
  • 527
  • 3
  • 12
1
vote
0 answers

RcppParallel and C++. Inconsistent results

I've been playing around with RcppParallel and coded up a fairly simple example to figure out how things work. The code is displayed below. The function float pdf(double x, double sigma) calculates a scaled version of a Gaussian distribution with…
1
vote
2 answers

Undefined reference to a custom function in a worker (C++ and RcppParallel)

I'm new to C++ programming, trying to experiment with Rcpp through R. I created a function to produce all possible k-mers from a string. It works well in the serial form of it: #include #include #include #include…
IsoBar
  • 405
  • 3
  • 10
0
votes
0 answers

How to pass an array variable from R to C++ in a parallel Rcpp code in a thread safe way?

I would like to pass an array in a parallel code with RcppParallel. First, I can pass an array with arma::cube. Is an arma::cube variable thread safe in a parallel code? Second, to make a NumericVector thread safe, we can convert it to…
Emmanuel Hamel
  • 1,769
  • 7
  • 19
0
votes
0 answers

How to convert a NumericVector to RcppParallel::RVector or a NumericMatrix to RcppParallel::RMatrix?

In a parallel code with Rcpp, I convert a NumericVector variable to RcppParallel::RVector. I also convert a NumericMatrix variable to RcppParallel::RMatrix. To speed up the code, I would like to use float variables instead of double.…
Emmanuel Hamel
  • 1,769
  • 7
  • 19
0
votes
0 answers

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 source, from github etc) but none of them…
Anthony
  • 377
  • 2
  • 6
  • 13
0
votes
0 answers

Rcpp matrix entrywise exponential calculation using omp parallelization

I want to calculate the entrywise exponential of a large matrix X and store the resule in another matrix Y using omp parallelization in Rcpp (or maybe RcppArmadillo). Using regular omp parallelization method such as the following Rcpp code: double…
0
votes
0 answers

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 having great success with RcppEigen. My…
astring
  • 1
  • 1