Skip to content

Instantly share code, notes, and snippets.

@brockpalen
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brockpalen/3de41f7bed218f948e24 to your computer and use it in GitHub Desktop.
Save brockpalen/3de41f7bed218f948e24 to your computer and use it in GitHub Desktop.
Demenstrate the use of MATLAB MCC to make standalone executables.
#compile source on Flux
module load matlab/2014a
mcc -m implicitthreads.m
%fills random large matrix and vector solves for unknown
%brockp@umich.edu
%10/2014
%used to demonstate built in matlab threading
% solved Ax=b
function implicitthreads(dim)
if ischar(dim)
dim=str2num(dim)
end
A=rand(dim);
b=rand(dim,1);
x=zeros(dim,1);
tic
x=A\b;
toc
#use run_<programname>.sh <MCR root> <args>
#that file is created by the compiler and needs to be copied along with the executable
./run_implicitthreads.sh $WORK/mcr/v83 1000
#install the correct MCR (MATLAB Compiler Runtime) for your MATLAB version
# http://www.mathworks.com/products/compiler/mcr/
#This need only be done once
#use $WORK to have sufficent space
mkdir $WORK/mcr
cd $WORK/mcr
wget http://www.mathworks.com/supportfiles/downloads/R2014a/deployment_files/R2014a/installers/glnxa64/MCR_R2014a_glnxa64_installer.zip
unzip MCR_R2014a_glnxa64_installer.zip
./install -mode silent -agreeToLicense yes -destinationFolder $WORK/mcr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment