Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Matlab R12 vs. R11, unix() and CPU load

Subject: Matlab R12 vs. R11, unix() and CPU load

From: Mark Astridge

Date: 17 May, 2001 12:44:37

Message: 1 of 11

Having just been forced to upgrade to R12 due to license expiration of
R11, we have run into a problem related to CPU usage when executing
unix commands from within matlab.

From the matlab command line our main matlab script is run:

Then somewhere in the script we execute:

       unix('.....some command....');

Under R11 our machine (SGI Octane, IRIX 6.5.5) while executing the shell
command matlab would consume about 0.5% of the CPU time as reported by
'top' and our process 95-98%.

Under R12 matlab consumes ~50% and ours ~50%. We do start matlab with
the -nodisplay option since we have no need for the integrated workspace
thingy. (being unix types we are set in our ways.......)

Our simulations take days to run and our process is running 95% of the
time. Matlab does housekeeping and generates figures.

I've been unable to find a simple solution to this (I flirted with the
idea of using 'nice' somehow) and as usual this comes up near a deadline
for a PhD student so completely rewriting the code is not an option. If
our license for R11 had 1 more month on it we might have made it.

If anybody has any ideas, even obvious ones, please let me know.

Mark

Subject: Matlab R12 vs. R11, unix() and CPU load

From: phundie

Date: 17 May, 2001 16:01:57

Message: 2 of 11

Mark Astridge wrote:

> If anybody has any ideas, even obvious ones, please let me know

How about trying matlab -nojvm, this completely turns off Java support
(as opposed to leaving Java enabled, but just turning off the integrated
desktop) which is the biggest difference between R11 and R12.

Is your UNIX command complex, I mean, is it is pipeline or something or
just
a straight call to an executable? You might try playing with the UNIX
command
line.

-- phundie

Subject: Matlab R12 vs. R11, unix() and CPU load

From: Mark Astridge

Date: 17 May, 2001 17:18:44

Message: 3 of 11

This is a good idea but I actually tried it after I wrote the message.
At first due to the users alias for matlab (matlab = matlab -nodesktop)
it wouldn't work at all. After I fixed the alias -nojvm still had no
effect.

The unix command calls a simple executable which runs something called
DADS. All parameters are in files. Unfortunately the problem isn't the
operating system it's Matlab.

I want to avoid changing the unix call to identify the parent matlab
process and lower its priority - and I'm not even sure I can do that
without giving it root privileges.

phundie wrote:
> How about trying matlab -nojvm, this completely turns off Java support
> (as opposed to leaving Java enabled, but just turning off the integrated
> desktop) which is the biggest difference between R11 and R12.
>
> Is your UNIX command complex, I mean, is it is pipeline or something or
> just
> a straight call to an executable? You might try playing with the UNIX
> command
> line.

Subject: Matlab R12 vs. R11, unix() and CPU load

From: Sergei Morozov

Date: 17 May, 2001 22:49:01

Message: 4 of 11

Mark Astridge wrote:

>
>
> I've been unable to find a simple solution to this (I flirted with the
> idea of using 'nice' somehow) and as usual this comes up near a deadline
> for a PhD student so completely rewriting the code is not an option. If
> our license for R11 had 1 more month on it we might have made it.

License manager with R12 licenses should be able to serve R11 version too.
If you keep your old R11, you should be able to use it. I forgot the
details.

Best,
    sergei

Subject: Matlab R12 vs. R11, unix() and CPU load

From: Mark Astridge

Date: 18 May, 2001 08:01:37

Message: 5 of 11

One would expect that to be the case but we've been informed by the
system administrators that it is not. The University (Arizona State) has
a site license and license server. We can't take the risk that they are
correct but maybe some more investigation of the license is required.
I'm only getting the info second hand.

This is still unacceptable behavior for Matlab, almost like we're
running windoze applications.

Mark


Sergei Morozov wrote:
>
> License manager with R12 licenses should be able to serve R11 version too.
> If you keep your old R11, you should be able to use it. I forgot the
> details.
>
> Best,
> sergei

Subject: Matlab R12 vs. R11, unix() and CPU load

From: phundie

Date: 18 May, 2001 15:49:57

Message: 6 of 11

Mark Astridge wrote:
>
> This is a good idea but I actually tried it after I wrote the message.
> At first due to the users alias for matlab (matlab = matlab -nodesktop)
> it wouldn't work at all. After I fixed the alias -nojvm still had no
> effect.
>
> The unix command calls a simple executable which runs something called
> DADS. All parameters are in files. Unfortunately the problem isn't the
> operating system it's Matlab.

Yes. I can verify this behavior with R12 under Linux. unix('bash') eats
98% CPU time.

This is very unacceptable.

Well, you can use process priority to help you out. You only need root
privledges to take advantage of priorities lower than 0.

The following wrapper code should help:

#!/bin/bash

# get parent ID (ie Matlab process ID)
id=$PPID

# This greps out matlab's current NICE value for later restoration
# and sets matlab's nice to the lowest priority
oldnice=`ps ax -o pid,nice | grep $id | awk '{print $2}'`
renice +19 $id

# strictly speaking, this shouldn't be necessary all use processes
should run
# at 0 already anyhow .. but in case things are changed on your system
lets
# just try to get all the priority we can from the kernel
nice -n 0 $*

