||Sorts MPCD particles in memory to improve cache coherency.|
MPCD particle updaters
Updates properties of MPCD particles.
Sorts MPCD particles in memory to improve cache coherency.
Do not create
hoomd.mpcd.update.sortexplicitly in your script. HOOMD creates a sorter by default.
Every period time steps, particles are reordered in memory based on the cell list generated at the current timestep. Sorting can significantly improve performance of all other cell-based steps of the MPCD algorithm. The efficiency of the sort operation obviously depends on the number of particles, and so the period should be tuned to give the maximum performance.
The period should be no smaller than the MPCD collision period, or unnecessary cell list builds will occur.
Essentially all MPCD systems benefit from sorting, and so a sorter is created by default with the MPCD system. To disable it or modify parameters, save the system and access the sorter through it:
s = mpcd.init.read_snapshot(snap) # the sorter is only available after initialization s.sorter.set_period(period=5) s.sorter.disable()
Change the sorting period.
Parameters: period (int) – New period to set.
While the simulation is running, the action of each updater is executed every period time steps. Changing the period does not change the phase set when the analyzer was first created.
tune(start, stop, step, tsteps, quiet=False)¶
Tune the sorting period.
The optimal sorting period from the scanned range.
The optimal sorting period for the MPCD particles is determined from a sequence of short runs. The sorting period is first set to start. The TPS value is determined for a run of length tsteps. This run is repeated 3 times, and the median TPS of the runs is saved. The sorting period is then incremented by step, and the process is repeated until stop is reached. The period giving the fastest TPS is determined, and the sorter period is updated to this value. The results of the scan are also reported as output, and the fastest sorting period is also returned.
A short warmup run is required before calling
tune()in order to ensure the runtime autotuners have found optimal kernel launch parameters.
# warmup run hoomd.run(5000) # tune sorting period sorter.tune(start=5, stop=50, step=5, tsteps=1000)