64 Bit version of Matlab 2015a a lot slower than 32bit version

2 次查看(过去 30 天)
I recently did a huge computer upgrade to run faster Matlab simulations. I went from my laptop (Intel i7-2720QM @2.2Ghz and 4GB of Ram, 32bit OS) to my tower computer (Intel Xeon E5-2697 @ 2.6 Ghz Dual Processor, 128GB Ram, 64 bit OS) This tower computer processor should be about 5x faster than my laptop based on a benchmarking website.
I also 'upgraded' to 64-bit Matlab. When I ran the same code that took about 8 seconds on my laptop, it took 14 seconds on my tower!!!! What?!?!?!!?
Here are some exact results. They are running the exact same code. I also ran the profiler to determine where the slowdown occurred. There are 4 main functions that contribute to the run time of the code: "Distances", "Cut", "Map", and "Coordinates"
32 Bit Laptop 32bit Matlab 2015a (total time 36.5 s)
Distances - 9.9s
Cut - 8.9s
Map - 7.3s
Coordinates - 2.9s
64 Bit Tower 32bit Matlab 2015a (total time 48 s)
Distances - 19.5s
Cut - 7.9s
Map - 0.9s
Coordinates - 6.0s
64 Bit Tower 64bit Matlab 2015a (total time 74.5 s)
Distances - 15.4s
Cut - 10.5s
Map - 31.2s
Coordinates - 5.6s
The main contributor in "Distances" is a
distancesz=bsxfun(@hypot,distancesx,distancesy)
which contributes:
  • 40% of the run time (4s) in 32bit Laptop mode
  • 66% of the run time (13s) in 32bit tower mode
  • 30% of the run time (4s) in 64bit tower mode
Map probably the most interesting
Here is the timing for the 32 bit laptop
Here is the timing for the 32bit tower configuration
Here is the timing for the 64bit tower configuration
So the 32bit on my tower is ANNIHILATING the Map code, but the 64bit on the tower is majorly flunking the map code. Any ideas why?
I'm going to look into power setting of the tower to see if it's holding me back.
I have read a multiple threads that the only advantage of the 64-bit matlab is that you can have access to more memory, but it seems a little ridiculous that a 5x faster computer would run the same code slower. I will install the 32-bit matlab and report back on the Matlab run times.
  4 个评论
Joe
Joe 2015-5-14
I've looked at that website and understand the Intel libraries. From this website it says that Matlab has used the Intel MLK since version 7. How do I check that my Matlab has these libraries installed?

请先登录,再进行评论。

回答(2 个)

Philip Borghesani
Philip Borghesani 2015-5-14
Two things to look into:
Independently (of MATLAB) check the machines performance. And also post bench results from the same version of MATLAB from both machines if possible. We have seen a number of cases recently where new server machines were mis-configured for power savings or other settings and running slowly.
Profile your code on both machines and look to see if the difference is isolated to one functions or loop that can help isolate the problem. There are some situations where the 64 bit jit does not work as well as the 32 bit one and minor code changes can bring back the performance.
  2 个评论
Joe
Joe 2015-5-14
Phillip,
Thanks for these questions. I have answered them by updating the original question with more detailed specs.
Philip Borghesani
Philip Borghesani 2015-5-14
The loop code with map_temp looks like a classic case of something the Jit might have difficulty with, try breaking the long line up into multiple lines hopefully that will be fast on all platforms. It looks to me that your indexing operation is repeated so this should be much faster:
idx=(c1(m,s)-1)*(grid_y+1) + r1(m,s);
map_tmp(idx)=map_tmp(idx) + crown(s);

请先登录,再进行评论。


Chris Hooper
Chris Hooper 2016-3-3
Did you try running the benchmarks multiple alternating times to avoid the order effect? running a matlab code is often slowest the 1st time especially if a lot of files are being accessed. immediately running the same code again can produce a faster benchmark result the 2nd time.

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by