Speed and functionality improvements for 'hbond' command #485

Merged
merged 57 commits into from Apr 19, 2017

Conversation

Projects
None yet
2 participants
Contributor

drroe commented Apr 18, 2017

This PR improves the single-threaded speed of hbond (particularly for solute-solvent hydrogen bonds), adds OpenMP support, fixes some minor bugs, and introduces several new options. This largely (maybe even completely) addresses #392.

The solute-solute hydrogen bond calculation speed has been improved by ~1.3x, and the solute-solvent calculation speed improved by > 3x. The single-threaded speed enhancement comes largely from refactoring the donor/acceptor loops. Previously there were a lot of duplicated distance calculations, particularly when it came to solute-solvent hydrogen bonds. Hints are now properly used in all maps which improves the find/insertion speed. OpenMP allows for even further speedup (have gotten 7.3x for 4 threads in a real-world test).

Solute-solvent bridges within the same molecule are now properly ignored when nointramol is specified. Bridging interactions can now be tracked by solute atom, which allows better resolution when determining solute-solvent bridges; this is activated by the new bridgebyatom keyword (a test has been added for this). The sorting of bridges has also been made more stable. The code has been re-written to make it easy to add bridge time series data in the future.

Results will now be consistent for solute-solute hydrogen bonds in parallel (MPI and OpenMP) due to the more robust way solute-solute indices are calculated (no longer dependent on loop order). Also, uuseries and uvseries should now work properly in parallel. More detailed timing info can be turned on with the TIMER compiler define.

This PR also introduces the sort keyword for writing data files; this will ensure that data sets are sorted before being written out which allows consistent results between parallel and non-parallel versions of the code.

Version numbers have been incremented. We are now different from the official AT17 release.

drroe added some commits Apr 11, 2017

