|
I solved my problem! I post it, so maybe it will help others.
The correct syntax is
mcc -m -v -R -singleCompThread myFunction.m
(note the - in front of the singleCompThread!)
Unfortunately matlab doesn't give a warning, so it's not so easy to find out the error.
Nora
"Nora" wrote in message <jgb5s1$68j$1@newscl01ah.mathworks.com>...
> Hi,
>
> I have similar problems. I want to compile a matlab function to stand-alone program with mcc. What I do is to start matlab as
>
> matlab -singleCompThread
>
> Then on the command line I execute
>
> mcc -m -v -R singleCompThread -R nojvm -R nodesktop -R nosplash myFunction.m
>
> Everything compiles, but when I run myFunction, I still see that it uses more than 100% processor (more than one processor).
> I also added the lines
>
> LASTN = maxNumCompThreads(1);
> disp(['currently allowed comp threads are: ',num2str(maxNumCompThreads)]);
>
> to the begin of myFunction. The number displayed is indeed 1, but processor use goes up to above 600% again.
> Please let me know if I did something wrong, or you have further ideas to try out. I would like to run my code on a cluster, thus it is really important to have it single threaded.
> I use Matlab 2011b, 64 bit, unix operating system
>
> Thank you
>
>
>
> "Shaf " <shafquat.rahman@mathworks.com> wrote in message <h9qkti$14m$1@fred.mathworks.com>...
> > "Steve Rennie" <srennie89@hotmail.com> wrote in message <h9iong$b9g$1@fred.mathworks.com>...
> > > Is it possible to make compiled matlab for version 7.8 (2009a) or later single-threaded?
> > >
> > > The maxNumCompThreads function apparently is no longer supported, and compiling inside matlab with the -singleCompThread specified, not surprisingly, does not work.
> > >
> > > Thanks for your help.
> > >
> > > Steve
> >
> > Hi Steve,
> >
> > Are you building a standalone or a shared library? For shared libraries you can pass "-singleCompThread" to mclInitializeApplication as an option. In the case of standalone you can compile with
> >
> > mcc -R -singleCompThread -mv foo.m
> >
> > ====================
> > function foo
> > maxNumCompThreads
> > ====================
> >
> > If you run the compiled exe you will see 1 being printed.
> >
> > Thanks,
> > Shaf
|