[AMBER-Developers] pmemd cuda MPI nmropt crashes

From: Scott Brozell <sbrozell.rci.rutgers.edu>
Date: Fri, 9 Nov 2012 05:34:36 -0500

Hi,

I second the motion for code reviews especially if conducted collegially.
Such code reviews have not only quality control but also pedagogical aspects.

Consider this case where the bugs were due to uninitialized pointers.
A golden rule of programming is not to reinvent the wheel.
(A corollary of this is my golden rule of style - follow the existing style.)
An application of the golden rule when adding new members to a data structure
is to determine where and how existing members are used.

So when pbNMRDistanceK4 was added to pmemd cuda, one could have grepped for
pbNMRDistanceR1R2 and found
./gputypes.cpp:702:pbNMRDistanceR1R2(NULL),
which could have led to understanding the need for initialization.

This golden rule application works in reverse. Starting from the stack trace
pmemd.cuda_DPDP.M 000000000054B607 gpu_nmr_setup_ 1575 gpu.cpp
1575: delete gpu->pbNMRDistanceK4;
and grepping for pbNMRDistanceK4 and then for pbNMRDistanceR1R2 led to
the diagnosis of nine uninitialized pointers.

scott


_______________________________________________
AMBER-Developers mailing list
AMBER-Developers.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber-developers
Received on Fri Nov 09 2012 - 03:00:03 PST
Custom Search