Skip to content

Final Summary of GSOC

This is just a quick note to mark my progress at the official closure of GSOC.

The SPCIO-IO code is completed and available on Github.

I have successfully implemented parallelized versions of statistical functions which will be available for users of the package. One technique I have employed is using the small OpenBlasThreads package (see previous post) to change the number of threads employed, within a function. Thus when explicit parallelization is needed the threads are set to 1, and then when an implicit parallelization approach is later available, the threads are increased (this was sued for the spc.fit.poly functions).

Both Windows and Ubuntu versions of each package are available.

I did not, however, make a breakthrough as to implementing data.table or a similar underlying structure to handle large memory spectral data, without costly copying of memory.

Gladly, I hope to continue to work on the package over the coming months, and since I am now back in Ireland, I will use this blog to log any updates or developments in my continued work on the project.

I am currently looking into developing versions of statistical functions using RCPP to speed up their operation without the memory overhead of parallelization. I found an old conversation on rcpp-devel about using C functions from other pacakges. After some experimentation with different techniques I have gone with Dirk’s suggestion of reinstalling the relevant code locally and running it from C++ as, e.g. external C code. A further happy consequence of this approach has been that the closer examination of the code for loess (loess.R, loess.c, loess.f) has helped me see a short-cut, given the spc.loess’ constraints, which both further speeds up the code, and lowers the memory overhead for parallelization.

To explain the above a little more, the “embarrassingly parallel” nature of many functions as performed on hyperSpec data often has the further consequence that many preprocessing steps are basically superfluous once they have been performed for one spectrum. Thus, to take the example of loess, once the additional parameters have been discerned for the first spectrum, these can be used for every following spectrum, and we can directly call the C function (loess_raw.c in this case) with these values. This has the additional benefit that the memory overhead is decreased. However, where memory overhead still poses a barrier it is possible to achieve a speed up by calling the C code from Rcpp, which appears to present a speed gain, I think since there in only one call from R to Rcpp, rather than one to C for each spectrum.

I hope to experiment more with data.table and related packages, and it is interesting to consider how and whether any of these steps can be combined with it for further performance enhancements.

Altering OpenBlas Threads

It’s been some time since I posted anything. There are several strands in the notes, but this is the first issue to be resolved to completion. A while back I said I was having trouble changing the number of OpenBlas threads from within an R session. Before a session, I can use “export OPENBLAS_NUM_THREADS=x’ but from within a session, approaches such as ‘Sys.setenv(‘OPENBLAS_NUM_THREADS’=y) had no effect. I posted a question about this on r-sig-hpc but I did not receive a definitive answer. This kind of control is quite important – since sometimes implicit BLAS can slow down operations, it is desirable to have on line control over the number of threads to be evoked for certain functions.

I returned to this question recently, having noticed that Xianyi and co at OpenBlas seem to have made improvements for the SandyBridge processors. I reinstalled OpenBlas (note: this discussion pertains to a source installation of OpenBlas with their recommended settings and installation directories etc). On foot of this I reattempted to use their set_openblas_num_threads(int) function and, with some help from Xianyi, got it working in C++ with armadillo, and then created a wrapper for it that is callable from R.

There is a second, possibly surprising improvement, provided by set_openblas_num_threads(int). When I use “export OPENBLAS_NUM_THREADS=x”, implicit parallelization employs 4 threads, for all x >= 4, on my 4 dual-core system. However with set_openblas_num_threads, I can utilize all 8. I am not sure why this is the case, but this seems to be a useful side consequence of the wrapper function.

I have made a mini-package of the function (1 R file, 1 .c file, etc.) and also post below an inline version which can be called from the R REPL. Note that this package works for linux/ubuntu only – the openblas_set_num_threads(int) function for Windows OpenBlas is currently only a dummy, according to their site, but I assume a full function might be forthcoming. Thus, while my package is currently extremely small, any such additions to OPENBLAS’ capacities will be accommodated in due course. Also, further features may be added if a need arises. Please tell me if you have any ideas. Note the extern declaration below may not be strictly necessary – it gives an implicit declaration warning on my machine, but seems to work fine.

