Re: [AMBER-Developers] IEEE_OVERFLOW_FLAG

From: Jason Swails <jason.swails.gmail.com>
Date: Sat, 10 Nov 2018 23:41:10 -0500

On Sat, Nov 10, 2018 at 3:22 PM Kellon Belfon <kellonbelfon.gmail.com>
wrote:

> Hi Ross,
>
> You raised a very good point on the performance hit if we were initializing
> every step.


One thing I'll caution against is premature optimization (a popular quote
is "premature optimization is the root of all evil" -- an exaggeration to
be sure, but there's a lesson there).

Let's say that we're even initializing the force array to 0 every step.
Compare that to, for instance, to *any* component of the force evaluation.
The time spent doing initialization (even every step) I would predict to be
negligible compared to the cost of even just the bond interactions.
Certainly, that cost will be negligible compared to the direct-space
nonbonded interaction (or the reciprocal space component which scales as
O(N logN)).

The cost may be measurable if you were initializing in the inner-loop of
the rate-determining portion of the calculation (you should *always* be
careful what you put there). But if it happens anywhere else it won't
affect the performance scalability.

The point is, initialization is almost *always* a good thing to do. You
should only *not* do it if both of the following are true:

1. You know for a fact it's not necessary (and comments should be added to
explain why this is true).
2. You've actually tested that the initialization adds a measurable
performance penalty.

A lesson I'll pass on -- improved confidence in "correctness" easily trumps
micro-optimizations (certainly if you've found an algorithm with better
scaling characteristics that's worth exploring, but if you're hoping to
shave an extra nanosecond or two off a step that takes microseconds, that
is not time well-spent).

All the best,
Jason

-- 
Jason M. Swails
_______________________________________________
AMBER-Developers mailing list
AMBER-Developers.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber-developers
Received on Sat Nov 10 2018 - 21:00:02 PST
Custom Search