Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Fortran --> Python (was linux engineer)
- Date: Fri, 08 Jun 2012 14:59:33 +0900
- From: "Stephen J. Turnbull" <stephen@example.com>
- Subject: Re: [tlug] Fortran --> Python (was linux engineer)
- References: <CA+hLB24QCwzJdnUAqb_xgQJuTuERrxy8o8VnRRRXpZNyP45dPw@mail.gmail.com> <20120606145641.d069eb462b8be9a831d855f9@kinali.ch> <20120606182726.5c175889.jep200404@columbus.rr.com> <87k3zk9dcy.fsf@uwakimon.sk.tsukuba.ac.jp> <CAA2hLfE_yS16cNUA3WcvJ7TQ_rhWNH1nwJ+Zbp=Qx+KwTAE9kQ@mail.gmail.com> <20120607065721.GB7452@xray.astro.isas.jaxa.jp> <20120607070623.GA16006@sgenomics.co.uk> <CAFv52OD4vJ1wqPG4Yhrf5R7FLiDdNxxLOtk4PrEEFP5GuHpW5A@mail.gmail.com> <CABHGxq42eQ2oT8MrW0xBO6s9XTxGC7Jq23P4JXgGF7nqwnepEQ@mail.gmail.com> <20120607142713.GB23720@nashi.hw.39mm.net>
Nicolas Limare writes: > I also suppose that FORTRAN array operations like WHERE() > translated very well into vector processor systems such as the NEC > SX machines. I would think so; it was designed to encourage such usage. > I also heard that on NEC machines, the (NEC) compiler could > recognize a matrix multiplication and replace all the code by a > single processor instruction. Of cource, the execution of this > instruction would take some time, but the hardcoded routine is > finely optimized for the architecture, cache, pipeline, etc. Not to mention written in microcode so much faster than stored program. I think that one of the big things about FORTRAN vs. C, though, is that *inside* a module[1], most FORTRAN subroutines are glorified GOTOs, and so extremely fast. Work is done on COMMON blocks, which amount to implicit references to global variables, so no messing with the stack or loading registers to pass parameters as in C. No copying to local variables on the stack. Arrays are easy to reconfigure with different dimensionality, so element-wise operations are done with a single DO loop rather than nested for loops, saving a lot of test-and-loop logic, as well as multiple initializations of inner loop indicies. All of these things are horrible style in C, of course. They're possible, but not taught. I suspect that FORTRAN code and data areas tend to be smaller than in C, with less copying (C copies structs unless passed by pointer or reference) as well, so that there will be better locality (especially if the C program uses malloc, which FORTRAN programs are less likely to do). ISTR that C also has the problem that standard C doesn't (didn't?) have ways for the programmer to access processor flags and exceptions, so you either had to go to assembler for speed or do look-before-you- leap checking in C to have code robust to edge conditions. Bottom line: FORTRAN is designed to encourage efficient numerical coding techniques, and C is not. Footnotes: [1] Of course library APIs have parameters. I doubt that code that passes variables between modules is going to have any advantage in FORTRAN over C.
- Follow-Ups:
- Re: [tlug] Fortran --> Python (was linux engineer)
- From: Jim Breen
- References:
- [tlug] linux engineer
- From: S Gibson
- Re: [tlug] linux engineer
- From: Attila Kinali
- [tlug] Fortran --> Python (was linux engineer)
- From: jep200404
- [tlug] Fortran --> Python (was linux engineer)
- From: Stephen J. Turnbull
- Re: [tlug] Fortran --> Python (was linux engineer)
- From: jrjohansson@example.com
- Re: [tlug] Fortran --> Python (was linux engineer)
- From: BALUTA Chris
- Re: [tlug] Fortran --> Python (was linux engineer)
- From: Nava Whiteford
- Re: [tlug] Fortran --> Python (was linux engineer)
- From: Josh Glover
- Re: [tlug] Fortran --> Python (was linux engineer)
- From: Jim Breen
- Re: [tlug] Fortran --> Python (was linux engineer)
- From: Nicolas Limare
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Fortran --> Python (was linux engineer)
- Next by Date: [tlug] Touchpad stylus [was: Ubuntu Laptop Assistance ...]
- Previous by thread: Re: [tlug] Fortran --> Python (was linux engineer)
- Next by thread: Re: [tlug] Fortran --> Python (was linux engineer)
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links