@drroe drroe DRR - Cpptraj: Add hbond timing info dea5d06
@drroe drroe DRR - Cpptraj: Test new hydrogen bond action that arranges things by …
…site to avoid doubled calculation and hopefully make parallelization simpler.
4d65a83
@drroe drroe DRR - Cpptraj: Add test hbond2 action df323da
@drroe drroe DRR - Cpptraj: Finish initial solute-solute hbond calculation. Seems …
…to be decent speedup so far but requires much more testing.
35705f9
@drroe drroe DRR - Cpptraj: Ensure donor-only sites will be calculated. 4526299
@drroe drroe DRR - Cpptraj: Add print code. MPI code added too but not yet working. 78f12eb
@drroe drroe DRR - Cpptraj: Ensure UU hydrogen bonds in map are truely unique by u…
…sing donor H atom - acceptor atom indices as key.
023e553
@drroe drroe DRR - Cpptraj: Try to improve insertion speed into hbond map 3005b65
@drroe drroe DRR - Cpptraj: Add solvent Hbond calc. Speedup in initial testing is …
…about 3.4x so far.
2a613e9
@drroe drroe DRR - Cpptraj: HBmapType to UUmapType f91a993
@drroe drroe DRR - Cpptraj: Ensure solvent is ignored when solute donor or accepto…
…r mask not explicitly specified.
f12ebf2
@drroe drroe DRR - Cpptraj: Recognize ions 902943e
@drroe drroe DRR - Cpptraj: Add solute/solvent hydrogen and ion count 2248a30
@drroe drroe DRR - Cpptraj: Add bridging calc 86e1b0f
@drroe drroe DRR - Cpptraj: Properly init some variables. Fix spacing. 3932a7a
@drroe drroe DRR - Cpptraj: Remove unused class variable. cde9c40
@drroe drroe DRR - Cpptraj: Add nointramol functionality. Slows down the code a li…
…ttle since it introduces an if statement in some inner loops but is still faster than original.
34c36b2
@drroe drroe DRR - Cpptraj: Start fixing the MPI consolidation 256bb2f
@drroe drroe DRR - Cpptraj: Add sort option for data file write. This allows compa…
…rison between series data of the old and new versions of the hbond code since the order in which hbonds are searched for is slightly different
75cf546
@drroe drroe DRR - Cpptraj: Hide some debug info b5250ce
@drroe drroe DRR - Cpptraj: Send solvent hbond data with solute hbonds. Properly f…
…inish off time series in parallel.
88d886c
@drroe drroe DRR - Cpptraj: Remove obsolete code. Ensure UU/UV time series data pr…
…operly added to file if specified during MPI
3028de8
@drroe drroe DRR - Cpptraj: OpenMP-parallelize solute hbonds. OK speedup for now (…
…~40% at 4 threads).
34bbe56
@drroe drroe DRR - Cpptraj: Properly handle nointramol variable in openmp 9e90a6f
@drroe drroe DRR - Cpptraj: Create AddUV function a59ea34
@drroe drroe DRR - Cpptraj: Openmp parallelize the UV calc 484dae0
@drroe drroe DRR - Cpptraj: Simplify code a bit by using the numHB variable as myt…
…hread under openmp; can calculate numHB from the thread arrays
0dd6010
@drroe drroe DRR - Cpptraj: Remove old code 96b7fb8
@drroe drroe DRR - Cpptraj: Add specified solute mask tests. 83ef1cb
@drroe drroe DRR - Cpptraj: Add no angle cut test 645cc24
@drroe drroe DRR - Cpptraj: Still calc angle even when cutoff is -1 so the average…
… is still reported.
f31b325
@drroe drroe DRR - Cpptraj: Add bridge class - not yet used. Will eventually be ne…
…eded for tracking bridge time series.
32a345c
@drroe drroe DRR - Cpptraj: When 'nointramol', ignore solvent-solute bridges that …
…bridge residues belonging to a single solute molecule. Partially addresses #392.
6763a66
@drroe drroe DRR - Cpptraj: Add missing test file. 0e017fd
@drroe drroe DRR - Cpptraj: Make use of new bridge class 45afa0b
@drroe drroe DRR - Cpptraj: Fix MPI compilation ffa6609
@drroe drroe DRR - Cpptraj: For backwards compatibility store solute donor H/accep…
…tor indices for determining the data set index. This has the added bonus of having these be consistent for OpenMP calcs.
271d5c8
@drroe drroe DRR - Cpptraj: MPI data set creation use UU_Set_Idx 094c2e2
@drroe drroe DRR - Cpptraj: Data set ordering for hbond UU series data can now be …
…made consistent for parallel runs
ce65438
@drroe drroe DRR - Cpptraj: Add save files for new test 678906c
@drroe drroe DRR - Cpptraj: Use typedef d4def22
@drroe drroe DRR - Cpptraj: Consolidate UU series set creation. f937d64
@drroe drroe DRR - Cpptraj: Fix variable naming to better reflect what is actually…
… stored.
7861999
@drroe drroe DRR - Cpptraj: Start adding bridgebyatom option 968c1ff
@drroe drroe DRR - Cpptraj: Fix up output formatting. 10c440a
@drroe drroe DRR - Cpptraj: Finish bridgebyatom option. 5ed6b99
@drroe drroe DRR - Cpptraj: Add but do not yet enable the bridge nointramol test 401baaf
@drroe drroe DRR - Cpptraj: Version bump. New hbond functionality is different fro…
…m AmberTools release.
765761f
@drroe drroe DRR - Cpptraj: Remove old hbond code. 3d8b2f6
@drroe drroe DRR - Cpptraj: Enable tests for new hbond code. 901bb1d
@drroe drroe DRR - Cpptraj: Fix memory estimation. 49ac0a0
@drroe drroe DRR - Cpptraj: Fix up code docs. e65e8ae
@drroe drroe DRR - Cpptraj: Split nointramol functionality into two loops again; r…
…esults in noticable speedup for UU hbond calc
ac011ed
@drroe drroe DRR - Cpptraj: Hide timing info behind ifdef 98f5100
@drroe drroe DRR - Cpptraj: Improve stability of bridge sort by comparing residues…
…/atoms when # frames equal.
dc211af

drroe self-assigned this Apr 18, 2017

drroe added some commits Apr 18, 2017

@drroe drroe Merge branch 'master' into hbond_improve_speed 9f3758d
@drroe drroe DRR - Cpptraj: Properly initialize class variable in constructors.
81236bd
Contributor

drroe commented Apr 18, 2017

Travis seems slow today...

Contributor

hainm commented Apr 18, 2017 edited

@drroe: Because of this: https://travis-ci.org/Amber-MD/ambertools-ci
I let that repo watch Amber new commits (every hour), so it will takes CPUs from cpptraj (in the same github organization).

May be I will change to every 6 hours.

Contributor

hainm commented Apr 18, 2017 edited

Done. only run nightly build for now since we just release AT.

@drroe drroe merged commit d30e061 into Amber-MD:master Apr 19, 2017

3 checks passed

Jenkins buildbot
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

drroe deleted the drroe:hbond_improve_speed branch Apr 19, 2017

Contributor

drroe commented Apr 19, 2017

Cool, thanks for the info Hai. Everything is passed now so no worries.

drroe referenced this pull request in Amber-MD/pytraj Apr 19, 2017

Merged

Fix 'hbond' command #1372

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment