Tag Archives: Windows

Is the smartest way to parallelize this ARIMA function within R? Only for Windows? Use quantstart and backtest R packages?

Is the smartest way to parallelize this ARIMA function within R? Only for Windows? Use quantstart and backtest R packages?

This came from https://stat.ethz.ch/pipermail/r-sig-finance/2011q2/008143.html

I don’t think this is the most intelligent way to parallelize this. Comment on what you think!

 

The easiest probably would be to use the multicore package (linux) on
one machine, but if you’re feeling ambitious, there’s also the
possibility of using doSNOW, but there’s some small idosyncracies that
will leave you (or at least it did for me) pulling your hair out trying
to figure out why certain things aren’t working.

If you’re on Windows only, another single box solution would be the
“doSMP” and “foreach” packages that were released by Revolution into CRAN.

here’s a short example of how I use it on Windows (I have a more
complicated multiple computer script buried somewhere using doSNOW on
linux32):

require(doSMP)
require(foreach)

clust <- startWorkers(4)
registerDoSMP(clust)

symbols = c(“SPX”,”DIA”,”QQQQ”)

# the function that you want to parallelize, gets exported to each
“node” — could insert your backtest code here
parallel.arima <- function(data) {
library(forecast)
library(quantmod)
tmp = get(data)
fit = auto.arima(ts(Cl(tmp)), approximation=TRUE, allowdrift=TRUE,
stepwise=TRUE)
}

res <- foreach(dat=symbols, .export=symbols) %dopar% parallel.arima(dat))

There’s more info on the r-sig-hpc list regarding some of the finer
details of the packages mentioned above. Standard disclaimer, this
probably isn’t the “best” way to do it but it should give you some idea
of where to start.

HTH,
C

On 06/24/2011 07:00 AM, benjamin sigel wrote:
> Hi, > > I would like to run multiple backtests with R on intraday data, using > “quantstrat” and “backtest package” and I was wondering what would be the > most time efficient hardware solution between these two: > > – 1 PC: *1 Quad-Core* (Intel® Core™ i5-2300, 2.8 GHz (up to 3.1 GHz with > Turbo Boost) /6GB installed DDR3 RAM (1066 MHz) + *16GB maximum RAM capacity > * > > OR > > – *2 PC’s Hooked-up:* 2 Dual-core (Intel® Core™ i3-550 Processor, 3.20 GHz, > 4 MB Smart Cache, 4GB DDR3 + *maximum expandable memory 16GB* *each* > > Many Thanks for your help, > > Ben

Warning! Certain R packages may run not on Windows with as RCPP may be dependency. Would like a complete list?

Warning! Certain R packages may run not on Windows with as RCPP may be dependency. Would like a complete list?

As I am new to R using a mixed environment of Windows and Linux like Ubuntu or CentOS, I am finding certain R packages will not install properly on Windows. As I I really like RStudio because of its simplicity to install R packages, I get some strange messages of certain packages that do not load properly due to the so-called current version of R cannot be installed. I am using 2.1.5 but may have found a solution.

What is the solution?

That same R package that gives you install problems on Windows may actually work within an Linux environment. As a result, it could be the R package maybe the result of using RCpp as a dependency. I have even seen certain R packages get built or compiled during the install process. It seems RCpp is used which needs a local version of GCC to build. GCC is a GNU C/C++ compiler for Linux or Unix.  As a result, if you are using Windows, you will most likely not have GCC installed on your Windows desktop.

What to do?
You really have two choices:

  1. Build a Linux virtual machine on a virtualization environment appliance like VMWare or free Oracle Sun Virtual Box. If you go for Virtual Box, everything is free. Nice! There is lots of opening YouTube videos on how to do this so I won’t go there. Also, don’t forget to install your GCC with an ‘appt-get install gcc’ or ‘yum install gcc’ depending your Linux flavor. Again, you can easily find loads of YouTube videos on how to do this.
  2. Your other choice is something I am not a fan of but nevertheless you should know about. If you are not a fan of Linux, you can always load MINGW onto Windows and then separately install GCC. Again, I have verified there are so many YouTube videos showing how to do this.

 

I know this could be a pain for some but this is why I really like RStudio which makes my R experience so much better.

 

I am also looking for anyone who has experienced any R packages that need to be locally compiled with GCC, can you please leave a comment on your experience and which R package? It makes everyone’s life so much easier if can be compiled into one area.

Thanks for that!

P.S. You may want to know about our upcoming presentations in R topics at my R/Matlab Meetup for Financial specialists!

 

How to do parallel R loops within Windows and Linux. No more expensive Matlab worker licenses

How to do parallel R loops within Windows and Linux. No more expensive Matlab worker licenses

The major reasons I switched from Matlab was for exactly this. Under Matlab, the worker licenses will kill but now you can you can do this for free under R. Thanks to makers of these adequate R packages.

If you follow this tutorial

http://viksalgorithms.blogspot.ca/2012/01/parallel-r-loops-for-windows-and-linux.html

You should hjave no problems executing these commands as I tried with no issues. Just do note the proper R packages you need in your backend depending on your operating system of Windows versus Linux.

Advantages of R in high frequency trading with Redis NOSQL, doRedis, dot NET C# HFT on Linux and Windows

Advantages of R in high frequency trading with Redis NOSQL, doRedis, dot NET C# HFT on Linux and Windows

I talk about the advantages of this stack for an High Frequency Trading environment. This of couse includes the advantages of R over something like Matlab.

[youtube_sc url=”9QsWeqwyxa0″ playlist=”HFT with Redis NOSQL, R doRedis dot NET C Sharp trading platform on Linux and Windows ” title=”HFT%20with%20Redis%20NOSQL,%20R%20doRedis%20dot%20NET%20C%20Sharp%20trading%20platform%20on%20Linux%20and%20Windows%20″]

Here is an example doRedis R interation in RStudio with a remote Redis server:

registerDoRedis(queue=’jobs’,host=”192.168.2.15″,port=6379)
> library(‘doRedis’)
Loading required package: rredis
Loading required package: foreach
foreach: simple, scalable parallel programming from Revolution Analytics
Use Revolution R for scalability, fault tolerance and more.
http://www.revolutionanalytics.com
Loading required package: iterators
> registerDoRedis(‘jobs’)

> registerDoRedis(‘jobs’,’92.168.2.15′,’6379′)

> registerDoRedis(queue=’jobs’,host=’92.168.2.15′,port=’6379′)

> registerDoRedis(queue=’jobs’,host=’192.168.2.15′,port=’6379′)
> startLocalWorkers(n=2,queue=’jobs’,host=’192.168.2.15′,port=’6379′)
> removeQueue(‘jobs’)
[1] TRUE
> startLocalWorkers(n=2,queue=’jobs’,host=’192.168.2.15′,port=’6379′)
> startLocalWorkers(n=2,queue=’jobs’,host=’192.168.2.15′,port=’6379′)
> removeQueue(‘jobs’)
[1] TRUE
> startLocalWorkers(n=2,queue=’jobs’,host=’192.168.2.15′,port=’6379′)
> foreach(icount(10),.combine=sum,.multicombine=TRUE,.inorder=FALSE) %dopar% 4*sum((runif(1000000)^2 + runif(1000000)^2)<1)/10000000
[1] 3.141388

From http://cran.r-project.org/web/packages/doRedis/vignettes/doRedis.pdf