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
6
votes
1 answer

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 each of these calculates thousands of times so 20GB…
JJL
  • 342
  • 2
  • 17
6
votes
1 answer

How to select a row or column of RMatrix in RcppParallel

I need to work with RcppParallel::RMatrix. Previously I worked with Rcpp only. But now for RcppParallel I need a documention Like What Rcpp has. For Example I Rcpp::NumericMatrix We can select a row or column with placeholder "_" like…
SirSaleh
  • 1,452
  • 3
  • 23
  • 39
4
votes
1 answer

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 #include #include using namespace RcppParallel; using…
mce
  • 107
  • 1
  • 6
4
votes
1 answer

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 appropriate parallel version, The Rcppparallel…
3
votes
0 answers

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. With the foreach package in R, this can be done…
Smelton
  • 31
  • 3
3
votes
1 answer

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 for RcppParallel and RcppThread and I want to know…
Adam
  • 55
  • 7
3
votes
2 answers

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)]] #include using namespace…
Tom Wenseleers
  • 7,535
  • 7
  • 63
  • 103
2
votes
1 answer

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 the following error messages (there are couple of…
Bogdan
  • 864
  • 10
  • 18
2
votes
1 answer

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), 2), 25) Parent_Check <- matrix(0, nrow(P),…
Nick
  • 3,262
  • 30
  • 44
2
votes
1 answer

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 rcppParallel examples. On one core the code compiles…
JacobJacox
  • 917
  • 5
  • 14
2
votes
2 answers

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 mtRunif: public RcppParallel::Worker { int Nrow; //…
user2961927
  • 1,290
  • 1
  • 14
  • 22
2
votes
0 answers

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 using RcppParallel for multithreading. Is there an alternative…
user2961927
  • 1,290
  • 1
  • 14
  • 22
2
votes
1 answer

How to create thread-safe wrap of Rcpp::CharacterMatrix with RcppParallel?

I have a task where I need to process a large matrix (millions of rows, hundreds of columns) of character strings. Each row operation is independent. As such, I would like to exploit some parallel computing to increase the speed of the overall…
Peter
  • 7,460
  • 2
  • 47
  • 68
1
vote
1 answer

Exporting RcppParallel::RVector vs std::vector

Consider the following serial example function: // [[Rcpp::plugins(cpp20)]] #include // [[Rcpp::export]] Rcpp::NumericVector example_fun(int n) { Rcpp::NumericVector result (n); for(int i = 0; i < n; ++i) { result[i] =…
Chr
  • 1,017
  • 1
  • 8
  • 29
1
vote
0 answers

Sum on a RcppParallel::RMatrix::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 RMatrix to obtain a RVector. It seems to work, but…
Maxime2506
  • 11
  • 2
1
2 3 4