From BioAssist
Jump to: navigation, search

NMC DSP - Mainpage

This page is a start for how to use the SARA Grid and is intended as quick reference documentation for NMC DSP developers on running Matlab-programs on the Grid. To get on the Grid you first have to acquire a certificate, more information can be found here.

Logging in to the UI-server and starting a Grid session

First you login via SSH, with your username and password, on the User Interface-server (ui.grid.sara.nl). After that you have to let the machine know that you are starting a so called "Grid Session" on the Life Sciences grid (lsgrid):

$ssh yourusername@ui.grid.sara.nl
yourusername@ui.grid.sara.nl's password: 
$startGridSession lsgrid
$voms-proxy-info -all (get some information about yourself)

Running a job

To run a job on the Grid, first make your JDL-file (Job Description Language) to describe which program you want to execute with which parameters. Running jobs is explained on this page. Actually the following commands are essential:

glite-wms-job-submit -d <yourusername> hello.jdl (returns a https-string, sort of unique identifier)
glite-wms-job-status <https-string> (returns the status of the job)
glite-wms-job-output <https-string> (gets the output when finished and puts the result in /tmp)

Finally you can retrieve the output with a command, for example:

cat /tmp/yourusername/result

Compiling your Matlab-script to an executable on the Grid

Put your Matlab-script (mymatlabscript.m file) on the UI-server and run the following commands to create a Matlab executable:

$module load matlab (load Matlab module)
$module load mcr (load Matlab Compiler Runtime)
$mbuild -setup (intialization)
$mcc -m <mymatlabscript.m> (compile your Matlab-script to an executable)
$./mymatlabscript (run the executable)

Running your Matlab-executable on the Grid

Once you have created a Matlab-executable you can run it on the Grid. First create a JDL-file (mygridjob.jdl) which will call your executable (mymatlabexecutable):


Executable = "myshellscript.sh";
Stdoutput = "stdout";
StdError = "stderror";
InputSandbox = {"myshellscript.sh","mymatlabexecutable"};
OutputSandbox = {"stdout","stderror"};
RetryCount = 0;

Your shell-script (myshellscript.sh) should contain at least the following lines:


module load mcr/v79
chmod +x mymatlabexecutable

Finally submit your Matlab-program to the grid:

glite-wms-job-submit -d <yourusername> mygridjob.jdl

Refer to Running a job for more information about retrieving the results/status of a job.