* FFTW performance
@ 2001-04-10 7:32 Eugene Chu
2001-04-10 7:35 ` Linus Gasser
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Eugene Chu @ 2001-04-10 7:32 UTC (permalink / raw)
To: axp-list
Hello Alphans,
Now that my UP2000 is humming along pretty well for the most part, I
started to run some benchmarks on it. The CPU benchmark that we use
most often is running FFTs. More specifically, we use the FFTW package
from MIT. It seems to run quite well on all platforms, except on this
Alpha system. We've tried building it with both GCC and CCC, and the
results were similar; the FFTs run at about the same rate as on a Sun
Blade 1000 (750 MHz). If one were to compare SPEC results between
these two systems, one might expect the Alpha (833 MHz) to be almost
100% faster than the UltraSPARC-III. So the problem must be in the
code generated by the compilers; perhaps they simply are not very well
optimized (either CCC or GCC). Are there any special flags (besides
-fast) that will generate better code?
I'll try CXML next.
thanks,
eyc
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: FFTW performance
2001-04-10 7:32 FFTW performance Eugene Chu
@ 2001-04-10 7:35 ` Linus Gasser
2001-04-10 10:49 ` T. Daniel Crawford
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Linus Gasser @ 2001-04-10 7:35 UTC (permalink / raw)
To: axp-list
On Tuesday 10 April 2001 09:32, you wrote:
> Hello Alphans,
> Are there any special flags (besides
> -fast) that will generate better code?
Hi,
I didn't try it yet, cause I don't need high-optimized software. But from
http://www.alphalinux.org
I got the following adress:
http://www.support.compaq.com/alpha-tools/software/index.html
As far as I know, this compiler is better optimized. There is also a
math-library from Compaq on the same site.
Have fun with ur alpha,
Ineiti
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: FFTW performance
2001-04-10 7:32 FFTW performance Eugene Chu
2001-04-10 7:35 ` Linus Gasser
@ 2001-04-10 10:49 ` T. Daniel Crawford
2001-04-10 13:10 ` Jay Estabrook
2001-04-10 14:44 ` Greg Lindahl
3 siblings, 0 replies; 7+ messages in thread
From: T. Daniel Crawford @ 2001-04-10 10:49 UTC (permalink / raw)
To: axp-list
On Tue, 10 Apr 2001, Eugene Chu wrote:
> Hello Alphans,
>
> Now that my UP2000 is humming along pretty well for the most part, I
> started to run some benchmarks on it. The CPU benchmark that we use
> most often is running FFTs. More specifically, we use the FFTW package
> from MIT. It seems to run quite well on all platforms, except on this
> Alpha system. We've tried building it with both GCC and CCC, and the
> results were similar; the FFTs run at about the same rate as on a Sun
> Blade 1000 (750 MHz). If one were to compare SPEC results between
> these two systems, one might expect the Alpha (833 MHz) to be almost
> 100% faster than the UltraSPARC-III. So the problem must be in the
> code generated by the compilers; perhaps they simply are not very well
> optimized (either CCC or GCC). Are there any special flags (besides
> -fast) that will generate better code?
>
> I'll try CXML next.
>
> thanks,
> eyc
>
Eugene,
I am a computational quantum chemist at Virginia Tech and also have several
alphas (XP-1000's in my case). When I first purchased the workstations,
their performance under alpha/Linux was very poor (i.e. a factor of
four-eight slower) relative to the same hardware running Tru64. I have
spent a great deal of time optimizing their performance, and things are
vastly improved. Now my quantum programs run faster (ca. 33%) on my
alpha/Linux workstations than their Tru64 counterparts. My codes are
likely rather different from yours --- I do mostly multiplication of very
large matrices, data sorts, and lots of I/O as opposed to FFT's --- so my
optimization efforts may not help you at all.
Two questions:
(1) What memory block sizes does your code require? I.e., how large are
your malloc() calls and how many of them are there?
(2) What kernel are you running and from what distribution?
-Daniel
P.S. None of my optimization improvements came from compiler flags,
but instead from OS tweaking.
--
T. Daniel Crawford Department of Chemistry
crawdad@vt.edu Virginia Tech
www.chem.vt.edu/chem-dept/crawford Voice: 540-231-7760 FAX: 540-231-3255
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FFTW performance
2001-04-10 7:32 FFTW performance Eugene Chu
2001-04-10 7:35 ` Linus Gasser
2001-04-10 10:49 ` T. Daniel Crawford
@ 2001-04-10 13:10 ` Jay Estabrook
2001-04-10 18:33 ` jeff.sturm
2001-04-10 14:44 ` Greg Lindahl
3 siblings, 1 reply; 7+ messages in thread
From: Jay Estabrook @ 2001-04-10 13:10 UTC (permalink / raw)
To: axp-list
On Tue, Apr 10, 2001 at 12:32:34AM -0700, Eugene Chu wrote:
>
> Now that my UP2000 is humming along pretty well for the most part, I
> started to run some benchmarks on it. The CPU benchmark that we use
> most often is running FFTs. More specifically, we use the FFTW package
> from MIT. It seems to run quite well on all platforms, except on this
> Alpha system. We've tried building it with both GCC and CCC, and the
> results were similar; the FFTs run at about the same rate as on a Sun
> Blade 1000 (750 MHz). If one were to compare SPEC results between
> these two systems, one might expect the Alpha (833 MHz) to be almost
> 100% faster than the UltraSPARC-III. So the problem must be in the
> code generated by the compilers; perhaps they simply are not very well
> optimized (either CCC or GCC). Are there any special flags (besides
> -fast) that will generate better code?
>
> I'll try CXML next.
That and CPML ought to help if you use math functions a lot.
But please, refer to the following document for *lots* of tips,
including a discussion of compiler flags and such:
http://www.alphalinux.org/docs/perf.html
Good luck.
--Jay++
-----------------------------------------------------------------------------
Jay A Estabrook Alpha Engineering - LINUX Project
Compaq Computer Corp. - MRO1-2/K20 (508) 467-2080
200 Forest Street, Marlboro MA 01752 Jay.Estabrook@compaq.com
-----------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FFTW performance
2001-04-10 13:10 ` Jay Estabrook
@ 2001-04-10 18:33 ` jeff.sturm
0 siblings, 0 replies; 7+ messages in thread
From: jeff.sturm @ 2001-04-10 18:33 UTC (permalink / raw)
To: axp-list
On Tue, 10 Apr 2001, Jay Estabrook wrote:
> But please, refer to the following document for *lots* of tips,
> including a discussion of compiler flags and such:
>
> http://www.alphalinux.org/docs/perf.html
That's an excellent article. I appreciate the explanation of replay
traps, which aren't covered well in any other public document I've seen.
My only beef is that they aren't really fair to GCC, but I'll excuse it
because the article isn't meant to be a review, and after CCC is their
own. They don't say what version they use, but they called it EGCS, so
I'd guess it is 2-3 years old. The GCC backend has made a bit of progress
since then.
Besides the points in this article there are a couple of other things I
learned while tuning my code for Alpha that I haven't seen mentioned
anywhere else. Keep reading if you're interested...
1) Use both register sets where possible.
Somewhere, sometime long ago I got it into my head that floating-point
registers are best avoided for non-numeric computing. That probably comes
from the days of microprocessors without efficient fp units. So I tend to
always use `int' types (including short, long, etc.) to declare local
variables.
While tuning a large loop to avoid register spillage, I realized that some
of the locals didn't really need to be integers, i.e. that rounding errors
would be tolerable to the algorithm. Declaring these as double left
enough integer registers available to avoid spillage altogether. As a
result I got an instance 20% improvement.
Be careful about int<->fp conversions however; on some CPUs these require
a memory access (alphas prior to EV6, IIRC).
The same may hold true for mostly-FP programs; the integer set can go
underused.
2) Using extra operations to avoid memory accesses.
Another habit that dies hard is reducing the complexity of code, favoring
shorter, simpler instruction sequences everywhere. Common sense dictates
that removing a few instructions here and there helps optimize code. On
modering CPUs sometimes the reverse is true-- to a certain point, the more
instructions available inside a function or loop (i.e. the longer a basic
block) the better job a compiler or CPU can do to schedule. Sometimes the
compiler will even insert NOP instructions to help avoid pipeline stalls.
For most code I work on the critical bottleneck is not the processor's
pipeline but memory throughput. One block of code I experimented with
needed a large array of boolean values, declared as an int[]. I had
guessed it was memory limited, as my overall CPI was higher than 2. My
first attempt to help it allocated the boolean table as a
char[]. Surprisingly that had negligible effect. (The original int array
was not too large to fit in secondary cache anyway, and the real choke
point I suspect was the CPU's store buffer.)
Next I tried a bitmap of boolean values. I wasn't very confident this
would help, because although the array size became 1/32 its original size
the code to access random bits was littered with shift and mask
operations.
It ran twice as fast as the original, despite performing an equal count of
load/store instructions. My CPI shot down below 1, and the alpha now
performed the loop faster than equivalent code on x86 or sparc (it had
been slower before). One explanation for the improvement is that the
alpha could merge consecutive stores to the same location, which it could
apparently not do for consecutive locations, even to the same cache line
(not sure about that though). The alpha happily consumed the extra
instructions, feeding both of its integer units.
Another way to look at it is that the same optimizations we've known for
decades to avoid disk accesses are now becoming relevant for memory
access, since memory technology has not held pace with microprocessors.
--
Jeff Sturm
jeff.sturm@commerceone.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FFTW performance
2001-04-10 7:32 FFTW performance Eugene Chu
` (2 preceding siblings ...)
2001-04-10 13:10 ` Jay Estabrook
@ 2001-04-10 14:44 ` Greg Lindahl
3 siblings, 0 replies; 7+ messages in thread
From: Greg Lindahl @ 2001-04-10 14:44 UTC (permalink / raw)
To: axp-list
> More specifically, we use the FFTW package
> from MIT. It seems to run quite well on all platforms, except on this
> Alpha system.
Doesn't the fftw website have some performance graphs? I was able to
recover the correct answer for the Alpha when I was running a year ago
with CCC on my XP1000s.
-- g
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: FFTW performance
@ 2001-04-10 23:42 Tom Morris
0 siblings, 0 replies; 7+ messages in thread
From: Tom Morris @ 2001-04-10 23:42 UTC (permalink / raw)
To: axp-list
On Tuesday, April 10, 2001 3:33 AM, chu@tes-mail.jpl.nasa.gov
[SMTP:chu@tes-mail.jpl.nasa.gov] wrote:
> Are there any special flags (besides -fast) that will generate better
code?
To answer the last question first, since it seems to have attracted the
most comment, ccc -fast will typically get you 90% of the way there and
is probably all you need for most applications.
> The CPU benchmark that we use
> most often is running FFTs. More specifically, we use the FFTW package
> from MIT.
Even more specifically, I understand from a private conversation with
Eugene that their benchmark uses a single size of 131072 points for
the FFT test. As it happens, this is in a region where FFTW seems
to choose an algorithm which is particularly sub-optimal for Alpha.
If you look at http://www.fftw.org/benchfft/results/alpha467.html
you can actually see that this behavior goes back all the way
to EV56 and FFTW2.0 For powers of two at 16K points and above,
CWP significantly outperforms that algorithm that FFTW is using.
Running benchFFT with FFTW2.1.3 and CXML 4.0.0 shows
FFTW to be 2-5 times faster for powers of 2 between 2 and 64.
Between 128 and 4K both packages are within 10-15% of each
other. FFTW is 30% faster at 8K. At 16k and above, CXML is
1.5 to 5 times faster than FFTW. Specifically at 128K, CXML
is 2.6 times faster than FFTW. Comparing the performance
for CXML and CWP, I'd guess that CXML actually uses the
CWP algorithm in this region.
For non-powers of 2, or at least those that are tested by
benchfft, FFTW is consistently better than most other
algorithms/packages and CXML is very erratic in its
performance.
This isn't really the kind of problem that will be helped by
compiler switches or even better compilers. This is
largely a data flow problem and the data access pattern
is something intrinsic to the algorithm. The compiler's
going to have little luck fixing it up after the fact to try
and match the machine's architecture.
I haven't looked at what FFTW is doing specifically, but
it's obviously not making effective use of the high speed
DDR cache on the 833 MHz Slot B module.
If FFTs are important to you, it's worth having a look at
the different algorithms available, because they have
different strengths and weaknesses and VERY different
performance characteristics.
For Eugene's application at a size of 128K points, it
looks like CXML or CWP is the way to go. At smaller
sizes, FFTW is pretty hard to beat.
Tom
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2001-04-10 23:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-04-10 7:32 FFTW performance Eugene Chu
2001-04-10 7:35 ` Linus Gasser
2001-04-10 10:49 ` T. Daniel Crawford
2001-04-10 13:10 ` Jay Estabrook
2001-04-10 18:33 ` jeff.sturm
2001-04-10 14:44 ` Greg Lindahl
-- strict thread matches above, loose matches on Subject: below --
2001-04-10 23:42 Tom Morris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox