Skip to content

Installing CodeRunner

edmundhighcock edited this page Apr 1, 2016 · 5 revisions

Installation in 4 Easy Steps

Installation should be very quick and easy on standard Unix systems. On HPC systems there will (as ever) undoubtedly be complications. The four basic steps are:

  1. Configure your system
  2. Install dependent libraries
  3. Install Ruby v 1.9.3
  4. Install coderunner

Linux and Mac OS X

Step 1: Configuring your system

CodeRunner should install without custom configuration on Linux and Mac OS X (OS X install requires Developer Tools and Macports).

Step 2: Installing dependent libraries

On Debian and derivatives (e.g. Ubuntu)

 $ sudo apt-get install libgsl*-dev gsl-bin # Where * is the latest version number\
 $ sudo apt-get install libnetcdf* libnetcdf-dev netcdf-bin\
 $ sudo apt-get install libyaml

On Red-Hat type systems (e.g. openSUSE)

 $ sudo zypper install netcdf gsl libyaml

On Mac OS X using Macports

 $ sudo port install netcdf gsl libyaml

Step 3: Installing Ruby

CodeRunner requires Ruby 1.9.1 or later. If you are intending to develop CodeRunner it is recommended that you use the Ruby Version Manager (RVM). If you just want to use it, it is quicker to use the system Ruby (you can always install RVM later). We give instructions for both options below.

Without RVM

Use your package manger to install Ruby 1.9.1 or higher

Linux:

$ sudo [apt-get/zypper] install ruby1.9*

Mac OS X

$ sudo port install ruby19

Make sure you are using the right version of Ruby!!

$ ruby -v

Using RVM

1. Install RVM

RVM requires git to be installed.

$ sudo [apt-get/zypper/port] install git

On Linux

$ curl -L get.rvm.io | bash -s stable

On Mac OS X

$ in progress

2. Configure RVM

Add

source ~/.rvm/scripts/rvm\
rvm use 1.9.3 

to you login script (e.g. ~/.bashrc).

3. Install Ruby

source ~/.rvm/scripts/rvm\
rvm install 1.9.3\
rvm use 1.9.3

Step 4: Install CodeRunner

NB: For non-Ruby folk, gem is the Ruby package manager.

Without RVM

$ sudo gem* install coderunner # Where * should be replaced appropriately\
   to use the right version of Ruby.

With RVM

$ gem install coderunner

The End

CodeRunner is now installed!

HPC Systems

Sadly, every HPC system has its own little quirks. We have tried to cover most eventualities, but there will always be exceptions and aggravations... queries, questions and bug reports welcome on the project forums.

What needs to be achieved?

To get CodeRunner to work, one (as before) needs to achieve four things:

  1. The system configured appropriately (including allowing the dynamic loading of shared libraries; the use of the GNU (gcc) compilers where possible; a place to install the files; the appropriate folder added to $PATH).
  2. The NetCDF, GSL, libyaml and gnu readline shared libraries (there are still systems where they only make the static ones available), and their development header files.
  3. Ruby v 1.9.1 or higher installed (2.x reccommended)
  4. The coderunner ruby package and its dependencies installed

We provide a bundle that contains enough to guarantee achieving steps 2,3 and 4. We cannot always guarantee step 1, but we try to for as many systems as possible.

Downloading the Bundle

In a clean folder, type

svn co https://svn.code.sf.net/p/coderunner/svn/installer_new

Step 1: Configuring your system

If you are very lucky, your system will be listed in installer_new/systems, in which case you type

$ source installer_new/systems/<mysystem>.sh

and you are away! If you are not quite so lucky, instructions for configuring your system will be on this older page: [Configuring Your System For Installation](Configuring Your System For Installation "wikilink"). If your system is not listed in either, try adapting the instructions for a similar system. If this fails, the best course is usually to ask your system administrator for help (send them a link to this page). You can also place a message in the project forums and we will help if we can.

Make a folder to install everything in:

$ mkdir $HOME/location/of/my_folder

Now add these lines to your ~/.bashrc file:

export PATH=$HOME/location/of/my_folder/bin:$PATH
export CODE_RUNNER_SYSTEM=<mysystem>

Now load them

$ source ~/.bashrc

Step 2: Installing Dependent Libaries

Your system may have one or more of GSL, HDF5, NetCDF, libyaml and readline available. If so, make sure it is loaded into the environment (e.g. by using the "module" command). If you are not sure, it is safest to install it again anyway.

For detailed instructions go to the folder installer_new. Type

 $ make help

If you just want to install all the dependencies afresh type

 $ make hd all rb PREFIX=$HOME/location/of/my_folder

Step 3: Installing Ruby

If you haven't already done so type

 $ make rb PREFIX=$HOME/location/of/my_folder

Step 4: Installing CodeRunner

This is done in two ways, depending on how much your system allows you to access the outside world

Try:

 $ gem install coderunner

If this fails try

 $ make coderunner

This uses copies of all the ruby packages necessary for coderunner stored within the gems folder. However, these may be out of date, so this is not ideal.

Windows

CodeRunner is currently not supported on Windows.

Further Details

CodeRunner Dependencies

CodeRunner has the following dependencies, here we list them and provide Links:

  • Ruby - a modern, fast interpreted language, version 1.9 or higher
  • GSL - the GNU scientific library, version 1.12 or higher.
  • narray - a numerical suite for Ruby
  • rb-gsl - a Ruby wrapper to the GSL, version 1.12.90 or higher

It also has these optional dependencies which are required by some modules:

  • NetCDF - a library to support the creation, access, and sharing of scientific data
  • ruby-netcdf - a Ruby wrapper for NetCDF

It is of course perfectly possible to download the sources and install all these manually. However, CodeRunner comes with an installer package that contains all the requisite source code and an install script which installs them automatically. You can choose to install them either in the default location or in another place. Installing in the default location normally requires admin privileges.

Bugs

It's early days, and this script is far from perfect. Bug reports are welcome on the source forge project page.

One particular bug arises if you already have a NetCDF library installed but it was not built with shared libraries. In this case installing the Ruby NetCDF wrapper will fail. It is necessary to install NetCDF manually (in a different directory, if you do not want to overwrite the old installation)

cd netcdf-4.0.1\
./configure --enable-shared --prefix=<new netcdf dir>\
sudo make install

Another bug can occur on Mac OS X: with certain older compilers, NetCDF may fail to build. In this case, build it manually with the extra option

--disable-fortran77

$Insert formula here$

Running CodeRunner

Try running

coderunner im -q

(NB if you get a message about readline this means that you don't have GNU readline and GNU ncurses installed on your computer. This is a rare occurrence, and only happens on non-standard systems. Install these packages then reinstall Ruby).

Now why not have a look at the [CodeRunner Tutorial](CodeRunner Tutorial "wikilink")

Updating CodeRunner

CodeRunner is in very active development. To get the latest and greatest:

$ gem update coderunner

Visualisation Packages

Gnuplot

Currently the only visualisation package that is directly supported by CodeRunner is Gnuplot. (Though more will come). In order to plot graphs it is therefore necessary to install it. However, there are certain caveats:

  • On Mac OS X, do not install it from source downloaded from the Gnuplot Homepage, install it using Macports (NB, install Macports from source, binaries are very buggy), to make sure it has full support for image formats. Alternatively, a Mac OS X binary for Snow Leopard can be downloaded here. It installs it in the folder /macports so you will need to add /macports/bin to your path.

  • On some Linux distributions, the version installed with the package manager sometimes does not support pdf formats. If you have issues with pdfs, install the development version 4.5 from source.

VTK/Paraview

CodeRunner can output any graph as a VTK file (old format) for use in VTK/Paraview. See the gem graphkit-vtk.

Making Films

If you wish to make films, you will also need to install avconv. This should be easily installable using any Linux package manager. On Mac OS X, it can be installed using Macports.