Skip to content

Speedup verlet list rebuild by copying neighbors into buffers#292

Merged
jkrajniak merged 11 commits intoespressopp:masterfrom
jnvance:speedup_rebuild
Jan 6, 2020
Merged

Speedup verlet list rebuild by copying neighbors into buffers#292
jkrajniak merged 11 commits intoespressopp:masterfrom
jnvance:speedup_rebuild

Conversation

@jnvance
Copy link
Copy Markdown
Member

@jnvance jnvance commented Jan 4, 2020

During each Verlet list rebuild, particle positions of neighboring cells of every cell are first copied into contiguous buffers (c_pos). The buffers are then iterated over to determine the particle pairs that are within cutoff distance. This results in more cache-friendly access since the particle positions are stored contiguously instead of being stored in different memory locations (in the case of particles in std::vector< Cell >) and separated by other particle information. The cost of copying the data initially is amortized by the number of times the buffer is iterated during the cutoff check (equal to the number of particles in the cell).

I've added a test and comparison script that runs a Lennard-Jones simulation (testsuite/verlet_list_buffer/verlet_list_buffer.py). With one process on a Broadwell node of Mogon 2, compiled with gcc 7.3.0 and -O3 optimization, the method results in around 2x speedup for the Resort part of the simulation.

@jkrajniak jkrajniak self-requested a review January 4, 2020 22:21
Comment thread src/VerletList.cpp
Comment thread src/VerletList.cpp Outdated
Comment thread src/VerletList.cpp Outdated
Comment thread src/VerletList.cpp Outdated
Comment thread src/VerletList.cpp Outdated
Comment thread src/VerletList.py Outdated
Comment thread src/VerletList.hpp
@jkrajniak jkrajniak merged commit 10ad9a2 into espressopp:master Jan 6, 2020
@jnvance jnvance deleted the speedup_rebuild branch January 7, 2020 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants