Matlab Sample Runtime Files: Indepth Explanation

The following text shows the commands in the sample batch command, along with a description of what each section is doing.

Red indicates sections which need some customization by the user, with items in red bold italics ALWAYS needing customization for the individual user name or directory/file names. Black sections would normally not need any modification.

The .xml file sets the machine requirements and provides information for the Velocity Scheduler to schedule the job. This section requires modification by the user.

matlab_runtime.xml
 
<?xml version="1.0" ?>
<!-- Sample XML Job File -->
<job>
<nodes>1</nodes>
<minutes>20</minutes>
<type>batch</type>
<affiliation>development</affiliation>
<run>\tc.cornell.edu\tc\users\your_userid\matlab_runtime\matlab_runtime.bat</run>
</job>

 

matlab_runtime.bat

The next section defines three variables. For more information on these variables see the Matlab Runtime software page. This section should be modified by the user.

REM --- set ROOTDIR, OUTDIR, and CODE variables.

set ROOTDIR=\\tc.cornell.edu\tc\users\%USERNAME%\matlab_runtime
set OUTDIR=%ROOTDIR%\output
mkdir %OUTDIR%
set CODE=mypi

The next section calls the setup file which sets the appropriate path, registry settings, and other environment variables for the Matlab Runtime Libraries. Use the setup file that matches the version of Matlab used for compilation.

REM --- Call setup file
REM call setup_matlabruntime2007a.bat
REM call setup_matlabruntime2006a.bat

The next section creates a directory on the local T: drive and copies the files from the user's ROOTDIR to the local temporary directory. This section should not normally be modified by the user.

REM --- Create temp directory on T: 
T:
del /Q T:\%USERNAME%
rd /q /s T:\%USERNAME%
mkdir T:\%USERNAME%
cd /D T:\%USERNAME%

REM --- copy the input files from ROOTDIR
copy /Y %ROOTDIR%\%CODE%.exe T:\%USERNAME%
copy /Y %ROOTDIR%\%CODE%.ctf T:\%USERNAME%

The next line runs matlab and specifies the stdout and stderr files.

%CODE%.exe >%CODE%.out 2>%CODE%.err

The next section copies the output file back to the users rootdir and cleans up the local temporary space. This section should not normally be modified by the user.

REM --- copy the output file back to home directory
copy /Y *.out %OUTDIR%
copy /Y *.err %OUTDIR%

This last line of the file ends the batch job. 

vsched -c