From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <36DEF56C.2965F61D@frankfurt.netsurf.de> Date: Thu, 04 Mar 1999 22:04:44 +0100 From: Joachim Wesner Subject: Re: Force calculation with neighbourlist In-Reply-To: <36DEE27D.C293552A@theophys.kth.se> Erik Lindahl wrote: > > Hi, > > I said the other day that I'd share a piece of code with you - > I'd be thrilled if you could come up with any ideas to speed it up :-) > > The routine below is an inner loop in a molecular dynamics program. > This code is called once for each atom every timestep. A typical > system might contain 30000 atoms and each particle has a couple of > hundred of the others as neighbours. > (But if A is a neigbour of B, B is not one of A) > The routine uses a table-driven inverse square root routine > (more or less the same algorithm as Goto's). One idea might be to > implement the whole routine in assembly to avoid loading/unloading > the table. Or should I store values in an array and call a vectorized > sqrti? > I would DEFINITELY suggest trying to use vectorized sqrti, you HAVE pretty large vectors as it seems (30000) and it' s about 5-7 times faster than. I already can hear the "any cache-trashing is bad" fraction howl when you use so much "local" memory, but I clearly would suggest a try. Maybe you later should try to split the 30000 vectors in smaller parts to feed to sqrtiv ?? This is something the Alpha architecture seems to be lacking compared to the old i860, the latter one had a special pipelined load instruction to use for vectorized routines, that would not trash (i.e. would bypass instead) L1 cache contents to avoid wiping out the cache when using large vectors. Joachim