Change PaddedVector to PaddedHostVector for force CPU buffer
authorArtem Zhmurov <zhmurov@gmail.com>
Mon, 9 Sep 2019 16:44:38 +0000 (18:44 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 12 Sep 2019 15:07:09 +0000 (17:07 +0200)
The difference between PaddedVector and PaddedHostVector is that
in the builds where CUDA is available, cudaMalloc is used instead
of malloc. This enables one to pin the vector for asynchronous
H2D and D2H copies. Other than that and on the CPU-only builds this
change essentially only renames the data type.

Change-Id: I446ef037a8013f666a78762d37ed44e59f9548c2

18 files changed:
src/gromacs/domdec/distribute.cpp
src/gromacs/domdec/distribute.h
src/gromacs/domdec/partition.cpp
src/gromacs/domdec/partition.h
src/gromacs/domdec/redistribute.cpp
src/gromacs/domdec/redistribute.h
src/gromacs/domdec/utility.cpp
src/gromacs/domdec/utility.h
src/gromacs/mdrun/md.cpp
src/gromacs/mdrun/mimic.cpp
src/gromacs/mdrun/minimize.cpp
src/gromacs/mdrun/rerun.cpp
src/gromacs/mdrun/shellfc.cpp
src/gromacs/mdrun/tpi.cpp
src/gromacs/mdtypes/state.h
src/gromacs/modularsimulator/domdechelper.cpp
src/gromacs/modularsimulator/statepropagatordata.cpp
src/gromacs/modularsimulator/statepropagatordata.h

index e0615aba27ae8e2dcfd56e9215ce0ece1da81243..01af1052415d74afd7e756cd4d91ec460fed43ff 100644 (file)
@@ -202,7 +202,7 @@ static void dd_distribute_dfhist(gmx_domdec_t *dd, df_history_t *dfhist)
 
 static void dd_distribute_state(gmx_domdec_t *dd,
                                 const t_state *state, t_state *state_local,
-                                PaddedVector<gmx::RVec> *f)
+                                PaddedHostVector<gmx::RVec> *f)
 {
     int nh = state_local->nhchainlength;
 
@@ -571,13 +571,13 @@ static void distributeAtomGroups(const gmx::MDLogger &mdlog,
     }
 }
 
-void distributeState(const gmx::MDLogger     &mdlog,
-                     gmx_domdec_t            *dd,
-                     const gmx_mtop_t        &mtop,
-                     t_state                 *state_global,
-                     const gmx_ddbox_t       &ddbox,
-                     t_state                 *state_local,
-                     PaddedVector<gmx::RVec> *f)
+void distributeState(const gmx::MDLogger         &mdlog,
+                     gmx_domdec_t                *dd,
+                     const gmx_mtop_t            &mtop,
+                     t_state                     *state_global,
+                     const gmx_ddbox_t           &ddbox,
+                     t_state                     *state_local,
+                     PaddedHostVector<gmx::RVec> *f)
 {
     rvec *xGlobal = (DDMASTER(dd) ? state_global->x.rvec_array() : nullptr);
 
index e57df9f65f259460d94e82e672b90b642b75115a..a5c4668fa53bbdf61f1beb6ede0538392bdae23e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019, 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.
@@ -42,7 +42,7 @@
 #ifndef GMX_DOMDEC_DOMDEC_DISTRIBUTE_H
 #define GMX_DOMDEC_DOMDEC_DISTRIBUTE_H
 
-#include "gromacs/math/paddedvector.h"
+#include "gromacs/gpu_utils/hostallocator.h"
 #include "gromacs/utility/basedefinitions.h"
 
 struct gmx_ddbox_t;
@@ -57,12 +57,12 @@ class MDLogger;
 }
 
 /*! \brief Distributes the state from the master rank to all DD ranks */
-void distributeState(const gmx::MDLogger     &mdlog,
-                     gmx_domdec_t            *dd,
-                     const gmx_mtop_t        &mtop,
-                     t_state                 *state_global,
-                     const gmx_ddbox_t       &ddbox,
-                     t_state                 *state_local,
-                     PaddedVector<gmx::RVec> *f);
+void distributeState(const gmx::MDLogger              &mdlog,
+                     gmx_domdec_t                     *dd,
+                     const gmx_mtop_t                 &mtop,
+                     t_state                          *state_global,
+                     const gmx_ddbox_t                &ddbox,
+                     t_state                          *state_local,
+                     gmx::PaddedHostVector<gmx::RVec> *f);
 
 #endif
index 08462f1b2685618bc49a7456e67ab552c41c899b..3d708665c8989198baadd275cb07232701f91f0d 100644 (file)
@@ -1880,7 +1880,7 @@ static void setup_dd_communication(gmx_domdec_t *dd,
                                    matrix box, gmx_ddbox_t *ddbox,
                                    t_forcerec *fr,
                                    t_state *state,
-                                   PaddedVector<gmx::RVec> *f)
+                                   PaddedHostVector<gmx::RVec> *f)
 {
     int                    dim_ind, dim, dim0, dim1, dim2, dimd, nat_tot;
     int                    nzone, nzone_send, zone, zonei, cg0, cg1;
@@ -2721,28 +2721,28 @@ void print_dd_statistics(const t_commrec *cr, const t_inputrec *ir, FILE *fplog)
     }
 }
 
