Re: [Rcpp-devel] Question on performance and strategy

2018-09-22 Thread Jordi Molins
I have access to a machine (not a desktop) with quite a few CPUs and quite a few GPUs. So, if for example there are 100 CPU cores and 100,000 GPU cores, I guess that I could do a foreach for these 100 CPU cores for an R function, and then if this R function calls RcppArrayFire, RcppArrayFire could

Re: [Rcpp-devel] Question on performance

2018-09-22 Thread Dirk Eddelbuettel
On 22 September 2018 at 12:36, Michael Weylandt wrote: | I don't have time right now, but the offending line is here: | | https://github.com/jesusfv/Comparison-Programming-Languages-Economics/blob/master/RBC_Rcpp.R#L62 | | which calls `sourceCpp` repeatedly on each loop iteration. | | Should

Re: [Rcpp-devel] Question on performance

2018-09-22 Thread Michael Weylandt
I don't have time right now, but the offending line is here: https://github.com/jesusfv/Comparison-Programming-Languages-Economics/blob/master/RBC_Rcpp.R#L62 which calls `sourceCpp` repeatedly on each loop iteration. Should be a one line change to move it outside the loop and un-sully the good n

Re: [Rcpp-devel] Question on performance and strategy

2018-09-22 Thread Dirk Eddelbuettel
On 22 September 2018 at 17:52, Jordi Molins wrote: | In relation to doing "CPU x GPU": what would happen if I have 3 variables | to be parallelized (independent from each other, no interdependencies) and | then I create an R function, using RcppArrayFire, to GPU-parallelize two of | them. Then, I

Re: [Rcpp-devel] Question on performance

2018-09-22 Thread Dirk Eddelbuettel
On 22 September 2018 at 19:15, Iñaki Ucar wrote: | FYI, you can find the code here: | | https://github.com/jesusfv/Comparison-Programming-Languages-Economics Nice catch! Have not had time to look. Any volunteers willing to dive in, ie fork or clone the thing and clean up? Happy to help. Dirk

Re: [Rcpp-devel] Question on performance

2018-09-22 Thread Iñaki Ucar
FYI, you can find the code here: https://github.com/jesusfv/Comparison-Programming-Languages-Economics El sáb., 22 sept. 2018 a las 15:11, Dirk Eddelbuettel () escribió: > > > Jordi, > > On 22 September 2018 at 09:18, Georgi Boshnakov wrote: > | I don’t see any code going with the revised versio

Re: [Rcpp-devel] Question on performance

2018-09-22 Thread Kyle Baron
On Sat, Sep 22, 2018 at 8:11 AM Dirk Eddelbuettel wrote: > > But for any non-trivial example the cost of that will be well under, say, > 1% > while still getting a "many times" speedup over alternative R solutions. > So > a win for most people. Hence 1444 packages on CRAN using it. Those people

Re: [Rcpp-devel] Question on performance and strategy

2018-09-22 Thread Jordi Molins
Thank you, Dirk. For sure I will follow your advice, and I will try / experiment. From your comment, I will probably try RcppArrayFire first, rather than RcppParallel. In relation to doing "CPU x GPU": what would happen if I have 3 variables to be parallelized (independent from each other, no inte

Re: [Rcpp-devel] Question on performance and strategy

2018-09-22 Thread Dirk Eddelbuettel
Jordi, RcppParallel uses _thread_ parallelism on the CPU. RcppArrayFire can use that too, but can also use two GPU related mechanisms. But those do not give you extra CPUs, so in short you cannot do "CPU x GPU". None of this is Rcpp specific. But the respective articles on the RcppGallery are

[Rcpp-devel] Question on performance and strategy

2018-09-22 Thread Jordi Molins
Hello, I am new in this distribution list. I am using Rcpp and RcppArmadillo for my project. Now, I will have access to a relatively big computer, with both CPUs and GPUs. And I want to take advantage of it. So far, I am calling from C++ a R function (the nls.lm from minpack.lm, which is a port o

Re: [Rcpp-devel] Question on performance

2018-09-22 Thread Dirk Eddelbuettel
Jordi, On 22 September 2018 at 09:18, Georgi Boshnakov wrote: | I don’t see any code going with the revised version, but | looking at the code coming with the original paper, see http://economics.sas.upenn.edu/~jesusfv/RBC_codes.zip, | the following points come up: All excellent points. Jordi

Re: [Rcpp-devel] Question on performance

2018-09-22 Thread Georgi Boshnakov
Hi, I don’t see any code going with the revised version, but looking at the code coming with the original paper, see http://economics.sas.upenn.edu/~jesusfv/RBC_codes.zip, the following points come up: 1)There is no Rcpp code, so there is no way to verify the claims about Rcpp. 2)It is not at

[Rcpp-devel] Question on performance

2018-09-22 Thread Jordi Molins
Hello, I am new in this distribution list. I am using Rcpp for my project, and I enjoy the Rcpp implementation quite a lot. I have read the paper https://www.sas.upenn.edu/~jesusfv/Update_March_23_2018.pdf and I see the performance of Rcpp is about 4x times slower than C++ proper code, or 3x times