Slashdot Mirror


Goto Leads to Faster Code

pdoubleya writes "There's an article over at the NY Times (registration required) about Kazushige Goto, the author of the Goto Basic Linear Algebra Subroutines (BLAS, see the wiki); his BLAS implementation is used by 4 of the current 11 fastest computers in the world. Goto is known for painstaking effort in hand-optimizing his routines; in one case, "when computer scientists at the University at Buffalo added Goto BLAS to their Pentium-based supercomputer, the calculating power of the system jumped from 1.5 trillion to 2 trillion mathematical operations per second out of a theoretical limit of 3 trillion." To quote Jack Dongarra, from the University of Tennessee, "I tell them that if they want the fastest they should still turn to Mr. Goto."" Ever get the feeling someone wrote an article merely for the pun?

11 of 462 comments (clear)

  1. Re:Psssh. by XXIstCenturyBoy · · Score: 2, Insightful

    I like to see people replying to a post after reading the name subject line and then express an opinion that 1) Everyone knows and no one would argue with and 2) Has pretty much nothing to do with the article beside a easy pun.

  2. Re:This was a test, aimed at slashdot readers... by Virak · · Score: 2, Insightful

    I think you mean the summary. Anyone who read more than a few words into it would've realized they're talking about a person.

  3. Re:goto is obsolete by ciroknight · · Score: 2, Insightful

    Point taken, but in the early days goto still made a lot of sense, but a lot of conventional, old practices have gone the wayside with compilers that are smarter and better optimizing, and with better standardization in languages overall.

    The *first* time I learned C, goto was perfectly acceptible (yay K&R original C material).

    But really, my point is that a computer doesn't see things in the sense of functions; it sees things in the sense of labels (memory addresses), and in a sense, programming using functions is simply another way of getting around labeling a routine.

    --
    "Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is." G.W.Bush
  4. Re:If true... by ciroknight · · Score: 2, Insightful

    The thing is, "Goto" isn't logical.

    Your argument against Goto is even less logical. Goto is a conditional jump, where the condition is always true. It's an if (true) { do; }.

    Our brains have plenty of Goto's hardcoded into them; "repeat" is typically implemented through in a "goto" fashion, but you'll want to ignore that if you're a modern computer. The correct way is to instead unroll the loop and have no jump instruction at all (if you can get around it).

    Sigh. Why don't they teach assembly anymore. It should be a pre-req to learning higher level languages.

    --
    "Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is." G.W.Bush
  5. Re:30%+ Improvement by Surt · · Score: 5, Insightful

    Considering the number of scientists who have been looking at this over a number of years, I think it really is a credit to Goto's work. Optimizing at this level is very challenging work on modern processors.

    --
    "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
  6. Re:I failed a coding test because of this guy by CastrTroy · · Score: 4, Insightful

    Obviously this prof was wrong. If he wanted you to code it in as few lines as possible, then he should have expected everyone's code to be completely unreadable, goto's or not. If he wanted your code to be understandable, then he should have asked to make the code as clear as possible, by using as many lines as you may need.

    --

    Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
  7. Re:30%+ Improvement by roystgnr · · Score: 4, Insightful

    Which is certainly good, but to me says more about the previous implementation than it does about Goto's work.

    Yeah, that previous implementation must have totally sucked. I know all my linear algebra software is written around an assembly language core, hand tuned for each new version of a half dozen processors, and designed from the start to minimize TLB misses instead of just naively trying to fit a dataset into L1 or L2 cache. I don't know why those retards at the universities and national labs were ever using anything else!

    (closing Slashdot, going back to working on my shamefully unoptimized C++ numerics code...)

  8. Well Done Slashdotters by Linker3000 · · Score: 4, Insightful

    We have given birth to a new acronym: RPFH Read Past the F**king Headline.

    --
    AT&ROFLMAO
  9. Libgoto is fast but not open-source by poszi · · Score: 4, Insightful
    Maybe I should not complain because the guy did a great job and his library is available free of charge but I hesitate to use this library because it is closed-source. I benchmarked it and found it fast and started to use it in my scientific codes. I once found a strange problem in a parallel code I was developing. The program crashed for one specific system I was calculating. It was something weird because it worked for many other systems I tested before. I spent a lot of time trying to find the bug in my program when finally I replaced libgoto with standard blas and the problem disapeared. I knew that the crash was when entering blas but I thought it is because I messed with the arrays that are used as parameters. If libgoto were open-source, I would be able to have a version with debugging info compiled and debug the program and the library. I would probably not fix the bug but I would likely figure out more quickly the problem is in the library and not in my code. After I had known the problem is in libgoto, I dowloaded a new version of libgoto and it worked so the bug has been fixed. There is no changelog on libgoto web page so I don't know what was the problem and how it affacted my previous caclulations.

    Atlas is open-source and is a pretty good alternative. It is only a few percent slower than libgoto in most cases.

    --

    Save the bandwidth. Don't use sigs!

  10. Re:I failed a coding test because of this guy by Smidge204 · · Score: 2, Insightful

    You do realise that GOTO command translated to a JMP isntruction, which any compiler produces in abundance anyway, right?

    There is no performance issue at all. The ONLY reason 'goto' could be considered bad is that it becomes easy to write code that is difficult for humans to follow.

    =Smidge=

  11. Re:Computed goto by ChadN · · Score: 3, Insightful

    Yuck! For this example, it'd be much clearer (to me), to simply initialize a function pointer to either foo or bar, and call that in a loop. I'd imagine it is just as fast. Jumping into loops can be clever, but is seriously non-intuitive, IMO.

    --
    "It's overkill, of course. But you can never have too much overkill." - Anonymous Slashdot Coward