CFD Online Logo CFD Online URL
Home > Forums > Main CFD Forum

assembly coding for CFD

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   November 2, 2000, 03:33
Default assembly coding for CFD
Andrei Chernousov
Posts: n/a
Can anybody tell is it worth to convert even the most time critical portion(s) of CFD code written in C to achieve a substantial speedup?

Thanks in advance,

  Reply With Quote

Old   November 2, 2000, 17:23
Default Re: assembly coding for CFD
John C. Chien
Posts: n/a
(1). Based on the theory of Garbage-in-grabage-out, the speed up is going to produce the garbage at a faster rate. This is especially true in CFD. (2). If you are doing computer games, then, you will have not choice but to find ways to speed up the code. (3). In CFD, if you are doing 3-D, it is usually very slow, or very very solw. The convergence and accuracy of the solution usually is more important (or much more important) than the speed of the code. (4). A very fast code also is very difficult to read. Well, the choice is yours. It is not easy to speed up a code, because modern compiler optimization is very effective.
  Reply With Quote

Old   November 3, 2000, 12:49
Default Re: assembly coding for CFD
Brian Gribben
Posts: n/a
I've seen some very impressive speed-ups when certain heavily-used routines are written in assembler. A disadvantage is that your code then becomes less portable and legible. And of course your compiler may be cleverer than you think and your effort may be wasted.

Whether it's "worth" the effort is of course very subjective, depending on your own skill set and what you consider important for your code. My overall feeling though is that it won't be worth the effort, spend your precious time doing something else!
  Reply With Quote

Old   November 4, 2000, 17:08
Default Re: assembly coding for CFD
Bob Anderson
Posts: n/a
In general, I don't think assembly (assembler is not a language, but the tool that converts assembly to machine language, i.e., an assembly "compiler") is worth it with the optimizing compilers available today. However, C does not optimize particularly well for some numerical applications. I've seen a typical speed-up of a factor of 2 or 3 when translating an explicit CFD C code into an equivalent fortran 77 code, and vice-versa.

What might be worth a shot is converting your most expensive inner loops to f77 (dissipation and viscous terms tend to be the culprits), and then using a quality optimizing compiler on them.

Even if speedup was possible using assembler, the maintenance and portability hits would, in most cases, far outweight the potential speedup gains.

  Reply With Quote

Old   November 9, 2000, 10:33
Default Re: assembly coding for CFD
Kenji Takeda
Posts: n/a
When in doubt, let somebody else do it for you ;-)

Intel has assembly coded BLAS 1,2 & 3, LAPACK and FFT routines for slotting into your own (CFD!) code. They are available for free download under the guise of the 'Intel Math kernel Library' from...

They are also available for Linux (a by-product of the ASCI Red project), but I can't remember the URL.

In general, you should use BLAS routines where possible, as other vendors typically supply (assembly) optimised versions with their systems as part of their 'fast' maths libraries.

My colleague here reports 2-3 times speedup on a spectral element CFD code using the Intel libraries under Windows NT!!!

Not sure if AMD have a similar set of libraries, but I do know that Digital Visual FORTRAN version 6.5, just out, contains Athlon optimisations.

Hope this is of use Dr Kenji Takeda ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ School of Engineering Sciences (Aeronautics and Astronautics) University of Southampton, UK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing Solidworks Assembly rmc CFX 3 September 30, 2014 10:34
[ICEM] un-create assembly tav98f ANSYS Meshing & Geometry 0 September 23, 2011 11:17
Is CFD coding in finite element method a formidable job? bearcat Main CFD Forum 0 June 18, 2010 20:53
Ground coding enquiry Wenqing Zhang Phoenics 2 August 12, 2002 11:56
User coding on NT w2k Philip Jones Siemens 0 November 26, 2001 04:43

All times are GMT -4. The time now is 21:59.