Friday, April 11, 2014

Installing Rmpi on NERSC's carver

The directory that contains MPI libraries is OMPI_DIR=/usr/common/usg/openmpi/1.4.5/intel; hence, we can adapt the code on this page (http://internet2.binghamton.edu/teragrid/readdoc.cgi?fname=1_1_Rmpi-Steele-2010-11-16.txt).

Use the following code in R.

local({
    my.configure.args <- list(
        "Rmpi" =
        c("--with-Rmpi-include=$OMPI_DIR/include",
          "--with-Rmpi-libpath=$OMPI_DIR/lib",
          "--with-Rmpi-type=OPENMPI")
        );
    options("configure.args" = my.configure.args);
    options(repos=c(CRAN="http://cran.cnr.Berkeley.edu"));
})


Monday, April 7, 2014

Building emacs on NERSC systems

Emacs on NERSC systems are old, so I tried to compile emacs from source. The compiler is older as well, so I encountered errors during compile time.

regex.o: In function `stpncpy': 
/usr/include/bits/string3.h:160: multiple definition of `stpncpy' /tmp/ccntBfBN.o:/usr/include/bits/string3.h:160: first defined here 
regex.o: In function `realpath': 
/usr/include/bits/stdlib.h:37: multiple definition of `realpath' /tmp/ccntBfBN.o:/usr/include/bits/stdlib.h:37: first defined here 
regex.o: In function `ptsname_r': 
/usr/include/bits/stdlib.h:53: multiple definition of `ptsname_r' /tmp/ccntBfBN.o:/usr/include/bits/stdlib.h:53: first defined here 
regex.o: In function `wctomb': 
/usr/include/bits/stdlib.h:74: multiple definition of `wctomb' /tmp/ccntBfBN.o:/usr/include/bits/stdlib.h:74: first defined here 
regex.o: In function `mbstowcs': 
/usr/include/bits/stdlib.h:95: multiple definition of `mbstowcs' /tmp/ccntBfBN.o:/usr/include/bits/stdlib.h:95: first defined here 
regex.o: In function `wcstombs': 
/usr/include/bits/stdlib.h:114: multiple definition of `wcstombs' /tmp/ccntBfBN.o:/usr/include/bits/stdlib.h:114: first defined here 

To get around this, use this trick:
./configure CPPFLAGS="-fgnu89-inline"

Source: http://stackoverflow.com/questions/15285776/multiple-definitions-when-linking-collect2-error-ld-returned-1-exit-status


For faster R use OpenBLAS and Rmpi

http://www.stat.cmu.edu/~nmv/2013/07/09/for-faster-r-use-openblas-instead-better-than-atlas-trivial-to-switch-to-on-ubuntu/

http://www.stat.berkeley.edu/~paciorek/statComputing/statComputing.html

Wednesday, March 26, 2014

Mount sshfs in /etc/fstab with fuse

Add the following line in /etc/fstab

[username]@[hostname]:[remote source path] [local mount path] fuse.sshfs user,_netdev,uid=1000,IdentityFile=[path to ssh key],reconnect,allow_other 0 0

Monday, October 21, 2013

ESS (Emacs Speaks Statistics) now supports compiling knitr

First, new version of ESS needs to be installed.  I use Aquamacs, so I want to make sure that I update Aquamacs. You can do this by uncommenting appropriate lines in Makeconf file of the ESS distribution (search for Aquamacs in Makeconf file).

Two variables need to be set within emacs.

  • Change 'ess-swv-processor' to 'knitr'
  • Set the variable 'ess-swv-plug-into-AUCTeX' to use the existing interface for compiling LaTeX files: i.e., C-c C-c
Now you should be able to use 'C-c C-c Sweave' or 'C-c C-c LaTeXSweave' commands to compile your Rnw files.

Reading Microsoft Excel files into R in Ubuntu 12.04


People still send data around in Microsoft Excel format: xlsx. In order to import xlsx data into R, one can use the xlsx package. When I tried to install the package in R, I ran into libjvm.so not found error.

 libjvm.so: cannot open shared object file: No such file or directory

There is a stackoverflow thread on this.

After xlsx package was installed properly, the launched jvm did not have enough memory. The way to allow more memory to the jvm. This stackoverflow thread explains how to do this.

For example, to allocate 2GB memory for the jvm instance,

options(java.parameters = "-Xmx2000m")

DONE!