require(inline)
openblas.set.num.threads <- cfunction( signature(ipt="integer"),
      body = 'openblas_set_num_threads(*ipt);',
      otherdefs = c ('extern void openblas_set_num_threads(int);'),
      libargs = c ('-L/opt/openblas/lib -lopenblas'),
      language = "C",
      convention = ".C"
      )

As far as I can make out thus far, the function alters the number of threads for that session alone and thus e.g., if 2 sessions of R are opened independently from different terminals, then they each retain and maintain their own thread settings. This leads immediately to the question as to how these settings work with parallelization. It seems to be the case that makePSOCKCluster() and makeForkCluster() differ here, in that a ForkCluster inherits its parent’s variables, and hence, if openblas.set.num.threads(x) is set before the cluster is created, then the cluster’s cores inherit the x value and are effected by the new settings. (If however openblas.num.threads is set after a cluster is created then this seems to have no effect on the cluster, as one would expect.) How to use this feature to good effect is another matter however, since on preliminary cases, this generally appears to degrade performance, but more on this to follow.

The mini-package is here .

Package installation. There is an edited out PKG_LIBS value in the Makevars file in src/, for path opt/openblas. Either decompress, uncomment and recompress, if this is the right path, or send the linker argument to the INSTALL, e.g. like this:

R CMD INSTALL OpenBlasThreads –configure-args=’PKG_LIBS=-L/path/to/openblas/lib -lopenblas’

Recapitulation on progress thus far

Before I go on holidays, I will give a brief survey of how I see the work so far.

1) File-IO: almost complete – there is a residing issue of how to deal with optional data values whose types value. This is not a big problem, but it is a bit messy, and I am still undecided as to what is the best solution. This can be pushed through in a matter of a couple of hours once I set on the best approch.

2) Improving Bottleneck Functions:
      (i) collapse: almost complete – the same issue as above – both of these will be resolved by the same code.
      (ii) spc.loess: initial version using doMC has been pushed to the repository. I will experiment with some other approaches but the performance gain is already quite satisfactory in my opinion.

3) Implicit BLAS: nothing published on this yet. However both myself and Claudia have preparatory work under way. I have openblas installed as R’s shared BLAS and its performance improvement for R’s threaded linear operations (crossprod etc.) is impressive. The problem is, I have not been able to find a way to set the number of threads which openblas employs from within an R session, rather than before starting R. This is an important issue since, as I said in passing in my spc.loess post, an increase in OPENBLAS_NUM_THREADS corresponds to a deterioration in performance for functions such as spc.loess(). I have posted a request for advice on this matter on the high-performance R mailing list (r-sig-hpc) and am awaiting a response. I also have several routes I want to explore, such as installing R statically linked to openblas. My present concern is that unless we can find a way to control the threads for implicit BLAS, we might have to give way for explicit parallelization, since the most expensive processes in hyperSpec are probably the bottleneck functions. Hopefully we will soon have a solution to this problem we can post. Otherwise I will document the issue in more detail in a future post or posts.

To wrap up, I think good progress has been made thus far. At the current rate we are on track to achieve all of our milestones. The big unknown at the moment is the implicit BLAS question. However, and because of this, I am working on all aspects of the project simultaneously, so the openblas question is not currently a bottleneck to the general progress of the project.

Optimized Collapse Function

