From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,478505766f6f7124 X-Google-Attributes: gidf7344,public X-Google-Thread: 10f8a1,478505766f6f7124 X-Google-Attributes: gid10f8a1,public X-Google-Thread: f6134,478505766f6f7124 X-Google-Attributes: gidf6134,public X-Google-Thread: 1164f8,478505766f6f7124 X-Google-Attributes: gid1164f8,public X-Google-Thread: 110292,478505766f6f7124 X-Google-Attributes: gid110292,public X-Google-Thread: 102b75,478505766f6f7124 X-Google-Attributes: gid102b75,public X-Google-Thread: f86d6,478505766f6f7124 X-Google-Attributes: gidf86d6,public X-Google-Thread: fee84,478505766f6f7124 X-Google-Attributes: gidfee84,public From: ttk@for_mail_remove_this_and_fruit.larva.apple.shinma.org (TTK Ciar) Subject: Optimizing development code Date: 1999/12/30 Message-ID: <84eg9s$c1k$1@sparky.wolfe.net>#1/1 X-Deja-AN: 566349414 References: <3869DCB3.F796D15C@uk.sun.com> <84d91a$dkv$1@nntp8.atl.mindspring.net> <386A809C.6CEB88A4@austin.rr.com> Organization: Subtle, but there Newsgroups: comp.os.vms,comp.sys.dec,vmsnet.alpha,comp.org.decus,comp.arch,comp.sys.intel,comp.unix.osf.osf1,vmsnet.sysmgt In article <386A809C.6CEB88A4@austin.rr.com>, John wrote: > > >Robert Groover wrote: >> >> One point I wonder about is development of new modelling tools? >> >> Suppose I want to do a new algorithm or a new application - >> for a given cost per flop, isn't it much easier to run prototype software >> on a machine which lets the user postpone the problems of optimal >> parallellizing? >> If so, then the availability of fast apparently-single-threaded machines >> will always a have a role to play in supporting software R&D. > >It is certainly friendlier to develop prototype software on the fastest >uniprocessor possible, because of the data dependence in the edit-compile- >test-debug chain. In interviews a few years ago, most of the people >still using the Cray vector machines at the national supercomputing centers >named this as a key reason for their continued use of those systems. My >contacts at certain spooky agencies have said the same thing. > >Parallelization is very often a waste of time, so it is not >unreasonable to delay it until it you get to the point of having >a production code with lots of demand for computation. I agree to a point, but I'm more bullish about parallelization than that. Dual-processor PC systems are fairly inexpensive and getting cheaper all the time. Many corporations have multi-processor Solaris systems to run applications on. If performance is an issue and you think it at all likely that your code might have the chance to run on a multiprocessor box, it is usually a good idea to write it as a multithreaded application to begin with. It can be quite difficult to add effective multithreading after the fact. For some applications I take the idea one step further and write them as multiple processes. This makes the application trivially able to be distributed across multiple systems on a network without needing to be rewritten. If an application isn't worth writing coarse-grained parallism into, though, then it's not worth optimizing it for high ILP either. C code tends to generate lots and lots of unnecessary memory accesses, so worrying about multi-issue while writing C is a complete waste of time. Optimizing the inner loop of an algorithm by rewriting it in assembly code is *usually* a waste of time, but can make sense in some contexts; if it will be running on a specific generation of a specific processor for a long time, then it may be worthwhile, but if you have the freedom to recompile your application every time a new generation of processor rolls out then you're better off sticking with C. An algorithm written in assembly, optimized for an i486 will run faster on an i486 than C code compiled by a compiler which optimizes for an i486, but that same i486-optimized assembly code will generally run much more slowly on an i686 than the equivalent C code compiled by a compiler which optimizes for the i686. And of course, *developing* a new algorithm in assembly is completely insane. The design of an algorithm should always focus on code clarity. The first practical implementation of that algorithm should begin only after the design is complete, and it is then that you can start thinking about optimizations. The design code can also be used to measure the correctness of the optimized code. -- TTK