Le mercredi 13 février 2008, Florian Erhardt a écrit : > If anyone knows where I could get SIMPLE docs explaining optimizations > for vector cpus, that would be great.
Some basic advices and links. Read Linux Coding Style, especially section concerning indentation and functions. Draw the flow char of your program, and estimate number of loops and significant I/O. This is incredibly useful (and needs only 5 minutes to do) The basis of optimisation (test against zero is faster, unroll, Single dimension arrays are faster than multi-dimensioned arrays...) http://www.abarnett.demon.co.uk/tutorial.html I would add: * do loops where computation on X(i) does not depend on X(i-1) (or i+1). This is mandatory for vector processing. * loops are small (few lines not 100 lines) so the compiler can understand what happens and do the correct thing. * Move all invariant code outside the loop * Don't believe the compiler can do everything for you (it can if the code is clean because _you_ know what it expects) This one is very clear, but it uses Cray tools http://www.asc.edu/seminars/optimization/opt_intro.html Of course profile your code (gcc -pg, if you uses gcc.) What compiler do you use ? Last, read the compiler documentation, and take notes, at least to have an idea of what kind of optimisation it can(not) do. If after all possible optimisations you reach 30 % of theoretical maximum performance, you can be proud of your code, maybe it impossible to do better. I know there are some crazy optimisation gurus on the list, and hope they will give more links and advices. my 2 cents Alain _______________________________________________ computer-go mailing list [email protected] http://www.computer-go.org/mailman/listinfo/computer-go/