I remarked in yesterday’s post that another function that poses a bottleneck is the collapse function. This function unites several hyperSpec objects by creating a new wavelength containing all unique points from all spectra, and assigning NAs to each pre-existent spectrum where a value does not exist.
This struck me as a case where using C++’s faster loops, along with std::maps would be the best course. Maps are based on red-black trees, and hence allow logarithmic storage and retrieval. They are also innately ordered and thus provide ascending data points for free. Finally, they also make it easy to store unique values only.
The basic idea of the algorithm was to map all wavelengths as keys in a std::map, in a first pass through the list of S4 hyperSpec objects. Then I iterate through the map and assign ascending ints to the value of the map. Then I create a matrix and traverse each object assigning each spectral value to its position via the index corresponding to the wavelength in the map.
I have thus far only made a rough copy of this function – there are a few nitty gritty details of the hyperSpec objects (e.g. the type differences of their optional data values) that I have not decided exactly how to handle – however it is clear that these will add only a constant overhead to algorithm. On the other hand, without doing a formal big-O analysis, I think the new algorithm provides an improvement in order complexity, since the maps handle repeat wavelength values efficiently.
I will illustrate the point by comparing collapse() and the new rcpp.collapse() (in its draft form) over two kinds of data sets. The first is the barbiturates list of objects that comes with the package. In this case, few wavelengths are shared and hence NA values predominate. For the second case I break each spectrum of chondro into a separate object in a list, and then call the two functions on that list. I believe the second case is closer to general usage cases.
Below are the microbenchmarks for both cases. Keep in mind that rcpp.collapse() does not yet return all the details of the object, and that therefore the final performance will be somewhat lower, however these will involve no increase in complexity order.

      bkb <- microbenchmark (collapse (barbiturates), rcpp.collapse (barbiturates), times=100 )

      chondro.list <- list()
      len<-nrow(chondro[[]])
      for(i in 1:len){
              chondro.list[[i]]<-chondro[c(i)]
      }

      bkc <- microbenchmark (collapse (chondro.list), rcpp.collapse (chondro.list), times=100)

In the tables below, NewCo stands for rcpp.collapse() and OriginalCo stands for the original collapse() function.

Comparative performance on barbiturates: 286 1 spectra hyperSpec objects, with between 5 and 10 wavelength data points per objects – resultant object has 286 spectra over 375 data points, most values NA.

Unit: milliseconds

function min lq median uq max
1 OriginalCo 534.6214 561.3511 575.7670 595.8669 681.3491
2 NewCo 119.5120 131.5664 135.1868 141.1226 197.6812

Comparative performance on chondro: 875 1 spectra hyperSpec objects, with 300 wavelength identical data points per objects – resultant object has 875 spectra over 300 data points, no values NA.

Unit: milliseconds

function min lq median uq max
1 OriginalCo 4533.5751 4627.9534 4672.1971 4723.6238 4912.9702
2 NewCo 428.9557 448.8528 501.8818 514.3135 618.1983

In both boxplots the function, rcpp.collapse(), is on the right:

barbiturates:

chondro

Granted that some overhead will cause some deterioration in runtime performance of rcpp.collapse(), it still seems clear that there is an order improvement, due to how rcpp.collapse() handles repeat values. Also, it is inherently ordered, whereas collapse() requires an additional sort to order values in cases like barbiturates. The most common usage case is where all or most wavelength points are shared, and it is in this case that the performance improves most. In conclusion I think the Rcpp approach is most suitable for this particular problem.

parallel spc.loess 1

Part of the project involves identifying individual functions that represent bottlenecks, and exploring ways to improve their performance. The next two posts discuss two different functions, and two different approaches. In this post, I examine a first attempt at parallelizing spc.loess – hyperSpec’s loess function. In the next I discuss an Rcpp implementation of collapse, which uses std::maps to good effect – using them simultaneously for quick storage/retrieval, removal of repeats, and sorting of data in order to achieve an optimized collapse function.

spc.loess() appears to be a prime candidate for parallelization. It calls loess() and predict() on each spectrum of a hyperSpec object. Hence doMC’s, parallelization of foreach seems an obvious candidate. Moreover, it is quite easy to modify the existing code to run with it – I just needed register doMC and then roll out the apply’s into foreach’s, and incorporate this into the pre-existing function:

      …

      registerDoMC()
      len <- nrow (spc[[]])

      loess.ob <- foreach (i=1:len) %dopar% {
            .loess (spc@data$spc[i,], spc@wavelength)
      }
      spc@data$spc <- foreach (i=1:len, .combine=rbind) %dopar% {
            .predict (loess.ob[[i]], newx)
      }

      …

