Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2023.
[simgrid.git] / src / smpi / include / smpi_host.hpp
1 /* Copyright (c) 2017-2023. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SMPI_HOST_HPP_
7 #define SMPI_HOST_HPP_
8
9 #include "smpi_utils.hpp"
10
11 #include "simgrid/s4u/Host.hpp"
12 #include "src/kernel/resource/FactorSet.hpp"
13 #include <string>
14 #include <vector>
15 #include <xbt/Extendable.hpp>
16
17 namespace simgrid::smpi {
18 static auto factor_lambda(std::vector<double> const& values, double size)
19 {
20   return values[0] + values[1] * size;
21 }
22 class Host {
23   kernel::resource::FactorSet orecv_{"smpi/or", 0.0, factor_lambda};
24   kernel::resource::FactorSet osend_{"smpi/os", 0.0, factor_lambda};
25   kernel::resource::FactorSet oisend_{"smpi/ois", 0.0, factor_lambda};
26   s4u::Host* host = nullptr;
27   /**
28    * @brief Generates warning message if user's config is conflicting (callback vs command line/xml)
29    * @param op String with config name (smpi/os, smpi/or, smpi/ois)
30    */
31   void check_factor_configs(const std::string& op) const;
32
33 public:
34   static xbt::Extension<s4u::Host, smpi::Host> EXTENSION_ID;
35
36   explicit Host(s4u::Host* ptr);
37
38   double orecv(size_t size, s4u::Host* src, s4u::Host* dst) const;
39   double osend(size_t size, s4u::Host* src, s4u::Host* dst) const;
40   double oisend(size_t size, s4u::Host* src, s4u::Host* dst) const;
41 };
42
43 } // namespace simgrid::smpi
44 #endif