if (!pme_lb->bSepPMERanks)
{
- if (pme_lb->setup[pme_lb->cur].pmedata == nullptr)
+ /* FIXME:
+ * CPU PME keeps a list of allocated pmedata's, that's why pme_lb->setup[pme_lb->cur].pmedata is not always nullptr.
+ * GPU PME, however, currently needs the gmx_pme_reinit always called on load balancing
+ * (pme_gpu_reinit might be not sufficiently decoupled from gmx_pme_init).
+ * This can lead to a lot of reallocations for PME GPU.
+ * Would be nicer if the allocated grid list was hidden within a single pmedata structure.
+ */
+ if ((pme_lb->setup[pme_lb->cur].pmedata == nullptr) || pme_gpu_task_enabled(pme_lb->setup[pme_lb->cur].pmedata))
{
/* Generate a new PME data structure,
* copying part of the old pointers.
int n_prev;
double cycles_prev;
- assert(pme_lb != NULL);
+ assert(pme_lb != nullptr);
if (!pme_lb->bActive)
{