This page contains additional information and suggestions relevant to the MATLAB standalone compilation.
- The terms MCR and MATLAB are used interchangeably for SCC users because MATLAB is available and MCR shares the MATLAB path.
- As defined in the
mybash.txt
andmycsh.txt
, the MCR path is/usr/local/matlab
. This points to the system default MATLAB. If the standalone is for an MCR other than the default, load the appropriate MCR version with the module command. - Instead of using the wrapper, you could embed the standalone-compliant data-type conversion, as shown in
myStandalone.m
, directly into your main program (e.g.,myApp.m
). -
isdeployed
returns 1 if the running program is a standalone, otherwise 0 for m-file. - For batch processing, always add an exit at the end of the main m-file to exit MATLAB and ends batch job.
- Most SCC users create standalone for batch operations. All
matlab
runtime options (-R
) included during compilation are “burned in” to the standalone. If you use this standalone — intended for batch — in the interactive environment, it may have undesired consequences. An example is the runtime-R -nodisplay
option, while makes sense for batch operations, may be undesirable in the interactive environment. Solution: create a separate standalone for interactive use, with appropriate runtime options. - Standalone can also be made for MATLAB codes that require external C or Fortran packages. You are responsible for preparing MATLAB gateway function to serve as an interface between the calling m-file and the callee (C or Fortran code). They in turn need be compiled with the MATLAB mex compiler script and then compile with mcc with the “-a” switch to generate the standalone executable. A simple example is available.
- To submit multiple batch jobs to the SCC
Multiple MATLAB standalone batch jobs can be submitted withqsub -t
Array Job option, along with arun_standalone_job
batch script . . .scc1$ qsub -t 100 ./run_standalone_job <==n=SGE_TASK_ID=100 scc1$ qsub -t 100-300:200 ./run_standalone_job <==SGE_TASK_ID=100,300
In the above, the standalone
myExecR2013a
computes the sum of the arithmetic sequence s = 1 + 2 + 3 + . . . + n. The parametern
is equated to the Array Job environment variableSGE_TASK_ID in
.run_standalone_job
run_standalone_job