Re: [AMBER-Developers] (long-ish) saga about the HAS_10_12 option in sander and pmemd

From: Duke, Robert E Jr <>
Date: Thu, 27 Oct 2011 01:56:49 +0000

Hi Dave,
I didn't take offense - I just wanted to point out that I had my reasons in pmemd to have a fair amount of #ifdef'd code - it was a hard problem at that point to efficiently support so many architectures, and conditional compilation is a fairly traditional way to handle the problem that, as long as you test all versions, has very little impact on the user. At least to my mind, the two "most legitimate" uses of conditional compilation are 1) supporting a variety of different platforms that either require or benefit from different code paths, or 2) supporting debugging options, where the debugging stuff is essentially only intended as a development crutch. Actually implementing different functionality gets too messy, the HAS_10_12 stuff being a good example. There is one issue that I am somewhat sheepish about, and that is the level of complexity in how conditional compilation was used in the pmemd direct routines to support the different architectures efficiently. I basically used some pretty complicated
 stuff to reduce duplication in source files - doing this, as well as using fairly hairy macros of various sorts (fftw comes to mind) is not uncommon, but the resultant code can be a bear to understand. I still have very mixed emotions about this. You don't want to put a bunch of function calls in the middle of heavily executed code, but that often leaves you in a position of doing a fair amount of code duplication, and the duplicated code is of course a real maintenance hazzard. There is duplicated code in pmemd in places, and one has to be careful of that, as well as the complex conditional expansions (I used to conditionally compile all this stuff and look at the expanded source to be sure I was not missing something). Ah, the joys of attempting to do a reasonable job of engineering while getting maximum performance.
- Bob

From: David A Case []
Sent: Wednesday, October 26, 2011 12:46 PM
To: AMBER Developers Mailing List
Subject: Re: [AMBER-Developers] (long-ish) saga about the HAS_10_12 option in sander and pmemd

On Wed, Oct 26, 2011, Duke, Robert E Jr wrote:

> Well, do bear in mind the conditions under which the code was written:
> 1) mandate to absolutely maximize performance, and 2) good branch
> prediction was not uniformly available across all cpu's in use.

Understood -- I'm not trying to complain here -- everyone agrees that the
pmemd code is nicely done, and easier to read and modify (in spite of the
#ifdef's) than sander. And, I'm the kettle calling the pot black, since a
good fraction of the mess in sander is my fault.

But we should still clean up things as much as makes sense.


AMBER-Developers mailing list
AMBER-Developers mailing list
Received on Wed Oct 26 2011 - 19:00:04 PDT
Custom Search