Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Windows XP vs. Gentoo: Execution speeds (Matlab - specific)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
kybber
Apprentice
Apprentice


Joined: 25 Jun 2002
Posts: 228
Location: Trondheim, Norway

PostPosted: Fri Jul 05, 2002 12:52 pm    Post subject: Windows XP vs. Gentoo: Execution speeds (Matlab - specific) Reply with quote

I am trying to transition from XP to Gentoo. One of the tools I use the most is Matlab. I was very surprised to see that the execution speed in Gentoo was actually 40-50% slower than that of Windows XP. I tried both simple for-loops in matlab-code and more complex c-based mex-functions (for you who do not know: these are compiled using gcc and run in the matlab environment), and the result was the same. This saddens me since executionspeed in Matlab is highly essential for my work.

Does anyone have similar experiences, or experiences that contradict this?

Has anyone installed Matlab in any Linux distro and compared executionspeed with Windows?
Back to top
View user's profile Send private message
delta407
Bodhisattva
Bodhisattva


Joined: 23 Apr 2002
Posts: 2876
Location: Chicago, IL

PostPosted: Fri Jul 05, 2002 4:50 pm    Post subject: Reply with quote

I run Windows 2000 under VMware under Gentoo and have found on occasion that it runs faster under VMware than it does natively on the same box.

What kernel are you using? It could be a config issue.
_________________
I don't believe in witty sigs.
Back to top
View user's profile Send private message
kybber
Apprentice
Apprentice


Joined: 25 Jun 2002
Posts: 228
Location: Trondheim, Norway

PostPosted: Tue Jul 09, 2002 7:00 am    Post subject: Reply with quote

I am using this kernel: linux-2.4.19-gentoo-r7

Since I am still quite a newbie with Linux I haven't messed too much around with the config, i.e. no RT scheduling, low-latency etc. Pretty much a default gentoo kernel with added support for my Dell laptop, filesystems, USB etc. I'll be happy to post the .config here if you think it could help in determining the problem.
Back to top
View user's profile Send private message
Ozymandias
Tux's lil' helper
Tux's lil' helper


Joined: 10 Apr 2002
Posts: 81
Location: Netherlands

PostPosted: Tue Jul 09, 2002 9:21 am    Post subject: Reply with quote

Does matlab compile the code with gcc optimalisations, and are u quite sure matlab compiles these functions? I used matlab a time ago, allways thought it uses a interpeter.
But you didn't compile matlab yourself, so perhaps it compiles its code the same way as matlab was compiled, so it can link the code, but this will probably by with -march 386 and -O2 if you are lucky.
Last, winNT (and therefor win2000 and XP) give higher priority to applications that are in focus, try nicing matlab with a lower nice value.

greetz Ozy
Back to top
View user's profile Send private message
kybber
Apprentice
Apprentice


Joined: 25 Jun 2002
Posts: 228
Location: Trondheim, Norway

PostPosted: Tue Jul 09, 2002 11:23 am    Post subject: Reply with quote

You are correct that Matlab uses an interpreter for its m-scripts, but you can also program so called mex-functions in c and compile them in Matlab. This increases executionspeed by an order of 10-100 easily.

The way Matlab compiles mex-functions is defined in ~/matlab/R12/mexopts.sh. My settings are:
Code:

RPATH="-Wl,--rpath-link,$TMW_ROOT/extern/lib/$Arch,--rpath-link,$TMW_ROOT/bin/$Arch"
            CC='gcc'
            CFLAGS='-fPIC -march=i686 -O3 -pipe -D_GNU_SOURCE -pthread'
#            CFLAGS='-fPIC -D_GNU_SOURCE -pthread'
            CLIBS="$RPATH $MLIBS -lm"
            COPTIMFLAGS='-O -DNDEBUG'
            CDEBUGFLAGS='-g'
#
            LD="$COMPILER"
            LDFLAGS="-pthread -shared -Wl,--version-script,$TMW_ROOT/extern/lib/$Arch/$MAPFILE"
            LDOPTIMFLAGS='-O'
            LDDEBUGFLAGS='-g'
#
            POSTLINK_CMDS=':'


I have manually added the '-march=i686 -O3 -pipe' myself, according to my settings in /etc/make.conf. This didn't make any difference in executionspeed. (Though I don't know if any of the other flags, e.g. COPTIMFLAGS='-O...' corrupts my settings).

To clarify: Both Matlab's own m-scripts (using interpreter) and compiled mex-functions (using the above settings) are 40-50% slower in Linux than in XP.

Nice'ing matlab with differenc evalues didn't make any noticeable difference.
Back to top
View user's profile Send private message
Manny Calavera
n00b
n00b


Joined: 21 May 2002
Posts: 68
Location: Germany / near Munich

PostPosted: Tue Jul 09, 2002 12:00 pm    Post subject: Reply with quote

There is a basic rule: A software runs best under the environment it's created in. It's not always true but in this case i think it's all about 'bad' porting.

see you,
- Manny -
_________________
Viva la revolución!
Back to top
View user's profile Send private message
Naan Yaar
Bodhisattva
Bodhisattva