I first compared the original and new spc.loess on the chondro object which comes with the package. A priori the dimensionality of the object is a consideration as to the anticipated benefits of parallelization. chondro has 875 spectra over 300 shared wavelength points. It is not therefore a perfect candidate; if one considers that parallel processing extorts a certain amount of overhead for each core call, that it branches per spectrum, but that the length of each spectrum is in this case about 1/3 the total spectra count, then it is not surprising that we do not see a massive improvement. Nevertheless, I think the microbenchmarks do suggest a statistically significant overall improvement as the employed cores increase. I tested, times 50, for the cases of both 2 and 4 cores. (The number of runs is a little low, but the purpose here is to identify a candidate for more detailed testing, rather than to give a definitive judgement.)

      options (cores=2)
      bk2 <- microbenchmark (spc.loess (chondro, chondro@wavelength), par.spc.loess (chondro, chondro@wavelength), times = 50)
      options (cores=4)
      bk4 <- microbenchmark (spc.loess (chondro, chondro@wavelength), par.spc.loess (chondro, chondro@wavelength), times = 50 )

These are the results for 2 cores, NewLo and OriginalLo standing, naturally, for par.spc.loess and spc.loess respectively:

Unit: milliseconds

function min lq median uq max
1 NewLo 3.206687 3.362343 3.512712 3.946215 5.092526
2 OriginalLo 3.385441 3.435708 3.468608 3.973934 5.453411

We cannot really choose between them. But with 4 cores:

Unit: milliseconds

function min lq median uq max
1 NewLo 2.410523 2.609749 2.861109 3.264689 4.103086
2 OriginalLo 3.380084 3.448078 3.491410 4.771516 5.450642

It seems clear that par.spc.loess improves performance over spc.loess, when given 4 cores, as the boxplots also illustrate. Observe that the new function, par.spc.loess(), on the left of each diagram, improves over spc.loess() from 2 cores to 4 cores.

It is important to note that these results are with the shared BLAS – openblas, set with OPENBLAS_NUM_THREADS=1. When OPENBLAS_NUM_THREADS=4, the original function spc.loess() degrades thus:
      system.time(x<-spc.loess(chondro, chondro@wavelength) )
  user         system elapsed
12.140 27.641 9.959

and indeed, degrades with the addition of every extra thread above 1 almost proportional to the thread count.
Meanwhile for par.spc.loess(), I aborted after 301 seconds, without any response.

(I have not microbenchmarked this so far as it simply takes so long. Also, since I have yet to figure out how or whether I can change OPENBLAS_NUM_THREADS from within an R session, it is not very easy to make a smooth comparison. If anyone else experiences a degradation in performance with this or other functions when they increase the threads for a shared BLAS, please let me know. If no solution is found I will prepare a detailed account of the problem.)

So clearly, there are issues with combining shared BLAS with explicit parallelization – some of these matters have been addressed elsewhere and we will continue to research this. However, it is worrying that openblas also negatively impinges upon the performance of spc.loess, which employs no explicit parallelization.

For now, to return to the immediate question at hand, I wanted to see if the improvements of par.spc.loess() increased when the wavelength dimension was not less than the spectral dimenstion – i.e. when we could expect more parallell processing per each forking to another core (and the overhead this entails.) I next tested the functions against the object created by the amalgamation of the files by rcpp.read.Kaiser(), as per a prior post:
      KaiserOb <- rcpp.read.Kaiser('/path/to/KFiles')
KaiserOb has 108 spectra over 1340 shared data points. These are the results when we benchmark spc.loess() vs par.spc.loess():

      KaiserOb <- rcpp.read.Kaiser( list_file_locations )
      options (cores=2)
      bk2 <- microbenchmark (spc.loess (KaiserOb, KaiserOb@wavelength), par.spc.loess (KaiserOb, KaiserOb@wavelength), times = 50)
      options (cores=4)
      bk4 <- microbenchmark (spc.loess (KaiserOb, KaiserOb@wavelength), par.spc.loess (KaiserOb, KaiserOb@wavelength), times = 50 )

2 cores:

Unit: milliseconds

function min lq median uq max
1 NewLo 1.879663 1.982721 2.046835 2.327257 3.619520
2 OriginalLo 2.935976 2.953612 2.989260 3.326788 5.014809

4 cores:

Unit: milliseconds

function min lq median uq max
1 NewLo 1.197126 1.264568 1.328884 1.518002 2.419168
2 OriginalLo 2.936382 2.986144 2.998576 3.828476 5.056873