# restore the nice value that we saved
renice +"$oldnice" $id

--- end of script

This script works on Linux. And if your ps command works differently,
you
will need to change the grep line.

Call the script wrapper.sh, and make it executable.. now you can just
change your matlab unix call:

Old call: unix('foobar option1 option2');
New call: unix('wrapper.sh foobar option1 option2');

Hope this helps. Feel free to email me if you run into trouble.

-- phundie@yahoo.com

Subject: Matlab R12 vs. R11, unix() and CPU load

From: Sergei Morozov

Date: 18 May, 2001 13:37:36

Message: 7 of 11

Mark Astridge wrote:

> One would expect that to be the case but we've been informed by the
> system administrators that it is not. The University (Arizona State) has
> a site license and license server. We can't take the risk that they are
> correct but maybe some more investigation of the license is required.
> I'm only getting the info second hand.

Our group at stanford has a license server which runs flexlm on R12 license.
Other machines with their local
R11 have in /usr/local/matlab5/etc/license.dat a line that points to license
server. And so R11 could be run fine on them. This is first hand info. So I
suggest bugging your sys admins, or try to point your R11 machines to R12
license server.

Best,
        Sergei

Subject: Matlab R12 vs. R11, unix() and CPU load

From: Mark Astridge

Date: 18 May, 2001 16:35:29

Message: 8 of 11

Thanks for this. I'll get around to trying it even if we manage to work
out if the license administrators are incorrect about the expiry.

>
> Yes. I can verify this behavior with R12 under Linux. unix('bash') eats
> 98% CPU time.
>

Do you mean that 'bash' gets 98% of the CPU? This is the behavior we
want. In our case 'Matlab' gets 50% and 'bash' would get 50% when all
Matlab is doing is waiting for 'unix()' to exit.

If this is the case maybe the port to IRIX has a problem or IRIX itself
has a problem or.....


Mark

Subject: Matlab R12 vs. R11, unix() and CPU load

From: phundie

Date: 18 May, 2001 21:46:28

Message: 9 of 11

Mark Astridge wrote:
> Do you mean that 'bash' gets 98% of the CPU? This is the behavior we
> want. In our case 'Matlab' gets 50% and 'bash' would get 50% when all
> Matlab is doing is waiting for 'unix()' to exit.

No, on my system Matlab gets 98% CPU (because the bash process is idle).
If I launch a UNIX command that actually DOES something CPU intensive it
comes down to the 50/50 split that you experience.

So, I would say that it is most certainly a Matlab issue.

Going back to R11 would probably be best -- because even with renicing,
Matlab
will get more CPU cycles than you want it to be getting.

Renicing R11 may buy you a few extra cycles above your previous peak
performance
though.

Subject: Matlab R12 vs. R11, unix() and CPU load

From: Mark Astridge

Date: 19 May, 2001 21:56:12

Message: 10 of 11

And this turns out to indeed be the case.... Funny how trusting second
hand information leads to big panic and confusion.

There is a bug in R12 though, that has been fixed already for the next
release. Based on my past and present experience I can commend The
Mathworks for customer support second to none...

Thanks,

Mark


Sergei Morozov wrote:
>

> > correct but maybe some more investigation of the license is required.
> > I'm only getting the info second hand.
>
> Our group at stanford has a license server which runs flexlm on R12 license.
> Other machines with their local
> R11 have in /usr/local/matlab5/etc/license.dat a line that points to license
> server. And so R11 could be run fine on them. This is first hand info. So I
> suggest bugging your sys admins, or try to point your R11 machines to R12
> license server.
>
> Best,
> Sergei

Subject: Matlab R12 vs. R11, unix() and CPU load

From: Mark Klein

Date: 21 May, 2001 13:20:15

Message: 11 of 11

MATLAB R11 will run fine with the MATLAB R12 version of the license.dat file
and FLEXlm 6.1g, which comes with MATLAB R12.

I believe the bug Mark is referring to is in regards to the Linux operating
system. The MATLAB R12 license.dat file for the Linux operating systems has
a different encryption code then that included in MATLAB R11. For more
information regarding this issue, you can refer to the following URL:

http://www.mathworks.com/support/solutions/data/27232.shtml

I hope this helps!

-Mark


"Mark Astridge" <mark@astridge.ca> wrote in message
news:3B075C7C.4E2149CA@astridge.ca...
> And this turns out to indeed be the case.... Funny how trusting second
> hand information leads to big panic and confusion.
>
> There is a bug in R12 though, that has been fixed already for the next
> release. Based on my past and present experience I can commend The
> Mathworks for customer support second to none...
>
> Thanks,
>
> Mark
>
>
> Sergei Morozov wrote:
> >
>
> > > correct but maybe some more investigation of the license is required.
> > > I'm only getting the info second hand.
> >
> > Our group at stanford has a license server which runs flexlm on R12
license.
> > Other machines with their local
> > R11 have in /usr/local/matlab5/etc/license.dat a line that points to
license
> > server. And so R11 could be run fine on them. This is first hand info.
So I
> > suggest bugging your sys admins, or try to point your R11 machines to
R12
> > license server.
> >
> > Best,
> > Sergei

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us