Re: gfortran, g95, and dual-core



FX wrote:
Can gfortran or g95 gain anything from dual- or multi-core processors
in either speed of compilation or speed of execution?

Speed of compilation: if you compile single source files, there probably
isn't anything to gain. If your code has multiple source files, it will
depend on your compilation process, but if you use a decently written
makefile, you will gain.

I don't understand how the makefile matters, but I'm using fortran 77 and avoid the complications introduced by modules.

For execution speed, there are two ways to go. The standard way to get
there is to parallelize the code yourself, either with MPI (probably
requires costly and invasive changes, but will work for distributed
memory systems as well as the multicore scenarios), which can work with
any compiler, or OpenMP. OpenMP is less invasive, you can quickly
parallelize a few hot spots in your code in under an hour (make that a
few hours, if it's your first time), but it requires compiler support,
which gfortran has but g95 hasn't.

That offers food for thought. My slow programs are either Monte Carlo calculations or else have as bottleneck the calculation of finite-difference gradients, both of which offer obvious opportunities. On the other hand, I would not make my life more complicated for less than an order-of-magnitude gain, which would require at least 10 processors. Do you think the current dual- and quad-core processors are just the first steps in a sequence, and that mass-market computers will soon become massively parallel?

The other way is to not touch your code at all, and ask your compile rfor
autoparallelization. Gains from this will usually be relatively small,
but you have little to lose. This also requires support from the
compiler, which is not present in g95, and will be present in gfortran
only starting with the next release series (4.3.x). For more information
about autoparallelization, others might know more than what I said above.

1) Will this conflict with any of the debugging options?
2) Will this work with fortran 77 code?

PS: Of course, if your code heavily relies on external libraries, it
could be as simple as using a parallel version of the libraries.


.



Relevant Pages

  • Re: Inline assembler reference
    ... functionality that most of us use is not any faster. ... critical loop of an important calculation, than hand-optimization ... I've always been able to do both better than the compiler and the ... even 10% performance gain is ...
    (microsoft.public.win32.programmer.kernel)
  • Re: C++ threads vs. Ada tasks - surprised
    ... none *functional* gain (there is an obvious gain in readability, ... I can't speak for Ada, but it is clear that a compiler that understands ...
    (comp.lang.ada)
  • Re: Flexible arrays - v confused
    ... Because I like to use automatic error detection tools when I program, ... and that includes using a C++ compiler (which has stricter type ... So in order to gain a few dubious warnings which quite possibly won't ... compiler from spotting what would be a read and potentially dangerous ...
    (comp.lang.c)
  • Re: strange performance behavior of a mathematical method: why?
    ... note that the g method called inside the loop is final and the compiler ... or it looks to be so from the profiling data. ... This is one of the cases where a good Java compiler and JIT-based runtime system should be able to give you the same performance as the one you would achieve with C. ... For example, I see that your code calculates some type of dot product: if your data allows it, you could gain by using Intel's SSE SIMD extensions or AMD's 3DNow. ...
    (comp.lang.java.programmer)
  • Re: cpu type idea
    ... compiler related recently. ... int main ... float a; ... just to parallelize the vectror and tensor operations. ...
    (alt.lang.asm)