Access the device status directly, remove the getter
[alexxy/gromacs.git] / src / gromacs / taskassignment / usergpuids.h
index 9d9bef4967a4296778554148b382f81cb118835e..e85d15bf18d6d446956ffaff249af399b6e00016 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020, 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.
 
 #include <cstddef>
 
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "gromacs/utility/arrayref.h"
 
-struct gmx_gpu_info_t;
+struct DeviceInformation;
 
 namespace gmx
 {
@@ -83,7 +84,7 @@ std::vector<int> parseUserGpuIdString(const std::string& gpuIdString);
  * all compatible GPUs on this physical node. Otherwise, check the
  * user specified compatible GPUs and return their IDs.
  *
- * \param[in]  gpuInfo                Information detected about GPUs on this physical node
+ * \param[in]  deviceInfoList         Information on the GPUs on this physical node.
  * \param[in]  gpuIdsAvailableString  String like "013" or "0,1,3" typically
  *                                    supplied by the user to mdrun -gpu_id.
  *                                    Must contain only unique decimal digits, or only decimal
@@ -99,7 +100,8 @@ std::vector<int> parseUserGpuIdString(const std::string& gpuIdString);
  *           InvalidInputError  If gpuIdsAvailableString specifies GPU IDs that are
  *                              not compatible.
  */
-std::vector<int> makeGpuIdsToUse(const gmx_gpu_info_t& gpuInfo, const std::string& gpuIdsAvailableString);
+std::vector<int> makeGpuIdsToUse(const std::vector<std::unique_ptr<DeviceInformation>>& deviceInfoList,
+                                 const std::string& gpuIdsAvailableString);
 
 /*! \brief Parse a GPU ID specifier string into a container describing device ID to task mapping.
  *
@@ -163,16 +165,16 @@ std::string makeGpuIdString(const std::vector<int>& gpuIds, int totalNumberOfTas
  * infrastructure to do a good job of coordinating error messages and
  * behaviour across MPMD ranks and multiple simulations.
  *
- * \param[in]   gpu_info        Information detected about GPUs
+ * \param[in]   deviceInfoList  Information on the GPUs on this physical node.
  * \param[in]   compatibleGpus  Vector of GPUs that are compatible
  * \param[in]   gpuIds          The GPU IDs selected by the user.
  *
  * \throws  std::bad_alloc          If out of memory
  *          InconsistentInputError  If the assigned GPUs are not valid
  */
-void checkUserGpuIds(const gmx_gpu_info_t&   gpu_info,
-                     const std::vector<int>& compatibleGpus,
-                     const std::vector<int>& gpuIds);
+void checkUserGpuIds(const std::vector<std::unique_ptr<DeviceInformation>>& deviceInfoList,
+                     const std::vector<int>&                                compatibleGpus,
+                     const std::vector<int>&                                gpuIds);
 
 } // namespace gmx