Submitting a compiled MATLAB-program

Copying the MCRInstaller to a storage element


When compiling a MATLAB-file to a standalone application the following files are created:

  • MATLAB Component Runtime (MCR): MCRInstaller.zip

  • executable (e.g. test)

  • Component Technology File archive: executable.ctf

The MCR has about 100MB, so this file has to be stored on a storage element. The other two files will be sent with the job.


Do the following commands in your shell:

  1. Define the LFC-host, by setting (=exporting) the LFC_HOST-variable: (LFC is short for LCG File Catalog, where LCG is short for Large Hadron Collider Computing Grid)

    $ export LFC_HOST=skurut2.cesnet.cz

    The LFC-host has the information on available storages elements.

  2. Define the catalog type:

    $ export LCG_CATALOG_TYPE=lfc

    There exist other catalog types, which will not be used by us.

  3. Define the location of the Information Service:

    $ export LCG_GFAL_INFOSYS=lcg-bdii.cern.ch:2170

  4. Store your virtual organisation in the environmental variable LCG_GFAL_VO:

    $ export LCG_GFAL_VO=voce

    This shortens some future commands as you do not have to give the virtual organisation as a parameter anymore.

  5. Create a proxy by using one of the following commands:

    $ grid-proxy-init
    $ voms-proxy-init -voms voce
    $ myproxy-init

    For more information on the proxies check the different proxies page

  6. Check for available storage elements:

    $ lcg-infosites --vo voce se

    storage_info_01
  7. Create your directory in the file catalog:

    $ lfc-mkdir /grid/voce/arntraud

    This command creates a directory (like the Unix command mkdir).

    Replace arntraud by your own username.

    An overview of the lfc-commands, which are similar to Unix commands, can be found here.

  8. Choose on of the storage elements and copy the file to it:

    $ lcg-cr -d skurut18.cesnet.cz -l lfn:/grid/voce/arntraud/MCRInstaller.zip file:/home/arntraud/matlabjob/MCRInstaller.zip

    The command (lcg-cr) copies the file /home/arntraud/matlabjob/MCRInstaller.zip to the destination host skurut18.cesnet.cz giving it the local file name /grid/voce/arntraud/MCRInstaller.zip.

    storage_cr_01

    An overview of the lcg-commands can be found here.

  9. With the following command you may check if the file is there and has the right size:

    $ lfc-ls /grid/voce/arntraud


Writing the executable


Next is to write an executable that

  1. copies the MCRInstaller.zip from the storage element and unzips it into the current directory

  2. sets the MCR paths

  3. runs the MATLAB executable


#!/bin/bash

####### step 1: Copy MCR from storage element and unzip it in current directory ###############
#first enable file catalog
export LFC_HOST=skurut2.cesnet.cz
export LCG_CATALOG_TYPE=lfc
export LCG_GFAL_INFOSYS=lcg-bdii.cern.ch:2170
lcg-cp --vo voce lfn:/grid/voce/tom/MCRInstaller.zip file:`pwd`/MCRInstaller.zip
unzip MCRInstaller.zip
rm MCRInstaller.zip

####### step 2: Setting MCR paths. Use correct directory the zip files unzips to below!! #####
mcr_path=`pwd`/v72 # MCR directory (created during the unzip operation)!
#the following needs to be in ONE line (no return in between)!!
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${mcr_path}/runtime/glnx86:${mcr_path}/sys/os/glnx86:
${mcr_path}/bin/glnx86:${mcr_path}/sys/java/jre/glnx86/jre1.5.0/lib/i386/native_threads:
${mcr_path}/sys/java/jre/glnx86/jre1.5.0/lib/i386/client:${mcr_path}/sys/java/jre/glnx86
/jre1.5.0/lib/i386:~/libs:

export XAPPLRESDIR=$XAPPLRESDIR:${mcr_path}/X11/app-defaults

####### step 3: running the MATLAB executable ##############################################
#set rights to executable first
chmod +x my_matlab_bin
./my_matlab_bin $1
mv my_result.mat my_result1.mat
./my_matlab_bin $2
rm -rf v72

#echo "uuuuund tschuess!"


Writing the job description file


Next you have to describe the job. This is done by creating a file with the extension .jdl.


Executable="wonf_matlab.sh";
StdOutput="my_matlab_bin.out";
StdError="my_matlab_bin.err";
Arguments="5 6";
InputSandbox={"wonf_matlab.sh","my_matlab_bin","my_matlab_bin.ctf"};
OutputSandbox={"my_matlab_bin.out","my_matlab_bin.err","my_result1.mat","my_result.mat"};
Requirements=other.GlueCEUniqueID=="skurut17.cesnet.cz:2119/jobmanager-lcgpbs-voce";
MyProxyServer = "skurut3.cesnet.cz";


Comments on each line:

  1. Filename of the executable

  2. Filename to store the standard output

  3. Filename to store the standard error output

  4. Arguments in the same order as referred in the executable

  5. All files that are sent to the computing element have to be given in the InputSandbox.

  6. Alls files that should be returned have to be given in the OutputSandbox.

  7. The Resource Broker (skurut17.cesnet.cz) together with its Local Resource Management (lcgpbs) is given

  8. This line is optional (see A simple job with GLITE)


For the next steps (submitting the job, checking the status and retrieving the output) see A simple job with GLITE.

Nach oben scrollen