running Fortran code on Linux

Walter Dnes waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org
Thu May 12 03:49:49 UTC 2005


On Tue, May 10, 2005 at 10:12:05AM -0700, Michael Yang wrote

> I have a CFD Fortran code running on both Windows and Linux
> platforms. It surprised me that on windows system the code can use
> up to 50% cpu, while it can use only about 10% cpu in the linux
> system even there is no other program running. More than 80% of cpu
> is idle. BTW, both computers have intel 3GHz cpu. I am wondering if
> anyone has experience in programming under Linux enviroment. How can
> I make most use of the system resources, i.e., cpu, memory etc. Does
> my problem come from the code itself or from other things like the
> compiler etc.

  On Windows 2K and XP, you're always running a bloated GUI, whether you
need it or not.  On linux, KDE and GNOME can be just as bloated, but you
do have the option to turn them off.  This means that you will have more
free CPU resources to begin with on linux.  Even if a program uses the
same actual amount of resources, it is a smaller fraction of the free
resources.

  I assume that CFD == Computational Fluid Dynamics, i.e. heavy-duty
number-crunching.  Do you have the source code for your program?  If so,
did you "cat /proc/cpuinfo" and use any relavant flags in the compile?
Assumimg you're using GCC Fortran, I'm talking about stuff like mmx,
sse, sse2, etc, and don't forget -O2.  But don't even *THINK* about -O3.

  I switched to Gentoo linux some months ago because it allows me to
optimize all compiled programs to get the most out of my 1999 Dell
Dimension XPS T450.  Yes folks, a 450 mhz PIII with 128 megs of RAM.
The only place where it's showing its age is streaming video.

  The real comparison you should be making is how long it takes to do a
big job under Windows versus the same job under linux.  G77 is the
neglected stepchild of the GCC compilers.  The situation is supposed to
be improving in version 4 of GCC, with G95 (yes, Fortran 95) being
available.  GCC 4.0 should still be considered beta today.  I would
wait for at least a couple of updates before using it for production
work.  This applies to any point-zero release, not just GCC 4.0.

  It would take a bit of analysis to decide where your bottleneck is.
If it's CPU bound, a faster CPU would help.  If it's disk access, get
more memory to cut down on swapping and consider moving temp files to
/dev/shm to reduce disk access.

-- 
Walter Dnes <waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org>
An infinite number of monkeys pounding away on keyboards will
eventually produce a report showing that Windows is more secure,
and has a lower TCO, than linux.
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list