2 cores (par.spc.loess on left):

4 cores (par.spc.loess on left):

So, doMC with foreach provides a pleasing improvement. I will examine other explicit parallelization approaches against this in a future post or posts but I think we can safely say that we already have a tangible improvement for the hyperSpec package. We saw that with the chondro object, this improvement was not all that exceptional – however this is a function of the dimensions of the object – there are not enough data points per spectra for parallelization to really soar ahead – and I predict this will be a relative restriction for any parallelization approach. Nevertheless, even in the restricted case, where data points were 1/3 the number of spectra, par.spc.loess with 4 cores still performed best.

There is the outstanding issue of interference with shared openblas, in both the original and parallelized cases, which we will have to resolve.

I will try to post my results for the rcpp.collapse() function tomorrow before I go on holiday. Otherwise I will post it when I get back.

File-IO: First Microbenchmark results

The improved File-IO is essentially complete. I have implemented new File-IO in C++ using Rcpp. The hyperSpec S4 objects are quite complex, but using such features as Rcpp::ExpressionVector for expressions, and Rcpp::Language for calling R (see previous post) I can declare the final S4 objects in Rcpp, and return them as an unevaluated LANGSXP to R’s calling function, where they are evaluated in the return. This approach keeps copying to a minimum and lessens the general overhead of using R-C++ since no processing is done in R.

A commonly encountered format is the Kaiser.spc case where several files contain spectra with the same wavelengths. I have used the Microbenchmark package to compare the performance of the new rcpp.read.Kaiser function to the preexisting read.spc.KaiserMap. The data set consists of 108 7.3 kB files in default Thermo/Galactic SPC format .

Here is a table of the results of the microbenchmark, drawn from 500 calls on each the functions. Naturally, NewIO stands for the new function rcpp.read.Kaiser() and OriginalIO stands for the original read.spc.KaiserMap.

Unit: milliseconds

function min lq median uq max
1 NewIO 14.75752 16.37736 17.94751 37.71903 65.11417
2 OriginalIO 570.04723 579.44523 582.22526 613.60385 846.42801

Here is the corresponding box plot:

Clearly there has been a significant improvement. While R’s readbin() function is very efficient, it does not have the same capacity for linear formatting of binary data as C/C++. Further, by using Rcpp it is possible to process the data into complex S4 R objects from C++, proving an efficient and elegant solution to FileIO.

S4 Objects in Rcpp

S4 Objects in Rcpp

As part of my work for GSOC I am building a new File IO system for reading spectroscopy fies in the Thermo/Galactic SPC file format into R. The current implementation is in R. I will implement the File IO in C/C++, since the binary format requires processing which cannot really be achieved linearly using R’s readbin() method, since each spc file is typed according to a specification given in the file header. C++, augmented by the Rcpp package seems a good choice since: 1) it allows efficient online processing (particularly since C structs are supplied for the headers), 2) much of R’s high-level functionality is portable to C++ via the Rcpp hinge. The latter point not only allows for a niceness factor regarding the transition of compiled code to R, but should also provide an efficient interface, since copying and processing can be kept to a minimum, 3) it’s fun.

To this extent I have been exploring the use of S4 objects in Rcpp. There are one or two examples posted on Rcpp-devel as well as the unit tests in the Rcpp package, but I think it is fair to say that there is relatively little literature concerning this compared to other areas of Rcpp. But nevertheless it is reasonably easy to implement. I will provide a skeleton example focusing on hyperSpec objects and two idiosyncracies of the requirements in the implementation: 1) hyperSpec objects have a slot @data, a dataframe which contains one of R’s most appealing and unusual datastructures – a matrix contained in a single dataframe column – $spc – holding the empirical spc data; 2) the specification requires that Rcpp returns a hyperSpec object for most cases, but a list of hyperSpec objects for some, according to the type of the SPC file provided in the formatted header.

If the return was certainly only one S4 object, we could pass an object to Rcpp and return it filled. Due to the second condition we must also initialize S4 object in R.