-// TODO Remove fplog when group scheme and charge groups are gone
-void dd_partition_system(FILE                    *fplog,
-                         const gmx::MDLogger     &mdlog,
-                         int64_t                  step,
-                         const t_commrec         *cr,
-                         gmx_bool                 bMasterState,
-                         int                      nstglobalcomm,
-                         t_state                 *state_global,
-                         const gmx_mtop_t        &top_global,
-                         const t_inputrec        *ir,
-                         gmx::ImdSession         *imdSession,
-                         pull_t                  *pull_work,
-                         t_state                 *state_local,
-                         PaddedVector<gmx::RVec> *f,
-                         gmx::MDAtoms            *mdAtoms,
-                         gmx_localtop_t          *top_local,
-                         t_forcerec              *fr,
-                         gmx_vsite_t             *vsite,
-                         gmx::Constraints        *constr,
-                         t_nrnb                  *nrnb,
-                         gmx_wallcycle           *wcycle,
-                         gmx_bool                 bVerbose)
+//!\brief TODO Remove fplog when group scheme and charge groups are gone
+void dd_partition_system(FILE                        *fplog,
+                         const gmx::MDLogger         &mdlog,
+                         int64_t                      step,
+                         const t_commrec             *cr,
+                         gmx_bool                     bMasterState,
+                         int                          nstglobalcomm,
+                         t_state                     *state_global,
+                         const gmx_mtop_t            &top_global,
+                         const t_inputrec            *ir,
+                         gmx::ImdSession             *imdSession,
+                         pull_t                      *pull_work,
+                         t_state                     *state_local,
+                         PaddedHostVector<gmx::RVec> *f,
+                         gmx::MDAtoms                *mdAtoms,
+                         gmx_localtop_t              *top_local,
+                         t_forcerec                  *fr,
+                         gmx_vsite_t                 *vsite,
+                         gmx::Constraints            *constr,
+                         t_nrnb                      *nrnb,
+                         gmx_wallcycle               *wcycle,
+                         gmx_bool                     bVerbose)
 {
     gmx_domdec_t      *dd;
     gmx_domdec_comm_t *comm;
index dbe641c7987b59f25bfaf4b8203cff7cab87e750..68fd8c2fcb19e57bd8924d65f863f87ff7ef2cb1 100644 (file)
@@ -45,7 +45,7 @@
 #ifndef GMX_DOMDEC_PARTITION_H
 #define GMX_DOMDEC_PARTITION_H
 
-#include "gromacs/math/paddedvector.h"
+#include "gromacs/gpu_utils/hostallocator.h"
 #include "gromacs/math/vectypes.h"
 #include "gromacs/utility/basedefinitions.h"
 #include "gromacs/utility/real.h"
@@ -87,28 +87,50 @@ void print_dd_statistics(const t_commrec *cr, const t_inputrec *ir, FILE *fplog)
  * If bMasterState==TRUE then state_global from the master node is used,
  * else state_local is redistributed between the nodes.
  * When f!=NULL, *f will be reallocated to the size of state_local.
+ *
+ * \param[in] fplog         Pointer to the log file
+ * \param[in] mdlog         MD file logger
+ * \param[in] step          Current step
+ * \param[in] cr            Communication record
+ * \param[in] bMasterState  Is it a master state
+ * \param[in] nstglobalcomm Will globals be computed on this step
+ * \param[in] state_global  Global state
+ * \param[in] top_global    Global topology
+ * \param[in] ir            Input record
+ * \param[in] imdSession    IMD handle
+ * \param[in] pull_work     Pulling data
+ * \param[in] state_local   Local state
+ * \param[in] f             Force buffer
+ * \param[in] mdatoms       MD atoms
+ * \param[in] top_local     Local topology
+ * \param[in] fr            Force record
+ * \param[in] vsite         Virtual sites
+ * \param[in] constr        Constraints
+ * \param[in] nrnb          Cycle counters
+ * \param[in] wcycle        Timers
+ * \param[in] bVerbose      Be verbose
  */
-void dd_partition_system(FILE                    *fplog,
-                         const gmx::MDLogger     &mdlog,
-                         int64_t                  step,
-                         const t_commrec         *cr,
-                         gmx_bool                 bMasterState,
-                         int                      nstglobalcomm,
-                         t_state                 *state_global,
-                         const gmx_mtop_t        &top_global,
-                         const t_inputrec        *ir,
-                         gmx::ImdSession         *imdSession,
-                         pull_t                  *pull_work,
-                         t_state                 *state_local,
-                         PaddedVector<gmx::RVec> *f,
-                         gmx::MDAtoms            *mdatoms,
-                         gmx_localtop_t          *top_local,
-                         t_forcerec              *fr,
-                         gmx_vsite_t             *vsite,
-                         gmx::Constraints        *constr,
-                         t_nrnb                  *nrnb,
-                         gmx_wallcycle           *wcycle,
-                         gmx_bool                 bVerbose);
+void dd_partition_system(FILE                             *fplog,
+                         const gmx::MDLogger              &mdlog,
+                         int64_t                           step,
+                         const t_commrec                  *cr,
+                         gmx_bool                          bMasterState,
+                         int                               nstglobalcomm,
+                         t_state                          *state_global,
+                         const gmx_mtop_t                 &top_global,
+                         const t_inputrec                 *ir,
+                         gmx::ImdSession                  *imdSession,
+                         pull_t                           *pull_work,
+                         t_state                          *state_local,
+                         gmx::PaddedHostVector<gmx::RVec> *f,
+                         gmx::MDAtoms                     *mdatoms,
+                         gmx_localtop_t                   *top_local,
+                         t_forcerec                       *fr,
+                         gmx_vsite_t                      *vsite,
+                         gmx::Constraints                 *constr,
+                         t_nrnb                           *nrnb,
+                         gmx_wallcycle                    *wcycle,
+                         gmx_bool                          bVerbose);
 
 /*! \brief Check whether bonded interactions are missing, if appropriate
  *
index bb73ed56ad47cd41a938fab8eac9e7be785ceeec..f56512a7ed9a5ef3ed7c98509273eb397b70accb 100644 (file)
@@ -548,7 +548,7 @@ applyPbcAndSetMoveFlags(const gmx::UpdateGroupsCog      &updateGroupsCog,
 void dd_redistribute_cg(FILE *fplog, int64_t step,
                         gmx_domdec_t *dd, ivec tric_dir,
                         t_state *state,
-                        PaddedVector<gmx::RVec> *f,
+                        PaddedHostVector<gmx::RVec> *f,
                         t_forcerec *fr,
                         t_nrnb *nrnb,
                         int *ncg_moved)
index 1a129e0ba4bbb4a10b5094276ef5bef832a6473c..64803a346b3481dd5e1dfed66779f894ac8debfd 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019, 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.
@@ -44,7 +44,7 @@
 
 #include <cstdio>
 
-#include "gromacs/math/paddedvector.h"
+#include "gromacs/gpu_utils/hostallocator.h"
 #include "gromacs/utility/basedefinitions.h"
 
 struct gmx_domdec_t;
@@ -53,14 +53,14 @@ struct t_nrnb;
 class t_state;
 
 /*! \brief Redistribute the atoms to their, new, local domains */
-void dd_redistribute_cg(FILE                    *fplog,
-                        int64_t                  step,
-                        gmx_domdec_t            *dd,
-                        ivec                     tric_dir,
-                        t_state                 *state,
-                        PaddedVector<gmx::RVec> *f,
-                        t_forcerec              *fr,
-                        t_nrnb                  *nrnb,
-                        int                     *ncg_moved);
+void dd_redistribute_cg(FILE                             *fplog,
+                        int64_t                           step,
+                        gmx_domdec_t                     *dd,
+                        ivec                              tric_dir,
+                        t_state                          *state,
+                        gmx::PaddedHostVector<gmx::RVec> *f,
+                        t_forcerec                       *fr,
+                        t_nrnb                           *nrnb,
+                        int                              *ncg_moved);
 
 #endif
index 75fd9e49beb41ee22d884089dfc95bb7bec7971f..60ece098a849671f21922276257db487ace97f23 100644 (file)
@@ -101,10 +101,10 @@ void check_screw_box(const matrix box)
         gmx_fatal(FARGS, "pbc=screw with non-zero box_zy is not supported");
     }
 }
