Miscellaneous
^^^^^^^^^^^^^
+Removed performance loss in the mdrun domain decomposition
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+With 16 or more so-called PP MPI ranks, the domain decomposition
+repartitioning could incur large performance overheads due to a sub-optimally
+sized hash table. This has now been fixed.
+
+:issue:`4054`
*
* Copyright (c) 2006,2007,2008,2009,2010 by the GROMACS development team.
* Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
- * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
if (dd->constraint_comm)
{
- dc->ga2la->clear();
+ dc->ga2la->clearAndResizeHashTable();
}
}
*
* Copyright (c) 2006,2007,2008,2009,2010 by the GROMACS development team.
* Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
- * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{
if (dd->vsite_comm)
{
- dd->ga2la_vsite->clear();
+ dd->ga2la_vsite->clearAndResizeHashTable();
}
}
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2010,2014,2015,2017,2018 by the GROMACS development team.
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
}
- //! Clear all the entries in the list.
- void clear()
+ /*! \brief Clear all the entries in the list.
+ *
+ * \param[in] resizeHashTable When true the hash table is optimized based on the current number of entries stored
+ */
+ void clear(const bool resizeHashTable)
{
if (usingDirect_)
{
entry.cell = -1;
}
}
+ else if (resizeHashTable)
+ {
+ data_.hashed.clearAndResizeHashTable();
+ }
else
{
data_.hashed.clear();
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
return nullptr;
}
- /*! \brief Clear all the entries in the list
- *
- * Also optimizes the size of the table based on the current
- * number of elements stored.
- */
+ //! Clear all the entries in the list
void clear()
{
- const int oldNumElements = numElements_;
-
for (hashEntry& entry : table_)
{
entry.key = -1;
}
startIndexForSpaceForListEntry_ = bucket_count();
numElements_ = 0;
+ }
+
+ /*! \brief Clear all the entries in the list and resizes the hash table
+ *
+ * Optimizes the size of the hash table based on the current
+ * number of elements stored.
+ */
+ void clearAndResizeHashTable()
+ {
+ const int oldNumElements = numElements_;
+
+ clear();
/* Resize the hash table when the occupation is far from optimal.
* Do not resize with 0 elements to avoid minimal size when clear()
if (!keepLocalAtomIndices)
{
/* Clear the whole list without the overhead of searching */
- ga2la.clear();
+ ga2la.clear(true);
}
else
{
state_change_natoms(state_local, comm->atomRanges.numHomeAtoms());
/* Rebuild all the indices */
- dd->ga2la->clear();
+ dd->ga2la->clear(false);
ncgindex_set = 0;
wallcycle_sub_stop(wcycle, ewcsDD_GRID);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
EXPECT_LT(map.bucket_count(), 128);
// Check that the table size is double #elements after clear()
- map.clear();
+ map.clearAndResizeHashTable();
EXPECT_EQ(map.bucket_count(), 128);
// Check that calling clear() a second time does not resize
- map.clear();
+ map.clearAndResizeHashTable();
EXPECT_EQ(map.bucket_count(), 128);
map.insert(2, 'b');
EXPECT_EQ(map.bucket_count(), 128);
// Check that calling clear with 1 elements sizes down
- map.clear();
+ map.clearAndResizeHashTable();
EXPECT_LT(map.bucket_count(), 128);
}
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016,2017 The GROMACS development team.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
cogIndices_.clear();
cogs_.clear();
numAtomsPerCog_.clear();
- globalToLocalMap_.clear();
+ globalToLocalMap_.clearAndResizeHashTable();
}
} // namespace gmx