Tags:
view all tags
---++ Compiling Matlab * Code modification: * the 'main' function is an m-file (myFunction.m) that needs to be a function. * since all arguments are passed as strings, you need to convert numeric arguments to double when 'deployed': =if isdeployed= =myArg1 !== str2double(myArg1); =end= * no 'addpath' calls allowed * for functions called by 'feval', you need to get them included by adding the following to myFunction.m: =%#function myAnnonymousFunction= * Compilation: To compile a function for stand-alone execution, start Matlab in the appropriate directory and type: =addpath(genpath(pwd)); % Add stuff to the path so compiler can find functions= =mcc -m myFunction.m % Compile into a stand-alone= (you can call mcc from outside matlab, but it needs to be called from within matlab to add anything to the path) * Execution: * Set the library environment variable so that it can find the matlab libraries: =setenv LD_LIBRARY_PATH /cs/local/generic/lib/pkg/matlab-7.3/bin/glnx86= (or wherever matlab is installed, this can be added to .cshrc) * Run the stand-alone: =myFunction= ---++ Submitting Compiled Matlab to the Arrow Cluster The configuration that has worked was compiling on arrow50@cs with Matlab 7.3 compiler/libraries. Here is a compile.sh file (run from the 'root' code directory, where $1 is the function you want to compile): =#!/bin/sh= =/cs/local/generic/lib/pkg/matlab-7.3/bin/matlab -nojvm -nosplash -nodesktop -nodisplay -r "addpath(genpath(pwd));mcc -m $1;exit;"= Also, the arrow cluster uses bash instead of cshell, so the library command needs to be: =export LD_LIBRARY_PATH=/cs/local/generic/lib/pkg/matlab-7.3/bin/glnx86= It appears that the right way to get environment variables set is to set them on the qsub command line. So on samos, set your LD_LIBRARY_PATH to be what you want (adding in the matlab directory) and then use the command =qsub -v LD_LIBRARY_PATH=$LD_LIBRARY_PATH -o . -e . -cwd -t 4 ./script= to submit the job. $SGE_TASK_ID causes a complaint from Matlab, so you may need to send explicit integers instead. -- Main.jtillett - 19 Apr 2007
Edit
|
Attach
|
Watch
|
P
rint version
|
H
istory
:
r5
<
r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r2 - 2007-04-19
-
jtillett
Home
Site map
BETA web
Communications web
Faculty web
Imager web
LCI web
Main web
SPL web
Sandbox web
TWiki web
TestCases web
BETA Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Register User
Edit
Attach
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback