Thursday, November 13, 2014

Adventures in RCpp

I spent yesterday looking into using C++ within R as an environment for neural network simulations (NNs are the classic case where iteration n+1 depends on the output of iteration n, so they do not vectorize easily and hence tend to be rather slow in plain R). R's RCpp package is intended to make R and C++ integration easy. Looking promising so far, but this cartoon Charlotte Edmunds showed me is particularly apt :-) http://xkcd.com/1445/


2 comments:

  1. Bill Simpson writes:

    I guess you know about the byte code compiler, cmpfun().

    There are some exciting new implementations of R. While they all try
    to stick as closely as possible to the existing language definition,
    they improve speed by using ideas from modern interpreter design. The
    four most mature open-source projects are:

    pqR (pretty quick R) by Radford Neal. Built on top of R 2.15.0, it
    fixes many obvious performance issues, and provides better memory
    management and some support for automatic multithreading.

    Renjin by BeDataDriven. Renjin uses the Java virtual machine, and
    has an extensive test suite.

    FastR by a team from Purdue. FastR is similar to Renjin, but it
    makes more ambitious optimisations and is somewhat less mature.

    Riposte by Justin Talbot and Zachary DeVito. Riposte is
    experimental and ambitious. For the parts of R it implements, it is
    extremely fast. Riposte is described in more detail in Riposte: A
    Trace-Driven Compiler and Parallel VM for Vector Code in R.

    These are roughly ordered from most practical to most ambitious.

    http://radfordneal.wordpress.com/.../deferred-evaluation.../

    ReplyDelete
  2. Bill also writes - The last option I'll mention is called Julia. Julia is more similar to Matlab than to R. However some R people are getting involved, including such notables as Douglas Bates. It can be very fast, about 1/2 as fast as C. http://julialang.org/

    ReplyDelete