Try running the following 1000*1000 matrix multiplication test:
>>> from numpy import *
>>> import time
>>> A = random.random((1000,1000))
>>> B = random.random((1000,1000))
>>> t = time.time(); dot(A,B); print time.time()-t
Disappointed about the time this takes? Take a minute to check that you are running the right ATLAS for your computer. On my Mac this test was fast (0.2-0.3s) but on my desktop running Ubuntu very slow (5-6s). In Ubuntu, open the Package Manager and search for "atlas". If you find something like "libatlas3gf-base" you are using a generic version that works on most hardware. Unless your computer is antique, you can probably do better. Try selecting "libatlas3gf-sse2" (or even libatlas3gf-sse1 if this doesn't work) instead and run the test again. (on other linux platforms the process should be similar)
Tests I did on a couple of machines show speedup of a factor 4-10. Well worth the minute it takes to check and fix. Thanks Martin!
6 comments:
Friend if you are again thinking about, “How to speed up your computer?” This is the exact answer that is computer speedup which will speedup your computer just by deleting corrupted files from your computer.
A great post as always. I didn't realize Ubuntu comes with atlas packages built for SSE2. Thank you.
Excellent post and writing style. Bookmarked.
Cool. Installed SSE2 lib and that test runs 4x faster!
If you install atlas from source it will run a whole slew of benchmarks to tune itself to your hardware. The sse2 packages are still quite 'generic' in the sense that they are built for average values of memory and cache sizes and latencies.
While you won't see the huge gains compared to going from non sse to vectorized instruction sets, you could still be looking at a few percent!
The same is true for fftw!
Wow this is very nice blog when I saw it then I become very happy so that i want to share my knowledge about a Canada Cartridge. Toner Parts Offer High Quality and affordable Ink and Toner Cartridges in Canada & US. Toner Cartridges US & Canada, Discount inkjet and toner cartridges, Inkjet Printer cartridges, and LaserJet Printer cartridges, Compatible and OEM Toner Cartridges.
Post a Comment