The following example illustrates both of these points through an example with a hyperSpec S4 object. None of this is particularly revolutionary but since there are not many examples of this in practice, I thought I would post it here.

The minimal requirement of a hyperSpec object to validate is that the length of @wavelength vector corresponds to the number of columns of @data$spc, so the example returns such an object meeting requirements 1) and 2) above.

I think this approach should be efficient and nice in both R and C++ style, but if anyone knows of any reason why it is a bad approach, (particularly where @wavelength and @data$spc are big,) by all means, do feel free to let me know.

//C++

#include

RcppExport SEXP test_wrapper(){

        Rcpp::Language hyobcall(“new”, “hyperSpec”);

        Rcpp::S4 obj( hyobcall.eval() ); //use Rcpp::Language to create and assign a hyperSpec S4 object.

        Rcpp::NumericVector X(10); //@wavelength
        short NROWS = 1;
        Rcpp::NumericMatrix Y(NROWS,10); //$spc
        int i = 0;
        for( Rcpp::NumericVector::iterator vit = X.begin(); vit != X.end(); ++vit ){
                *vit = i++;
        }
        i = 0;
        for( Rcpp::NumericMatrix::iterator mit = Y.begin(); mit != Y.end(); mit += NROWS ){
                *mit = (2 * i);
                ++i;
        }
        obj.slot(“wavelength”) = XM;
                //@data: create DataFrame with placeholder vector to match NROWS of $spc
        Rcpp::DataFrame df = Rcpp::DataFrame::create( Rcpp::Named( “spc” ) = Rcpp::NumericVector(1) );
        df[0] = YM; //copy $spc to df
        obj.slot(“data”) = df; //add this to @data

        return obj;
END_RCPP
}

//R

test.wrapper<-function(){
     spc <- .Call(“test_wrapper”, PACKAGE=”SPCIO”);
     return (spc);
}

//R-REPL

> test.wrapper()
hyperSpec object
    1 spectra
    1 data columns
    10 data points / spectrum

wavelength: [numeric] 0 1 … 9
data: (1 rows x 1 columns)
    1. spc: [matrix10] 0 2 … 18

IDEs – R and Eclipse

R on Eclipse

A fundamental requirement of any good project plan is a reliable and flexible IDE. As a non-EMACS user, two options in particular present themselves. The first of these is RStudio. As of version 0.95 RStudio supports Projects. This greatly increases the IDE’s capacity for project development. The RStudio split windows really come into their own with projects: the project folders are accessible to the bottom right; the SVN facility is available in a tab in the top right window. These features make RStudio perfect for R-only packages. However, for integrating C or C++ with R, it is still does not offer a universal development environment. For our project we want to incorporate the Rcpp package to use C++ IO in R. The solution is to run R through Eclipse. This is not as straight-forward as RStudio, but is feasibly implementable and highly worthwhile, given the resulting development environment. I will outline 3 features: StatET‘s R Console in Eclipse, Rcpp packages, and, briefly, SVN. I am running Ubuntu 12.04 with Eclipse 3.7 and R 2.15. Despite the fact that these releases are relatively recent, there are no considerable obstacles to making Eclipse an all-round environment for integrating R and C++ code and checking it in and out of R-Forge.

Good guidelines as to how to implement these features already exist, so here I will simply link to these sources, give some context, and describe a few changes I found necessary for my installations of Ubuntu, Eclipse, and R.

1. StatET

Stephan Wahlbrink’s StatET provides an R IDE on the Eclipse platform providing an R console and package building capabilities. Using R 2.15 and Eclipse 3.7 the testing version 3.0 of StatET was required. However, it seems to work fine for me thus far.

Oneliner provides a really useful article on StatET here , and installation instructions are available from  Wahlbrink’s site.

Don’t forget to: install.packages(c(“rj”, “rj.gd”), repos=”http://download.walware.de/rj-1.1&#8243;).

Note, that rj 1.1 is necessary with the above installations. However this requires the test release of StatET 3.0, available from the downloads page

Once installed it is easy to configure consoles for packages etc. For more details see L Lam’s A guide to Eclipse and the R plug-in StatET .

2. Rcpp on Eclipse

Fellows Statistics provides an excellent description of how to implement Rcpp and RInside on Eclipse for MacOSin a <a href=”http://blog.fellstat.com/?p=170“> recent post. </a> The steps were mostly the same for Ubuntu, with, in my case, the following exceptions:

a) Do not add the -arch x86_64 flags.

