Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Programming Technology IT

Goto Leads to Faster Code 462

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?
This discussion has been archived. No new comments can be posted.

Goto Leads to Faster Code

Comments Filter:
  • by trudyscousin ( 258684 ) * on Monday November 28, 2005 @10:04AM (#14128852)
    I'd always been told that use of Goto led to a case of the BLAS in my code!
  • by trezor ( 555230 ) on Monday November 28, 2005 @10:04AM (#14128862) Homepage

    Ever get the feeling someone wrote an article merely for the pun?

    Good thing the headline didn't contribute to that at all.

  • by virtigex ( 323685 ) on Monday November 28, 2005 @10:06AM (#14128881)
    Although he also writes fast code, Mr. Bluescreen was criticised for the poor stability of his code.
  • by alta ( 1263 ) on Monday November 28, 2005 @10:07AM (#14128899) Homepage Journal
    It was CIS 150, C++ was the language of the day (pascal before, java after.) I was taking an exam that was all coding. I remember extensive use of GOTO from my commodore days, so I used one in a test (the objective was to code something with as few lines as possible)

    I had the shortest working code in the class but the arse hole teacher failed me for it. Said something like "we don't teach goto for a reason. Yeah, it's in the book, but don't ever use it!"

    Jerk. I should post his phone number on slashdot ;)
    • "Don't use goto" is sort of and absolute/godly moral. It's good for those that can't think and decide for themselves. People that can think and decide for themselves know that there are no absoltue morals and occasionally decide to use a goto, when it's appropriate for their use.

      While I can understand why structrured programming was introduced, I still think it is sort of funny to use like a dozen syntactical constructions, that all can have their own quirks, for flow control, while all those things are do
    • by CastrTroy ( 595695 ) on Monday November 28, 2005 @10:28AM (#14129137)
      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.
    • Yeah, that is BS! Especially when you have Donald Knuth, Brian Kernighan and Ken Thompson on record in defense of goto when it's warranted. References: Knuth's "Structured Programming with GOTO" [snu.ac.kr] (link appears dead), Kernighan [lysator.liu.se], and Ken Thompson: "If you want to go somewhere, goto is the best way to get there."

      And then there was the famous "'GOTO Considered Harmful' Considered Harmful" by Frank Rubin, and a a decent section in Steve McConnell's Code Complete [stevemcconnell.com] that takes an even-handed view.

      Anyway, swingi
    • Maintainability. Go to type statements can make code ugly and unmaintainable fast (not that not using them insures maintainable code, coding styles and best practices are needed).

      The entire point about production code is that it will be used by some else and maintained by someone else. Maintaining code can be much more expensive than initial development. Anything that reduces maintenence costs usually takes precedence over performance, annoyance of the initial programmer(s) and cpu time.

      High end customized
  • by Derang() ( 318404 ) * on Monday November 28, 2005 @10:08AM (#14128909)
    ...To see who actually reads the article.

    Judging from the replies...not many people ;)
  • by FooAtWFU ( 699187 ) on Monday November 28, 2005 @10:08AM (#14128915) Homepage
    GOTO Statement considered harmful [acm.org].

    Seriously, though, how does a guy end up with a name like this in computer programming? It sounds made-up! Then again, I've heard some very, very odd names...

    • Seriously, though, how does a guy end up with a name like this in computer programming?

      He doesn't happen to be a hovering black sphere, does he?
  • by LoyalOpposition ( 168041 ) on Monday November 28, 2005 @10:11AM (#14128937)
    Goto Considered Helpful?

    -Loyal
    • Yeah, he's the go-to-guy for code optimization.
    • Computed goto (Score:5, Interesting)

      by apankrat ( 314147 ) on Monday November 28, 2005 @01:32PM (#14130858) Homepage
      Not as helpful as computed goto

      Seriously. Computed goto is very useful for low-level
      optimizations in things like high-throughput ethernet
      drivers and such. It basically eliminates conditional
      checks in cases where the condition stays the same
      for a particular set of data. So instead of
      if (context->condition)
            foo(context);
      else
            bar(context);
      one would have
      /* one-time initialization */
      if (context->condition)
            context->jmp = &_foo;
      else
            context->jmp = &_bar;
       
      ..
       
      goto *context->jmp;
       
      for (;;)
      {
      _foo: foo(context); break;
      _bar: bar(context); break;
      }
      If the second part is executed in a loop, the savings of
      not making an IF comparison accumulate fairly quickly.
      • Re:Computed goto (Score:4, Insightful)

        by ChadN ( 21033 ) on Monday November 28, 2005 @07:45PM (#14134107)
        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.
  • by tverbeek ( 457094 ) on Monday November 28, 2005 @10:13AM (#14128958) Homepage
    This guy is clearly considered harmful.
  • DEC Math Library (Score:5, Interesting)

    by boa13 ( 548222 ) on Monday November 28, 2005 @10:13AM (#14128969) Homepage Journal
    DEC had an ultra-optimized math library (calculations on arrays, Fourier transforms, etc.), improved over decades by generations of PhDs. There were different versions of the routines for the different generations of CPUs, for the different cache sizes of a same model, maybe even for various speeds of RAM. Needless to say, the simple fact of linking against that library instead of the standard one improved the speed of math intensive code by a good 10 to 20 percent (those numbers out of my fuzzy memory, but that far from insignificant).

    Add to that compilers that were producing top-notch machine language for the target architecture (producing images that ran twice as fast as what gcc gave you at best), CPUs that were spanking the rest of the world as far as floating-point performance was concerned, and you can understand why the scientific community has kept using Alphas for so long.
  • by Prince Vegeta SSJ4 ( 718736 ) on Monday November 28, 2005 @10:15AM (#14128997)
    10 Print "oh Mr. K. GOTO" 20 I=I+1 30 If I 5 Print "Domo" Else 50 40 GOTO 20 50 Print "I'm Kilroy! Kilroy! Kilroy! Kilroy!"
  • by Bananatree3 ( 872975 ) * on Monday November 28, 2005 @10:22AM (#14129057)
    He is your goto-guy :)
  • tell them that if they want the fastest they should still turn to Mr. Goto.

    Obviously he's the GoTo Guy.

  • by sammy baby ( 14909 ) on Monday November 28, 2005 @10:28AM (#14129138) Journal
    Hey kids! Your uncle Sammy here, with a fun rainy-day Slashdot activity for you!

    First: take an article which revolves around a pun, just like this one, to deliver a message which has a different meaning than the headline would suggest.

    Next: Pick a comment-karma threshold. Two or three ought to do it!

    Last: Count how many of the people at that level have completely missed the point of the article: specifically, that the "Goto" in the writeup is not a GOTO statement, but rather the name of a programmer named Kazushige Goto; that this particular distinction is supposed to be considered a bit of ironic humor; and, that this is, in fact, the reason that Hemos posted it "from the we're-punny-this-morning dept."

    Hours of fun for everyone!
  • by tehanu ( 682528 ) on Monday November 28, 2005 @10:32AM (#14129187)
    A lot of people complain about people never reading the actual articles before they comment, but it seems worse than that. People don't even bother reading the blurbs.

    I wonder where the slashdot effect comes from then?
  • Pah! (Score:3, Informative)

    by BJH ( 11355 ) on Monday November 28, 2005 @10:34AM (#14129200)
    Anybody who criticizes Goto Kazushige's Free Software credentials - he created a Linux/Alpha distribution called Stataboware, which among other things included an early version of his hand-tuned math library back in 1999 [lwn.net] (it's now defunct, unfortunately).
  • 10 Goto FirstPost
    ^C^C^C^C^C^C^C^C
  • by Riktov ( 632 ) on Monday November 28, 2005 @10:35AM (#14129216) Journal
    From the article:
    "Robert A. van de Geijin, a computer scientist who works with Mr. Goto at the Texas Center,..."

    All right, a Japanese programmer named Goto, working with a non-Japanese guy name Geijin. That's too much.

  • by jejones ( 115979 ) on Monday November 28, 2005 @10:43AM (#14129281) Journal
    After all, it was Donald Knuth himself who, in "Structured Programming with goto Statements" (Computing Surveys, sometime in 1974), wrote "At the [year] IFIPS Conference, I was introduced to Dr. Eiichi Goto, who cheerfully complained that he was always being eliminated."

    (Apologies for errors, as my issues of CS are in storage and I'm doing this from memory.)
  • for the pun? (yes) (Score:3, Informative)

    by sita ( 71217 ) on Monday November 28, 2005 @10:53AM (#14129365)
    Ever get the feeling someone wrote an article merely for the pun?

    There's of course the famous Alpher-Bethe-Gamow paper: http://en.wikipedia.org/wiki/Alpher-Bethe-Gamow_pa per [wikipedia.org]
  • by Linker3000 ( 626634 ) on Monday November 28, 2005 @10:57AM (#14129388) Journal
    We have given birth to a new acronym: RPFH Read Past the F**king Headline.
  • ...to CPU manufacturers.

    How are they supposed to sell faster chips when he can make code run faster on them?
  • Just to be clear, Linpack is the code that is used as the basis for top500 runs. If you want to get a decent rating, your cluster must be able to run Linpack well. BLAS helps optimize the score the cluster can achieve.

    We use BLAS for most of our Linpack runs, as it is the fastest set of generic libraries for the purpose. And you can ignore the complexity of coding for a P4, when you consider how much fun it is to code for Itanium, and to do it correctly.

  • by poszi ( 698272 ) on Monday November 28, 2005 @11:15AM (#14129554)
    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 [sourceforge.net] is open-source and is a pretty good alternative. It is only a few percent slower than libgoto in most cases.

    • by ufnoise ( 732845 ) on Monday November 28, 2005 @12:53PM (#14130496)
      From the article: Some programmers have suggested that Mr. Goto has not joined the open-source movement because he wants to protect his secrets and strategies from competitors. That is not so, he said recently, noting that the Goto BLAS software is freely available for noncommercial use. And he said he was preparing an open-source version.
  • for more technical info, see his site [utexas.edu] at the Texas Advanced Computing Center [utexas.edu]. pretty pictures and software tool downloads [utexas.edu] even.
  • by brsmith4 ( 567390 ) <brsmith4&gmail,com> on Monday November 28, 2005 @02:02PM (#14131148)
    I can attest to the efficiency of these routines. When I benchmarked a 22 processor Opteron cluster w/ Myrinet, the use of Goto BLAS resulted in a near 20% drop in CPU utilization but yielded a ~2 GFlop gain in performance using HPL (performance was roughly 60 GFlops total. Given more time, I could have probably coaxed more out of Linpack). This compared to ATLAS, the self-tuning BLAS and LAPACK routines that I painstakingly recompiled at least a few dozen times. Generally, ATLAS yields very decent results even compared to some of the "drop-in" Lin-Alg. routines found with most high-end compilers like PGI (ACML, PGI-optimized BLAS/LAPACK/SCALAPACK) but so far, nothing I have tried rivals the performance, in the case of HPL, of Goto's implementation. Great work, man!

Garbage In -- Gospel Out.

Working...