-
-void dd_resize_state(t_state                 *state,
-                     PaddedVector<gmx::RVec> *f,
-                     int                      natoms)
+/*! \brief Resize the state and f*/
+void dd_resize_state(t_state                     *state,
+                     PaddedHostVector<gmx::RVec> *f,
+                     int                          natoms)
 {
     if (debug)
     {
@@ -122,10 +122,13 @@ void dd_resize_state(t_state                 *state,
     }
 }
 
-void dd_check_alloc_ncg(t_forcerec              *fr,
-                        t_state                 *state,
-                        PaddedVector<gmx::RVec> *f,
-                        int                      numChargeGroups)
+/*! \brief Enrsure fr, state and f, if != nullptr, can hold numChargeGroups
+ *         atoms for the Verlet scheme and charge groups for the group scheme.
+ */
+void dd_check_alloc_ncg(t_forcerec                  *fr,
+                        t_state                     *state,
+                        PaddedHostVector<gmx::RVec> *f,
+                        int                          numChargeGroups)
 {
     fr->cginfo.resize(numChargeGroups);
 
index db6ba5370138da98263755ec629454b357115bb1..dbab6cbe99595497027eaea86c029d05377aaa53 100644 (file)
@@ -42,7 +42,7 @@
 #ifndef GMX_DOMDEC_DOMDEC_UTILITY_H
 #define GMX_DOMDEC_DOMDEC_UTILITY_H
 
-#include "gromacs/math/paddedvector.h"
+#include "gromacs/gpu_utils/hostallocator.h"
 #include "gromacs/mdtypes/forcerec.h"
 
 #include "domdec_internal.h"
@@ -96,16 +96,27 @@ static inline int dd_load_count(const gmx_domdec_comm_t *comm)
     return (comm->ddSettings.eFlop ? comm->flop_n : comm->cycl_n[ddCyclF]);
 }
 
-/*! \brief Resize the state and f, if !=nullptr, to natoms */
-void dd_resize_state(t_state                 *state,
-                     PaddedVector<gmx::RVec> *f,
-                     int                      natoms);
+/*! \brief Resize the state and f, if !=nullptr, to natoms
+ *
+ * \param[in]  state   Current state
+ * \param[in]  f       The vector of forces to be resized
+ * \param[out] natoms  New number of atoms to accommodate
+ */
+void dd_resize_state(t_state                          *state,
+                     gmx::PaddedHostVector<gmx::RVec> *f,
+                     int                               natoms);
 
-/*! \brief Enrsure fr, state and f, if != nullptr, can hold numChargeGroups atoms for the Verlet scheme and charge groups for the group scheme */
-void dd_check_alloc_ncg(t_forcerec              *fr,
-                        t_state                 *state,
-                        PaddedVector<gmx::RVec> *f,
-                        int                      numChargeGroups);
+/*! \brief Enrsure fr, state and f, if != nullptr, can hold numChargeGroups atoms for the Verlet scheme and charge groups for the group scheme
+ *
+ * \param[in]  fr               Force record
+ * \param[in]  state            Current state
+ * \param[in]  f                The force buffer
+ * \param[out] numChargeGroups  Number of charged groups
+ */
+void dd_check_alloc_ncg(t_forcerec                       *fr,
+                        t_state                          *state,
+                        gmx::PaddedHostVector<gmx::RVec> *f,
+                        int                               numChargeGroups);
 
 /*! \brief Returns a domain-to-domain cutoff distance given an atom-to-atom cutoff */
 static inline real
index c41bb9d4d2fb58fedf0de37cbf9716acc78a8bf1..483bd2750d4dbb66b63d37caaf8bf711b7726a0c 100644 (file)
@@ -158,40 +158,40 @@ void gmx::LegacySimulator::do_md()
     // alias to avoid a large ripple of nearly useless changes.
     // t_inputrec is being replaced by IMdpOptionsProvider, so this
     // will go away eventually.
-    t_inputrec             *ir   = inputrec;
-    int64_t                 step, step_rel;
-    double                  t, t0 = ir->init_t, lam0[efptNR];
-    gmx_bool                bGStatEveryStep, bGStat, bCalcVir, bCalcEnerStep, bCalcEner;
-    gmx_bool                bNS, bNStList, bStopCM,
-                            bFirstStep, bInitStep, bLastStep = FALSE;
-    gmx_bool                bDoDHDL = FALSE, bDoFEP = FALSE, bDoExpanded = FALSE;
-    gmx_bool                do_ene, do_log, do_verbose;
-    gmx_bool                bMasterState;
-    unsigned int            force_flags;
-    tensor                  force_vir = {{0}}, shake_vir = {{0}}, total_vir = {{0}},
-                            tmp_vir   = {{0}}, pres = {{0}};
-    int                     i, m;
-    rvec                    mu_tot;
-    matrix                  parrinellorahmanMu, M;
-    gmx_repl_ex_t           repl_ex = nullptr;
-    gmx_localtop_t          top;
-    PaddedVector<gmx::RVec> f {};
-    gmx_global_stat_t       gstat;
-    t_graph                *graph = nullptr;
-    gmx_shellfc_t          *shellfc;
-    gmx_bool                bSumEkinhOld, bDoReplEx, bExchanged, bNeedRepartition;
-    gmx_bool                bTemp, bPres, bTrotter;
-    real                    dvdl_constr;
-    std::vector<RVec>       cbuf;
-    matrix                  lastbox;
-    int                     lamnew  = 0;
+    t_inputrec                 *ir   = inputrec;
+    int64_t                     step, step_rel;
+    double                      t, t0 = ir->init_t, lam0[efptNR];
+    gmx_bool                    bGStatEveryStep, bGStat, bCalcVir, bCalcEnerStep, bCalcEner;
+    gmx_bool                    bNS, bNStList, bStopCM,
+                                bFirstStep, bInitStep, bLastStep = FALSE;
+    gmx_bool                    bDoDHDL = FALSE, bDoFEP = FALSE, bDoExpanded = FALSE;
+    gmx_bool                    do_ene, do_log, do_verbose;
+    gmx_bool                    bMasterState;
+    unsigned int                force_flags;
+    tensor                      force_vir     = {{0}}, shake_vir = {{0}}, total_vir = {{0}},
+                                tmp_vir       = {{0}}, pres = {{0}};
+    int                         i, m;
+    rvec                        mu_tot;
+    matrix                      parrinellorahmanMu, M;
+    gmx_repl_ex_t               repl_ex = nullptr;
+    gmx_localtop_t              top;
+    PaddedHostVector<gmx::RVec> f {};
+    gmx_global_stat_t           gstat;
+    t_graph                    *graph = nullptr;
+    gmx_shellfc_t              *shellfc;
+    gmx_bool                    bSumEkinhOld, bDoReplEx, bExchanged, bNeedRepartition;
+    gmx_bool                    bTemp, bPres, bTrotter;
+    real                        dvdl_constr;
+    std::vector<RVec>           cbuf;
+    matrix                      lastbox;
+    int                         lamnew  = 0;
     /* for FEP */
-    int                     nstfep = 0;
-    double                  cycles;
-    real                    saved_conserved_quantity = 0;
-    real                    last_ekin                = 0;
-    t_extmass               MassQ;
-    char                    sbuf[STEPSTRSIZE], sbuf2[STEPSTRSIZE];
+    int                         nstfep = 0;
+    double                      cycles;
+    real                        saved_conserved_quantity = 0;
+    real                        last_ekin                = 0;
+    t_extmass                   MassQ;
+    char                        sbuf[STEPSTRSIZE], sbuf2[STEPSTRSIZE];
 
     /* PME load balancing data for GPU kernels */
     gmx_bool              bPMETune         = FALSE;
index b10bed8bd03715b2601f758e97b3f3940cb9f581..f33e97fc54d39e8ccddc0a7ecf37da50834280de 100644 (file)
@@ -141,21 +141,21 @@ using gmx::SimulationSignaller;
 
 void gmx::LegacySimulator::do_mimic()
 {
-    t_inputrec              *ir   = inputrec;
-    int64_t                  step, step_rel;
-    double                   t, lam0[efptNR];
-    bool                     isLastStep               = false;
-    bool                     doFreeEnergyPerturbation = false;
-    unsigned int             force_flags;
-    tensor                   force_vir, shake_vir, total_vir, pres;
-    rvec                     mu_tot;
-    gmx_localtop_t           top;
-    PaddedVector<gmx::RVec>  f {};
-    gmx_global_stat_t        gstat;
-    t_graph                 *graph = nullptr;
-    gmx_shellfc_t           *shellfc;
-
-    double                   cycles;
+    t_inputrec                  *ir   = inputrec;
+    int64_t                      step, step_rel;
+    double                       t, lam0[efptNR];
+    bool                         isLastStep               = false;
+    bool                         doFreeEnergyPerturbation = false;
+    unsigned int                 force_flags;
+    tensor                       force_vir, shake_vir, total_vir, pres;
+    rvec                         mu_tot;
+    gmx_localtop_t               top;
+    PaddedHostVector<gmx::RVec>  f {};
+    gmx_global_stat_t            gstat;
+    t_graph                     *graph = nullptr;
+    gmx_shellfc_t               *shellfc;
+
+    double                       cycles;
 
     /* Domain decomposition could incorrectly miss a bonded
        interaction, but checking for that requires a global
index 31cccde41923411733479a704104eafb63bf3840..87a825cff7d86773e39f4959a186638ff7e04072 100644 (file)
 //! Utility structure for manipulating states during EM
 typedef struct {
     //! Copy of the global state
-    t_state                 s;
+    t_state                     s;
     //! Force array
-    PaddedVector<gmx::RVec> f;
+    PaddedHostVector<gmx::RVec> f;
     //! Potential energy
-    real                    epot;
+    real                        epot;
     //! Norm of the force
-    real                    fnorm;
+    real                        fnorm;
     //! Maximum force
-    real                    fmax;
+    real                        fmax;
     //! Direction
-    int                     a_fmax;
+    int                         a_fmax;
 } em_state_t;
 
 //! Print the EM starting conditions
@@ -570,7 +570,7 @@ static void write_em_traj(FILE *fplog, const t_commrec *cr,
 // \returns true when the step succeeded, false when a constraint error occurred
 static bool do_em_step(const t_commrec *cr,
                        t_inputrec *ir, t_mdatoms *md,
-                       em_state_t *ems1, real a, const PaddedVector<gmx::RVec> *force,
+                       em_state_t *ems1, real a, const PaddedHostVector<gmx::RVec> *force,
                        em_state_t *ems2,
                        gmx::Constraints *constr,
                        int64_t count)
index 6c7519252bd3c05e6d90db00021dc3d489428cc4..b554582cb0f40f2216e40f33fa624c0d6419994a 100644 (file)
@@ -194,23 +194,23 @@ void gmx::LegacySimulator::do_rerun()
     // alias to avoid a large ripple of nearly useless changes.
     // t_inputrec is being replaced by IMdpOptionsProvider, so this
     // will go away eventually.
-    t_inputrec             *ir   = inputrec;
-    int64_t                 step, step_rel;
-    double                  t, lam0[efptNR];
-    bool                    isLastStep               = false;
-    bool                    doFreeEnergyPerturbation = false;
-    unsigned int            force_flags;
-    tensor                  force_vir, shake_vir, total_vir, pres;
-    t_trxstatus            *status = nullptr;
-    rvec                    mu_tot;
-    t_trxframe              rerun_fr;
-    gmx_localtop_t          top;
-    PaddedVector<gmx::RVec> f {};
-    gmx_global_stat_t       gstat;
-    t_graph                *graph = nullptr;
-    gmx_shellfc_t          *shellfc;
-
-    double                  cycles;
+    t_inputrec                 *ir   = inputrec;
+    int64_t                     step, step_rel;
+    double                      t, lam0[efptNR];
+    bool                        isLastStep               = false;
+    bool                        doFreeEnergyPerturbation = false;
+    unsigned int                force_flags;
+    tensor                      force_vir, shake_vir, total_vir, pres;
+    t_trxstatus                *status = nullptr;
+    rvec                        mu_tot;
+    t_trxframe                  rerun_fr;
+    gmx_localtop_t              top;
+    PaddedHostVector<gmx::RVec> f {};
+    gmx_global_stat_t           gstat;
+    t_graph                    *graph = nullptr;
+    gmx_shellfc_t              *shellfc;
+
+    double                      cycles;
 
     /* Domain decomposition could incorrectly miss a bonded
        interaction, but checking for that requires a global
index 99fea9b83c618dad43b15e2c52fceadeb37f0e5c..bd79c56b8f8c9060b28a3fda6d5ea9b9b4a51bb7 100644 (file)
@@ -107,8 +107,8 @@ struct gmx_shellfc_t {
     int          nflexcon;               /* The number of flexible constraints        */
 
     /* Temporary arrays, should be fixed size 2 when fully converted to C++ */
-    PaddedVector<gmx::RVec> *x;          /* Array for iterative minimization          */
-    PaddedVector<gmx::RVec> *f;          /* Array for iterative minimization          */
+    PaddedHostVector<gmx::RVec>     *x;  /* Array for iterative minimization          */
+    PaddedHostVector<gmx::RVec>     *f;  /* Array for iterative minimization          */
 
     /* Flexible constraint working data */
     rvec        *acc_dir;                /* Acceleration direction for flexcon        */
@@ -329,8 +329,8 @@ gmx_shellfc_t *init_shell_flexcon(FILE *fplog,
     }
 
     snew(shfc, 1);
-    shfc->x        = new PaddedVector<gmx::RVec>[2] {};
-    shfc->f        = new PaddedVector<gmx::RVec>[2] {};
+    shfc->x        = new PaddedHostVector<gmx::RVec>[2] {};
+    shfc->f        = new PaddedHostVector<gmx::RVec>[2] {};
     shfc->nflexcon = nflexcon;
 
     if (nshell == 0)
index 46c73da8d6372bb7578a3b6b147a1d90850e497b..a72e3607b8dc38a537d38d3ad8d4b58427950aba 100644 (file)
@@ -165,33 +165,33 @@ LegacySimulator::do_tpi()
 {
     GMX_RELEASE_ASSERT(gmx_omp_nthreads_get(emntDefault) == 1, "TPI does not support OpenMP");
 
-    gmx_localtop_t          top;
-    PaddedVector<gmx::RVec> f {};
-    real                    lambda, t, temp, beta, drmax, epot;
-    double                  embU, sum_embU, *sum_UgembU, V, V_all, VembU_all;
-    t_trxstatus            *status;
-    t_trxframe              rerun_fr;
-    gmx_bool                bDispCorr, bCharge, bRFExcl, bNotLastFrame, bStateChanged, bNS;
-    tensor                  force_vir, shake_vir, vir, pres;
-    int                     a_tp0, a_tp1, ngid, gid_tp, nener, e;
-    rvec                   *x_mol;
-    rvec                    mu_tot, x_init, dx;
-    int                     nnodes, frame;
-    int64_t                 frame_step_prev, frame_step;
-    int64_t                 nsteps, stepblocksize = 0, step;
-    int64_t                 seed;
-    int                     i;
-    FILE                   *fp_tpi = nullptr;
-    char                   *ptr, *dump_pdb, **leg, str[STRLEN], str2[STRLEN];
-    double                  dbl, dump_ener;
-    gmx_bool                bCavity;
-    int                     nat_cavity  = 0, d;
-    real                   *mass_cavity = nullptr, mass_tot;
-    int                     nbin;
-    double                  invbinw, *bin, refvolshift, logV, bUlogV;
-    gmx_bool                bEnergyOutOfBounds;
-    const char             *tpid_leg[2] = {"direct", "reweighted"};
-    auto                    mdatoms     = mdAtoms->mdatoms();
+    gmx_localtop_t              top;
+    PaddedHostVector<gmx::RVec> f {};
+    real                        lambda, t, temp, beta, drmax, epot;
+    double                      embU, sum_embU, *sum_UgembU, V, V_all, VembU_all;
+    t_trxstatus                *status;
+    t_trxframe                  rerun_fr;
+    gmx_bool                    bDispCorr, bCharge, bRFExcl, bNotLastFrame, bStateChanged, bNS;
+    tensor                      force_vir, shake_vir, vir, pres;
+    int                         a_tp0, a_tp1, ngid, gid_tp, nener, e;
+    rvec                       *x_mol;
+    rvec                        mu_tot, x_init, dx;
+    int                         nnodes, frame;
+    int64_t                     frame_step_prev, frame_step;
+    int64_t                     nsteps, stepblocksize = 0, step;
+    int64_t                     seed;
+    int                         i;
+    FILE                       *fp_tpi = nullptr;
+    char                       *ptr, *dump_pdb, **leg, str[STRLEN], str2[STRLEN];
+    double                      dbl, dump_ener;
+    gmx_bool                    bCavity;
+    int                         nat_cavity  = 0, d;
+    real                       *mass_cavity = nullptr, mass_tot;
+    int                         nbin;
+    double                      invbinw, *bin, refvolshift, logV, bUlogV;
+    gmx_bool                    bEnergyOutOfBounds;
+    const char                 *tpid_leg[2] = {"direct", "reweighted"};
+    auto                        mdatoms     = mdAtoms->mdatoms();
 
     GMX_UNUSED_VALUE(outputProvider);
 
index 8931b9733a60eab19cea073230b2c46eeac58c15..3bacabed3968313c0aa32a272429aa1a715a193c 100644 (file)
@@ -199,32 +199,32 @@ class t_state
         t_state();
 
         // All things public
-        int                         natoms;         //!< Number of atoms, local + non-local; this is the size of \p x, \p v and \p cg_p, when used
-        int                         ngtc;           //!< The number of temperature coupling groups
-        int                         nnhpres;        //!< The NH-chain length for the MTTK barostat
-        int                         nhchainlength;  //!< The NH-chain length for temperature coupling
-        int                         flags;          //!< Set of bit-flags telling which entries are present, see enum at the top of the file
-        int                         fep_state;      //!< indicates which of the alchemical states we are in
-        std::array<real, efptNR>    lambda;         //!< Free-energy lambda vector
-        matrix                      box;            //!< Matrix of box vectors
-        matrix                      box_rel;        //!< Relative box vectors to preserve box shape
-        matrix                      boxv;           //!< Box velocities for Parrinello-Rahman P-coupling
-        matrix                      pres_prev;      //!< Pressure of the previous step for pcoupl
-        matrix                      svir_prev;      //!< Shake virial for previous step for pcoupl
-        matrix                      fvir_prev;      //!< Force virial of the previous step for pcoupl
-        std::vector<double>         nosehoover_xi;  //!< Nose-Hoover coordinates (ngtc)
-        std::vector<double>         nosehoover_vxi; //!< Nose-Hoover velocities (ngtc)
-        std::vector<double>         nhpres_xi;      //!< Pressure Nose-Hoover coordinates
-        std::vector<double>         nhpres_vxi;     //!< Pressure Nose-Hoover velocities
-        std::vector<double>         therm_integral; //!< Work exterted N-H/V-rescale T-coupling (ngtc)
-        double                      baros_integral; //!< For Berendsen P-coupling conserved quantity
-        real                        veta;           //!< Trotter based isotropic P-coupling
-        real                        vol0;           //!< Initial volume,required for computing MTTK conserved quantity
-        PaddedHostVector<gmx::RVec> x;              //!< The coordinates (natoms)
-        PaddedVector<gmx::RVec>     v;              //!< The velocities (natoms)
-        PaddedVector<gmx::RVec>     cg_p;           //!< p vector for conjugate gradient minimization
-
-        ekinstate_t                 ekinstate;      //!< The state of the kinetic energy
+        int                             natoms;         //!< Number of atoms, local + non-local; this is the size of \p x, \p v and \p cg_p, when used
+        int                             ngtc;           //!< The number of temperature coupling groups
+        int                             nnhpres;        //!< The NH-chain length for the MTTK barostat
+        int                             nhchainlength;  //!< The NH-chain length for temperature coupling
+        int                             flags;          //!< Set of bit-flags telling which entries are present, see enum at the top of the file
+        int                             fep_state;      //!< indicates which of the alchemical states we are in
+        std::array<real, efptNR>        lambda;         //!< Free-energy lambda vector
+        matrix                          box;            //!< Matrix of box vectors
+        matrix                          box_rel;        //!< Relative box vectors to preserve box shape
+        matrix                          boxv;           //!< Box velocities for Parrinello-Rahman P-coupling
+        matrix                          pres_prev;      //!< Pressure of the previous step for pcoupl
+        matrix                          svir_prev;      //!< Shake virial for previous step for pcoupl
+        matrix                          fvir_prev;      //!< Force virial of the previous step for pcoupl
+        std::vector<double>             nosehoover_xi;  //!< Nose-Hoover coordinates (ngtc)
+        std::vector<double>             nosehoover_vxi; //!< Nose-Hoover velocities (ngtc)
+        std::vector<double>             nhpres_xi;      //!< Pressure Nose-Hoover coordinates
+        std::vector<double>             nhpres_vxi;     //!< Pressure Nose-Hoover velocities
+        std::vector<double>             therm_integral; //!< Work exterted N-H/V-rescale T-coupling (ngtc)
+        double                          baros_integral; //!< For Berendsen P-coupling conserved quantity
+        real                            veta;           //!< Trotter based isotropic P-coupling
+        real                            vol0;           //!< Initial volume,required for computing MTTK conserved quantity
+        PaddedHostVector<gmx::RVec>     x;              //!< The coordinates (natoms)
+        PaddedHostVector<gmx::RVec>     v;              //!< The velocities (natoms)
+        PaddedHostVector<gmx::RVec>     cg_p;           //!< p vector for conjugate gradient minimization
+
+        ekinstate_t                     ekinstate;      //!< The state of the kinetic energy
 
         /* History for special algorithms, should be moved to a history struct */
         history_t                         hist;               //!< Time history for restraints
index a35bfd78f5bcc74620fbe258faa78a6f27ccbd91..6af953bc400ea09393c24e5e75bcea3e3eaf6592 100644 (file)
@@ -99,7 +99,7 @@ void DomDecHelper::setup()
 {
     std::unique_ptr<t_state> localState   = statePropagatorData_->localState();
     t_state                 *globalState  = statePropagatorData_->globalState();
-    PaddedVector<RVec>      *forcePointer = statePropagatorData_->forcePointer();
+    PaddedHostVector<RVec>  *forcePointer = statePropagatorData_->forcePointer();
 
     // constant choices for this call to dd_partition_system
     const bool     verbose       = false;
@@ -127,7 +127,7 @@ void DomDecHelper::run(Step step, Time gmx_unused time)
     }
     std::unique_ptr<t_state> localState   = statePropagatorData_->localState();
     t_state                 *globalState  = statePropagatorData_->globalState();
-    PaddedVector<RVec>      *forcePointer = statePropagatorData_->forcePointer();
+    PaddedHostVector<RVec>  *forcePointer = statePropagatorData_->forcePointer();
 
     // constant choices for this call to dd_partition_system
     const bool verbose       =
index 00e606f3cadf3f9fd0bfe680c012782bb39f544d..0e2ec0f23ed3c24ba6fef1c942c6a4c7a88b73f3 100644 (file)
@@ -241,7 +241,7 @@ t_state* StatePropagatorData::globalState()
     return globalState_;
 }
 
-PaddedVector<RVec>* StatePropagatorData::forcePointer()
+PaddedHostVector<RVec>* StatePropagatorData::forcePointer()
 {
     return &f_;
 }
index c57edf0802377a25e12bc198dd4ec2904bba1283..b5318f8caaf29119dc325e3622f6e220d09596d5 100644 (file)
@@ -196,21 +196,21 @@ class StatePropagatorData final :
         int nstxout_compressed_;
 
         //! The local number of atoms
-        int                    localNAtoms_;
+        int                        localNAtoms_;
         //! The position vector
-        PaddedHostVector<RVec> x_;
+        PaddedHostVector<RVec>     x_;
         //! The position vector of the previous step
-        PaddedVector<RVec>     previousX_;
+        PaddedHostVector<RVec>     previousX_;
         //! The velocity vector
-        PaddedVector<RVec>     v_;
+        PaddedHostVector<RVec>     v_;
         //! The force vector
-        PaddedVector<RVec>     f_;
+        PaddedHostVector<RVec>     f_;
         //! The box matrix
-        matrix                 box_;
+        matrix                     box_;
         //! The box matrix of the previous step
-        matrix                 previousBox_;
+        matrix                     previousBox_;
         //! The DD partitioning count for legacy t_state compatibility
-        int                    ddpCount_;
+        int                        ddpCount_;
 
         //! Move x_ to previousX_
         void copyPosition();
@@ -225,7 +225,7 @@ class StatePropagatorData final :
         //! Get a pointer to the global state
         t_state *globalState();
         //! Get a force pointer
-        PaddedVector<gmx::RVec> *forcePointer();
+        PaddedHostVector<gmx::RVec> *forcePointer();
 
         //! Pointer to keep a backup of the state for later writeout
         std::unique_ptr<t_state> localStateBackup_;
@@ -246,9 +246,9 @@ class StatePropagatorData final :
         void write(gmx_mdoutf *outf, Step step, Time time);
 
         //! Whether we're doing VV and need to reset velocities after the first half step
-        bool               vvResetVelocities_;
+        bool                   vvResetVelocities_;
         //! Velocities backup for VV
-        PaddedVector<RVec> velocityBackup_;
+        PaddedHostVector<RVec> velocityBackup_;
         //! Function resetting the velocities
         void resetVelocities();