b) As stated by Fellow Statistics, change the installation and linking directories as required:  e.g. usr/lib/R, ~R/2.15/Rcpp/install etc.

c) In order to get the linker to work, you may need to add extra flags. Dirk Eddelbeutel’s <a href=”http://r.789695.n4.nabble.com/Including-Rcpp-in-Eclipse-C-project-td1569475.html“> advice in this post</a> was invaluable here, i.e. make the RInside examples and look at the flags used for installation. In my own case, the addition of several -l options was necessary and sufficient for the linker to work.

d) Finally, Eclipse had problems finding libRcpp.so at run-time. The solution was to add  LD_LIBRARY_PATH to the location of  libRcpp.so to the environment variables in Run/Debug Settings.

Granted the above, it works great, and provides an excellent environment for building R packages. Both R and C++ code is compilable and easy to debug. Also, the package structure is readily accessible and easy to manipulate and build. One drawback with Rcpp is that there can be a bit of a curve from using it inline to using it in packages, and it is easy to overuse/misuse inline in cases where modules or packages are more appropriate. With this setup it is easy and intuitive to build code in packages from the get go, as it is more or less the same experience as building an Eclipse Java or C++ project.

3 SVN in Eclipse

This is pretty easy. The two main options are Subversive and Subclipse. I chose the latter based on a preliminary (and by no means conclusive) examination of the extensive debate as to which is better. It installs easily, given the dependencies. It works intuitively and, most importantly, as far as I can tell it works, allowing me to connect to R-Forge and checkout repositories. For a useful tutorial see here.

Interestingly, its dependencies include Mylyn – a task management tool I was not aware of, and which I may use for the project plan etc. in the next few weeks.

In conclusion, taking the Eclipse route gives a wider range of options to those available on RStudio. Pretty much all of the latter’s features are replicable, and it is also possible to create a comprehensive environment for integrating cross-language code.

Link

Introduction

This blog is a record of the work undertaken on the hyperSpec R package as part of Google Summer of Code (GSOC) 2012.

HyperSpec is a package for the handling of chemometric hyperspectral data. The package was created by and is maintained by Claudia Beleites. Further details on the package, including several download options, are available here

The purpose of this project, HyperSpec: Parallelization and Optimization, is to provide improved performance for the package by identifying those areas most in need of improvement, and deciding upon the technique most suitable to bringing about tangible benefit. Implicit and explicit forms of parallelization will be assessed, and other features, such as an Rcpp IO interface will be delivered. A more precise breakdown will be given in a future post.

The purpose of the blog is to keep a record of the project’s progress, from the training period through to its completion. The blog’s immediate intended audience are those working on the project, but it is hoped it will also prove accessible to those with an interest in hyperSpec or either spectroscopic analysis or R programming in general. The purpose of the training period is to develop key skills needed or desirable for the project. Initial posts will therefore be themed around a particular skill or set of related skills. Once the project is under way, posts will be explicitly tied to the timeline of the project as well as to the topics under exploration.

I will conclude this post with a brief introduction of the project members, student Simon Fuller (NUIM) and mentors Claudia Beleites (IPHT) and Katarina Domijan (NUIM).

Student:
Simon Fuller is a first year PhD student in the Computer Science Dept NUIM.

His research interests include data compression, probabilistic models and statistical programming. His linked-in profile is here. He is also the main poster on this blog.

Mentors:
Claudia Beleites is analytical chemist and chemometrician at the Institute of Photonic Technology, Jena, Germany, and maintainer of the hyperSpec package.

Claudia developed the package while working in Valter Sergo’s group at the University of Trieste, Italy.

Università degli Studi di Trieste

Katarina Domijan is a lecturer in the Department of Mathematics and Statistics at NUIM .

National University of Ireland, Maynooth

Create your own website, free on WordPress.com.Create your own website.
Start free