Closed fweik closed 1 year ago
As far as I understand it, this ticket was addressed in the 4.2.0 release. Particle selection is now carried out in a central place and no longer depends on the partCfg
global variable, code duplication in particle observables was removed via particle traits, and weighted sum algorithms were introduced to nullify contributions from virtual sites in derived statistics, e.g. in the center of mass observable. Closing.
In my view, we are not done.
Ideally, teherw sould be three components
Everyghing paricle related should be cast into that form.
The particle observables are done and the other code is already clean and centralized, but with the above framework, more flexibilty eexists.
Evaluation will finalluy be parallel, and the MPI will only appear in the impledmentaion of the reductions.
Please keep this ticket open
--
Dr. Rudolf Weeber
Mühlrain 9
70180 Stuttgart
+49 172 7136893
@.> @.
From: Jean-Noël Grad @.> Sent: Tuesday, August 9, 2022 10:56 AM To: espressomd/espresso @.> Cc: Subscribed @.***> Subject: Re: [espressomd/espresso] Observables: Particle selection and filtering should be independent of observable (#3154)
As far as I understand it, this ticket was addressed in the 4.2.0 release. Particle selection is now carried out in a central place and no longer depends on the partCfg global variable, code duplication in particle observables was removed via particle traits, and weighted sum algorithms were introduced to nullify contributions from virtual sites in derived statistics, e.g. in the center of mass observable. Closing.
— Reply to this email directly, view it on GitHub https://github.com/espressomd/espresso/issues/3154#issuecomment-1209104198 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AADLTKOAJ4QF2QTKUGM3AUTVYIMLDANCNFSM4IVSA5EQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Here is a benchmark for a Lennard-Jones simulation that shows the observables framework is much slower than MPI-IO due to communication overhead, even though observables are RAM-only and MPI-IO write to disk:
A bottleneck for particle-based observables is std::vector<Particle> fetch_particles(std::vector<int> const &ids)
in src/particle_observables/include/particle_observables/observable.hpp
, which communicates the entire particle structure from particle i
from MPI rank j
to MPI rank 0
, then MPI rank 0
has to extract the trait from each particle copy (e.g. the particle force). Instead, we would like each MPI rank to extract the trait from the local particles and consolidate them in a local vector, then communicate that vector to a vector of vectors on MPI rank 0
. In addition, one would need to send an extra vector of particle ids, such that MPI rank 0
knows in which order the data arrived. Then one can re-order the particle data based on the data order and the input pids
list, which isn't necessarily in ascending order. The communication can be achieved via an MPI gather operation using boost::mpi::gather()
.
Here is a MWE that illustrates how particle properties can be gathered and resorted on MPI rank 0.
To allow for the flexibility I described in the comment above, long term, it might be useful to split into separate funciotns
The reduction operations should be shard between observables, where possible. to my unerstanding, there are the following:
etc.
In src/python/espressomd/observables.py, the Observable base class still has _so_creation_policy = "LOCAL", so they only exist on the head node. That will have to be removed as far as I unertand (global is default).
Here is a minimal working example in ESPResSo: jngrad/espresso@c56df25898a8c3df1ab890818ccef1ff46493c56
For particle observables the selection and filtering of the particles should be independent of what is calculated. These are those currently derived from
Obsevables::PidObservable
, and are already a separate class hierarchy. One plan of action could be to change the the signature ofvirtual std::vector<double> Obsevables::PidObservable::evaluate(PartCfg &partCfg) const
tovirtual std::vector<double> Obsevables::PidObservable::evaluate(Utils::Span<const Particle *>) const
, and evaluate the ids in the base class. Further, the actual implementation should potentially be a member and not be derived. This allows e.g. filtering out virtual particles in a central place and reuse the implementation of the observable function with other ways of selecting particles.