Re: a standalone application from matlab compiler?



I agree with you that with large dataset, a 64-bit computer
is the go, in order to save all those hassles. Many thanks!


roberson@xxxxxxxxxxxxxxxxxx (Walter Roberson) wrote in
message <fb0amj$sv7$1@xxxxxxxxxxxxxxxxxxxxxxx>...
In article <fb029m$pe3$1@xxxxxxxxxxxxxxxxxx>,
HIu <sealights30@xxxxxxxxx> wrote:

I recently used the Matlab compiler to generate a standalone
exe file. The dataset is large and Matlab can not read in
the large dataset. Therefore I use the Matlab compiler to
create a standalone .exe file. Use the .exe file, I can read
in the dataset but at some step in processing the dataset,
the program is broken saying that "Out of memory" and
"MATLAB:nomem". I am quite confused. The standalone .exe
file, as the name implies, should not rely on the Matlab
when running and thus I donot understand why the problem is
Matlab related.


function main

load('D:\purch.dat');
t2=clock;
pmean=mean(purch)
t3=clock;
tmean=etime(t3,t2)
psize=size(purch(:,2:16))

When matlab produces an executable, it does not compile in
the code for each of the matlab functions you use (or
which those functions call upon to do portions of the work).
Instead, matlab uses a fixed shared library (.dll in
Windows terms)
which contains all of the core matlab routines, and the
compiled executable calls into the shared library at need.


After I used mcc to compile the M file to a .exe file and
run the .exe file under the DOS command Prompt, I got the
following message:

tmean=
187.1410
??? Out of memory. Type HELP MEMORY for your options
Error in ==> wm at 9
(I note: the 9th line is psize=size(purch(:,2:16))
MATLAB:nomem

If memory is short, why would you take a size like that???
size(purch(:,2:16)) is going to be the same as
[size(purch,1), size(2:16,2)] which is going to be the same as
[size(purch,1), 15].

When you do it the way you have coded, Matlab has to take
a copy
columns 2 thru 16 of all of the rows of purch, and then
run the
size() operator on the result (and then throws away the
temporary copy.)
If you code it the way I show, as [size(purch,1),
size(2:16,2)]
or [size(purch,1), 15] then Matlab will not need to take a
copy
of the data at all, and the statement will not run out of
memory.

With that change, you probably wouldn't even run out of memory
in a plain .m file (unless later code chews up memory.)
--
Is there any thing whereof it may be said, See, this is
new? It hath
been already of old time, which was before us. --
Ecclesiastes

.



Relevant Pages

  • Re: Small complete distribution
    ... would like to run on multiple machines for accelerated calculation. ... want to write an activeX control, which will download my exe file to ... to rework their compiler to allow complete standalone packaging. ... It should not be too hard for matlab to locate the functions ...
    (comp.soft-sys.matlab)
  • Re: How to speed up my .m code?
    ... Modern versions of the Matlab ... compiler compile to an intermediate code representation that runs at the same speed ... increase the speed of the memory on your system ... Using multiple cores might not provide any noticeable speed increase: ...
    (comp.soft-sys.matlab)
  • Re: How to speed up my .m code?
    ... Modern versions of the Matlab ... compiler compile to an intermediate code representation that runs at the same speed ... increase the speed of the memory on your system ... Using multiple cores might not provide any noticeable speed increase: ...
    (comp.soft-sys.matlab)
  • Re: a standalone application from matlab compiler?
    ... Therefore I use the Matlab compiler to ... create a standalone .exe file. ... Out of memory. ...
    (comp.soft-sys.matlab)
  • Re: M-Files to Executables
    ... .exe file. ... Matlab compiler. ... you need to install a massive file (from memory ... the compiler on this installation, ...
    (comp.soft-sys.matlab)