Presentation is loading. Please wait.

Presentation is loading. Please wait.

Compiled Matlab on Condor: a recipe 30 th October 2007 Clare Giacomantonio.

Similar presentations


Presentation on theme: "Compiled Matlab on Condor: a recipe 30 th October 2007 Clare Giacomantonio."— Presentation transcript:

1 Compiled Matlab on Condor: a recipe 30 th October 2007 Clare Giacomantonio

2 How to format your m-file function testfunction(input1,input2) % change arguments to numerics if necessary input1 = num2str(input1); input2 = num2str(input2); % computation sumofinputs = input1 + input2; % save output outputfilename = [ ' testfunction_ ' num2str(input1) ' _ ' num2str(input2)]; save(outputfilename, ' input1 ', ' inputs2 ', ' sumofinputs ' ) turn it into a function all arguments are strings - change to numerics if necessary use a dynamic filename for the output or make it one of the input arguments don’t create figures

3 Motivation Each instance of Matlab uses up a license so logging lots of Matlab jobs can quickly use up all the licenses stopping more of your jobs running and/or preventing others from using Matlab. Compiled Matlab does not use a license. - Matlab or the Matlab Component Runtime (MCR) still need to be installed. - All machines in the Condor pool have Matlab installed.

4 Compile your m-file Must compile on the same operating system as you want to run on. At the Matlab command line >> mcc -m testfunction.m -R -nojvm This creates a single executable and a testfunction.ctf file. - It also creates a lot of other files which we don’t need. There’s only one compiler license! - Don’t forget to close Matlab after you finish compiling to release the license. Not all Matlab functions compile. See list at http://www.mathworks.com/products/compiler/compiler_s upport.html

5 Running compiled Matlab from the terminal If you want to check that your function runs as desired from the command line, need to run from a script which sets the library path first. #!/bin/bash export MATLAB_ROOT=/opt/matlab-7.4 export LD_LIBRARY_PATH=${MATLAB_ROOT}/sys/opengl/lib/glnx86: ${MATLAB_ROOT}/sys/java/jre/glnx86/jre1.5.0/lib/i386: ${MATLAB_ROOT}/sys/java/jre/glnx86/jre1.5.0/lib/i386/ server:${MATLAB_ROOT}/sys/java/jre/glnx86/jre1.5.0/li b/i386/client:${MATLAB_ROOT}/sys/java/jre/glnx86/jre1.5.0/lib/i386/native_threads:${MATLAB_ROOT}/bin/glnx8 6:${MATLAB_ROOT}/sys/os/glnx86: export XAPPLRESDIR=${MATLAB_ROOT}/X11/app-defaults./testfunction 10 20

6 Condor submit script To schedule jobs in Condor you need a condor submit script. In this script - You must include executable and.ctf at transfer_input_files. - You must set the environment variable LD_LIBRARY_PATH. Other methods may work! This is just one way that I found works.

7 Now submit your jobs Put Matlab executable,.ctf, any data files used as inputs and condor_submit script in the directory InputDir. Make sure OutputDir exists. Submit your jobs to Condor at the command line condor_submit testfunction.sub

8 Outputs Any text normally written to the Matlab command window is saved in the output file. Any data files generated will appear in OutputDir.

9 What happens when an owner interrupts your job? The job re-starts again on another machine. It may be possible to implement checkpointing in your function by periodically saving the workspace and loading the workspace as a input if it exists.

10 Using Matlab on Condor Pros - Easy to set-up if your code compiles. - Can access DICE home directory. - Compiled Matlab doesn’t use up Matlab licenses. Cons - Some Matlab functions don’t compile. - Jobs restart if machine is reclaimed so only good for < 12 hour jobs.


Download ppt "Compiled Matlab on Condor: a recipe 30 th October 2007 Clare Giacomantonio."

Similar presentations


Ads by Google