Sign in with
Sign up | Sign in
Your question

matlab code

Last response: in CPUs
Share
March 6, 2001 4:47:36 PM

I have read many post and benchmark regarding the higher Benchmark for the Athlon's FPU and thinking of building a machine mainly for number crunching. I had a matlab code to check how long it would take a machine to invert a 2000 by 2000 random complex matrix. I ran first on my machine with Asus A7V and 900mhz athlon with windows ME and 256MB of RAM. It took me 695 seconds. One of my coworker tried it on his 700Mhz PIII laptop with 128MB RAM(I think it was a Gateway)with windows 2000 and it took him 698 seconds. So I was really surprised. Next I installed windows 2000 on my machine and run the same code, and it took me 608 seconds, an improvement over last. However I was expecting to see the time cut down by at least half with the Athlon cpu.
One question I have is, am I safe to assume that the operation in matlab is mainly utilizing FPU of the CPU? or does it depends on other things as well? not sure if I am making sense. I know that having more RAM does help alot especially with windows 2000.
The other question is, if my first assumption is right, what did I do wrong? What can I do to improve on the speed of running the matlab code with Athlon CPU? I hope I am making sense.

More about : matlab code

Anonymous
a b à CPUs
March 7, 2001 1:37:18 AM

Moonsite,
I am not sure that I can be of any assistance in your quest to improve matlab performance, and how to change or improve it. I don't think you were doing anything wrong, actually.

As long as no other software is running, I don't understand how operating system could affect the outcome. That is, a dedicated test simply tests CPU performance. If the program itself is utilizes drivers (like a graphics test), I can see why, but brute force calculations simply run as fast as the processor can run.

Tragically, I doubt that you can scare up any help from this crowd. If you aren't bashing Intel or AMD, or spewing epithets about infamous members, you aren't likely to attract any attention.

Good Luck.

"Your brain wasn't meant to be a big wet paperweight"
Clonan, the Cyberian
March 7, 2001 1:40:50 AM

a laptop and a desktop comparison isn't a good benchmark. laptops are inherently slower, even with the same cpu and memory.

The reason win2k is faster is because it does multitasking a lot better...and since we all have something running in the background, win2k manages it a ton better.

If you really want to compare the two cpu's, compare two desktops....or just be happy with Dr. Tom's benchmarks :-)

~Crapple0

"intel inside, idiot outside"
Related resources
March 7, 2001 2:53:43 AM

That is a good note crapple0. Like you said though a laptop is usually slower, that is why I thought the athlon desktop would be much faster. Maybe it does depends on the size of the Matrix.

Thank you both for replying.
March 7, 2001 5:44:35 AM

If there is a difference in the amount of ram and you get above the threshold for one machine which is relatively easy to do, that can make a huge difference. I ran loops with more and more precision with the tic toc and diplayed the results. At some point when the matrix went above my amount ram it took 10 times as long even though there were only twice as many computations.
March 7, 2001 6:28:16 AM

Actually this topic came up the other day in my matlab/physics class. We're pretty sure its just the FPU that makes a huge difference, but the more ram the better. What we were curious was whether a dual processor system would help. I'm not sure that matlab utilizes a second processor.

I'm a bit confused as to why the AMD wouldn't run significantly better, but that is still a 13% performance boost you are getting. I'd be happy.

"I think I brained my damage"
Anonymous
a b à CPUs
March 7, 2001 12:08:53 PM

cannot help you yet but i do a lot of programming and would like to examine the code for matlab where can i get it, then i might have a better explanation
regards fred
March 7, 2001 12:36:16 PM

That is very streange. The 900MHz AMD chip (better FPU) was a desktop with 256 MB of RAM. The 700MHz Intel chip (worse FPU) was in a laptop with only half as much RAM.

By all logical accounts, the software should run faster on the Athlon chip system because it's:
A) Faster
B) Has a better FPU
C) Has twice as much memory

Yet the Intel laptop seems to be much more efficient.

That is a quandry. I have two theoretical explanations though:
1) The P3 chip may have more memory than the Duron. Durons aren't known for having much cache memory. I don't know if mobile P3s have more or not though, but if they do, that could explain a lot.
2) The Intel system was probably using a mobile BX derivative motherboard, while the AMD system was probably using a VIA derivative motherboard. We all know that VIA sucks for making high-performance motherboards. Intel's chipsets always outperform VIA's chipsets. So perhaps what we are really seeing is just how much of a difference there is between the two motherboards in their memory handling capabilities.

I would suggest (if at all possible) to try running the same code on a T-Bird instead of a Duron so we can at least see if the cache theory holds any water. Of course it would have to be a system with the same motherboard chipset though, otherwise if we saw a performance improvement we wouldn't be able to know if it was because of theory 1 or 2.

- Sanity is purely based on point-of-view.
March 7, 2001 1:16:41 PM

I think whether Matlab utilize the second processor or not depends on the operating system, not on Matlab itself. But I haven't tried on a dual processors system because I don't have one hehe. I am running a 900mhz Thunderbird, not a Duron though. I need to get a copy of Matlab for Linux so I can try it there. Now would different versions of Matlab also cause the difference in speed? The laptop is using Matlab 5.3 while the desktop is using Matlab 5.2.
Do you think that if I get up to 512 or 1gb of RAM that would improve the speed though?

I think the Matlab code goes like this:

clear all;

N = 2000; % size of the matrix

A = rand(N) + i*rand(N);
t = cputime;
B = inv(A);
cputime-t
March 8, 2001 9:42:44 AM

CPU time on an Asus A7V w/ duron 650@900 is 145.83
128 MB crucial Cas 2. IBM 75GXP, the hard drive may be important since the matrix is probably too large for my ram. Your cache theory probably just went out the window.
Matlab has a 'bench' function that it can use to test the FPU, you should try running that. From what I understand windows 2000 is better than 98 or ME(what I run) or anything else.
Last but not least, I have Matlab 6.0 so that could be a significat difference, although the code for inverting a matrix was probably already as optimized as possible a while ago. 6.0 could have significantly better memory managment.
March 8, 2001 9:49:59 AM

According to the bench function. The athlon FPU is better than Pentium 3 867 with regular memory access but worse with irregular memory access, which would be what your code is testing. My duron is still ranked faster than a P3 500 witt on irregular memory access.
March 8, 2001 2:19:40 PM

Thanks for that information. I've heard that the 6.0 came with some enhancement for matrix inversion and other things. So this is another reason why I should get a 6.0 and test it out.
April 30, 2001 4:13:48 PM

I have tested the Matlab 6.0 running windows 2000 and ME. With the above system, I got the time down to about 89 seconds or so. WinME is slightly slower. So there is a big improvement from Matlab 5.2 to 6.0. Just a note, I ran the same code on Dell Latitude laptop 850Mhz with 512Mb Ram. The time was 149 seconds. I think the hard drive has alot to do with that.
!