Modernize PME GPU timing enums
[alexxy/gromacs.git] / src / gromacs / timing / gpu_timing.h
index bcefcac5ba39d7a4106fa1f7e96aa2848a5d43cb..24768bc59ac6ce73565f4528829eee4225278770 100644 (file)
@@ -2,7 +2,7 @@
  * This file is part of the GROMACS molecular simulation package.
  *
  * Copyright (c) 2012,2014,2015,2016,2017 by 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.
@@ -44,6 +44,8 @@
 #ifndef GMX_TIMING_GPU_TIMING_H
 #define GMX_TIMING_GPU_TIMING_H
 
+#include "gromacs/utility/enumerationhelpers.h"
+
 /*! \internal \brief GPU kernel time and call count. */
 struct gmx_kernel_timing_data_t
 {
@@ -54,16 +56,16 @@ struct gmx_kernel_timing_data_t
 /*! \internal \brief
  * PME GPU stages timing events indices, corresponding to the string in PMEStageNames in wallcycle.cpp.
  */
-enum
+enum class PmeStage : int
 {
-    gtPME_SPLINE = 0,
-    gtPME_SPREAD,
-    gtPME_SPLINEANDSPREAD,
-    gtPME_FFT_R2C,
-    gtPME_SOLVE,
-    gtPME_FFT_C2R,
-    gtPME_GATHER,
-    gtPME_EVENT_COUNT /* not a stage ID but a static array size */
+    Spline = 0,
+    Spread,
+    SplineAndSpread,
+    FftTransformR2C,
+    Solve,
+    FftTransformC2R,
+    Gather,
+    Count /* not a stage ID but a static array size */
 };
 
 /*! \internal \brief GPU timings for PME. */
@@ -73,7 +75,7 @@ struct gmx_wallclock_gpu_pme_t
      * TODO: devise a better GPU timing data structuring.
      */
     /*! \brief Array of PME GPU timing data. */
-    gmx_kernel_timing_data_t timing[gtPME_EVENT_COUNT];
+    gmx::EnumerationArray<PmeStage, gmx_kernel_timing_data_t> timing;
 };
 
 /*! \internal \brief GPU NB timings for kernels and H2d/D2H transfers. */