<

[University home]

High Throughput Computing using Condor

Building a standalone executable with multiple M-files

In the following example, a standalone executable is created on the PC from three M-files (mymain.m, myfunc1.m and myfunc2.m):


>> type mymain.m
function mymain
  fprintf( 'this is the main program\n' ); 
  myfunc1();
  myfunc2();
end

>> type myfunc1.m

function myfunc1
  fprintf('this is myfunc1\n');
end

>> type myfunc2.m

function myfunc2
  fprintf('this is myfunc2\n');
end

>> mymain
this is the main program
this is myfunc1
this is myfunc2

>> mkdir dependencies
>> !copy myfunc1.m dependencies
        1 file(s) copied. 
>> !copy myfunc2.m dependencies
        1 file(s) copied. 

>> mcc -mv mymain.m -a dependencies
Compiler version: 4.17 (R2012a) 
Processing C:\matlab2012a\toolbox\matlab\mcc.enc 
Processing include files... 
2 item(s) added. 
Processing directories installed with MCR... 
The file mccExcludedFiles.log contains a list of functions excluded from the CTF archive. 
1 item(s) added. 
Generating MATLAB path for the compiled application... 
Created 42 path items. 
Begin validation of MEX files: Thu Jan 31 11:50:09 2013 
End validation of MEX files: Thu Jan 31 11:50:09 2013 
Parsing file "C:\matlab2012a\build\mymain.m" 
	(Referenced from: "Compiler Command Line"). 
Parsing file "C:\matlab2012a\toolbox\compiler\deploy\deployprint.m" 
	(Referenced from: "Compiler Command Line"). 
Parsing file "C:\matlab2012a\toolbox\compiler\deploy\printdlg.m" 
	(Referenced from: "Compiler Command Line"). 
Deleting 0 temporary MEX authorization files. 
Generating file "C:\matlab2012a\build\readme.txt". 
>> !mymain.exe
this is the main program
this is myfunc1
this is myfunc2

Here's the same example but using matlab_build to build a standalone executable using the Condor server:

[condoruser@ulgp5 build]$ ls
  myfunc1.m  myfunc2.m  mymain.m
[condoruser@ulgp5 build]$ mkdir dependencies
[condoruser@ulgp5 build]$ cp myfunc1.m myfunc2.m dependencies
[condoruser@ulgp5 build]$ ls -R
.:
  dependencies  myfunc1.m  myfunc2.m  mymain.m

./dependencies:
  myfunc1.m  myfunc2.m
[condoruser@ulgp5 build]$ matlab_build mymain.m 
bundling dependencies in dependencies.zip
adding: dependencies/ (stored 0%)
adding: dependencies/myfunc2.m (deflated 11%)
adding: dependencies/myfunc1.m (deflated 11%)
Submitting job(s).
1 job(s) submitted to cluster 1156.

When the job completes you should find that the executable mymain.exe has been created.