Joined: 27 Jun 2002
Posts: 1549

PostPosted: Tue Jul 09, 2002 12:04 pm    Post subject: Reply with quote

It's been quite a while, but I believe Matlab was first available on Unix before DOS/Windows.

Manny Calavera wrote:
There is a basic rule: A software runs best under the environment it's created in. It's not always true but in this case i think it's all about 'bad' porting.

see you,
- Manny -
Back to top
View user's profile Send private message
Ozymandias
Tux's lil' helper
Tux's lil' helper


Joined: 10 Apr 2002
Posts: 81
Location: Netherlands

PostPosted: Tue Jul 09, 2002 12:56 pm    Post subject: Reply with quote

you could email MathWorks to ask them about it.
but matlab was first (in 1970's) for fortran, so later they changed to c, the question is what are they based on now?
Back to top
View user's profile Send private message
mglauche
Retired Dev
Retired Dev


Joined: 25 Apr 2002
Posts: 564
Location: Germany

PostPosted: Tue Jul 09, 2002 1:14 pm    Post subject: Reply with quote

I think they probably used intel's compiler for the win32 platform, which can geratly enhance execution speed on some processors (like pentium4). This could explain the speed difference.

Also I think your compliler plays the smallest part in the game, becuse its important which compiler THEY used for compiling their math libraries. (i somehow doubt, the provide you with full source, do they ?)
Back to top
View user's profile Send private message
masseya
Bodhisattva
Bodhisattva


Joined: 17 Apr 2002
Posts: 2602
Location: Baltimore, MD

PostPosted: Tue Jul 09, 2002 1:50 pm    Post subject: Reply with quote

mglauche wrote:
I think they probably used intel's compiler for the win32 platform, which can geratly enhance execution speed on some processors (like pentium4). This could explain the speed difference.

Wouldn't they then have to choose some optimizations to make use of the intel compiler? How would a windows based installation of Matlab know which pre-compiled executable to run? Does Matlab compile its libraries at install time in windows? I would think that a clickty-click install on windows would run slower than a gcc-based optimized version on any linux system because it would have to be compiled to work with a wide range of processors and the optimized version is, well, optimized.
_________________
if i never try anything, i never learn anything..
if i never take a risk, i stay where i am..
Back to top
View user's profile Send private message
bidz
n00b
n00b


Joined: 08 Jun 2002
Posts: 54
Location: Norway

PostPosted: Tue Jul 09, 2002 1:59 pm    Post subject: Reply with quote

what about trying out the Intel C/CPP compiler for Linux (i think version 6 is the latest, atleast thats what i have) - and see if that makes a difference in speed, etc.
_________________
bidz @ efnet
Back to top
View user's profile Send private message
kybber
Apprentice
Apprentice


Joined: 25 Jun 2002
Posts: 228
Location: Trondheim, Norway

PostPosted: Wed Jul 10, 2002 9:14 am    Post subject: Reply with quote

A colleague of mine who dual-boots (Mandrake) Linux and Windows has experienced a similar behavior as with my setup. This leads me to believe that it isn't Gentoo that's at fault (as expected! :-) ), but rather the Linux Matlab binaries that haven't been compiled optimally. Perhaps they just used pure i386 compilation? However, considering the fact that Matlab is supposed to handle highly intensive mathematical analysis and simulation, one'd think they at least would try to get the binaries optimized...

Anyways, I have contacted Mathworks and am currently awaiting their response. I'll be happy to post the conclusion (if any) here.
Back to top
View user's profile Send private message
KiTaSuMbA
Guru
Guru


Joined: 28 Jun 2002
Posts: 430
Location: Naples Italy

PostPosted: Wed Jul 10, 2002 2:05 pm    Post subject: Reply with quote

I wonder if there can be found additional toolboxes (or use the matlab ones) under octave... That would show them what optimization means... :wink:
On the other hand, other Open Source symlink-like apps come with either few ready "nodes" or with extremely barebone documentation or both.

As you can imagine, I cannot afford a un*x version of matlab, so I'm pretty stuck on this one.
_________________
Need to flame people LIVE on IRC? Join #gentoo-otw on freenode!
Back to top
View user's profile Send private message
Jondot
n00b
n00b


Joined: 11 Apr 2002
Posts: 55
Location: Bordeaux, France

PostPosted: Thu Jul 11, 2002 6:51 am    Post subject: Reply with quote

KiTaSuMbA wrote:
I wonder if there can be found additional toolboxes (or use the matlab ones) under octave... That would show them what optimization means... :wink:
On the other hand, other Open Source symlink-like apps come with either few ready "nodes" or with extremely barebone documentation or both.

As you can imagine, I cannot afford a un*x version of matlab, so I'm pretty stuck on this one.


I don't think octave has toolboxes, but scilab has them (and does have an ebuild).

scilab has never been faster than on my gentoo box btw...

As concerns slowness for the .c added externally to matlab, it has already been mentionned, but I guess trying out intel compiler (if your proc is an intel of course !) could speed up things a little... (it does have an ebuild : emerge icc). AFAIK, icc is free for personnal (not commercial) use.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum