From 707c94130f8ceb909889c24a51f46c5db1bbb28d Mon Sep 17 00:00:00 2001 From: Joe Jordan Date: Tue, 16 Mar 2021 11:21:10 +0000 Subject: [PATCH] Remove conditional assignemnt of cell sizes from domdec partition The variable cellsizesWithDlb is always initiallized since it is a std::vector, so there is no reason to set it to nullptr in domdec/partition. --- src/gromacs/domdec/partition.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/gromacs/domdec/partition.cpp b/src/gromacs/domdec/partition.cpp index c6a40d3c7b..cbf2ff5c30 100644 --- a/src/gromacs/domdec/partition.cpp +++ b/src/gromacs/domdec/partition.cpp @@ -821,17 +821,19 @@ static void get_load_distribution(gmx_domdec_t* dd, gmx_wallcycle_t wcycle) comm->load[0].pme = comm->cycl[ddCyclPME]; } + // Either we have DLB off, or we have it on and the array is large enough + GMX_ASSERT(!isDlbOn(dd->comm) || static_cast(dd->comm->cellsizesWithDlb.size()) == dd->ndim, + "DLB cell sizes data not set up properly "); for (int d = dd->ndim - 1; d >= 0; d--) { - const DDCellsizesWithDlb* cellsizes = (isDlbOn(dd->comm) ? &comm->cellsizesWithDlb[d] : nullptr); - const int dim = dd->dim[d]; + const int dim = dd->dim[d]; /* Check if we participate in the communication in this dimension */ if (d == dd->ndim - 1 || (dd->ci[dd->dim[d + 1]] == 0 && dd->ci[dd->dim[dd->ndim - 1]] == 0)) { load = &comm->load[d]; if (isDlbOn(dd->comm)) { - cell_frac = cellsizes->fracUpper - cellsizes->fracLower; + cell_frac = comm->cellsizesWithDlb[d].fracUpper - comm->cellsizesWithDlb[d].fracLower; } int pos = 0; if (d == dd->ndim - 1) @@ -844,8 +846,8 @@ static void get_load_distribution(gmx_domdec_t* dd, gmx_wallcycle_t wcycle) sbuf[pos++] = cell_frac; if (d > 0) { - sbuf[pos++] = cellsizes->fracLowerMax; - sbuf[pos++] = cellsizes->fracUpperMin; + sbuf[pos++] = comm->cellsizesWithDlb[d].fracLowerMax; + sbuf[pos++] = comm->cellsizesWithDlb[d].fracUpperMin; } } if (bSepPME) @@ -865,8 +867,8 @@ static void get_load_distribution(gmx_domdec_t* dd, gmx_wallcycle_t wcycle) sbuf[pos++] = comm->load[d + 1].flags; if (d > 0) { - sbuf[pos++] = cellsizes->fracLowerMax; - sbuf[pos++] = cellsizes->fracUpperMin; + sbuf[pos++] = comm->cellsizesWithDlb[d].fracLowerMax; + sbuf[pos++] = comm->cellsizesWithDlb[d].fracUpperMin; } } if (bSepPME) @@ -896,7 +898,7 @@ static void get_load_distribution(gmx_domdec_t* dd, gmx_wallcycle_t wcycle) if (isDlbOn(comm)) { - rowMaster = cellsizes->rowMaster.get(); + rowMaster = comm->cellsizesWithDlb[d].rowMaster.get(); } load->sum = 0; load->max = 0; -- 2.22.0