-/* Copyright (c) 2013-2022. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2013-2023. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include "src/kernel/resource/NetworkModel.hpp"
#include "src/surf/HostImpl.hpp"
#include <cstdlib>
#include <vector>
#ifndef HOST_L07_HPP_
#define HOST_L07_HPP_
-namespace simgrid {
-namespace kernel {
-namespace resource {
+namespace simgrid::kernel::resource {
/***********
* Classes *
*********/
class HostL07Model : public HostModel {
public:
- explicit HostL07Model(const std::string& name);
+ HostL07Model(const std::string& name, lmm::System* sys);
HostL07Model(const HostL07Model&) = delete;
HostL07Model& operator=(const HostL07Model&) = delete;
double next_occurring_event(double now) override;
void update_actions_state(double now, double delta) override;
+ Action* execute_thread(const s4u::Host* host, double flops_amount, int thread_count) override { return nullptr; }
CpuAction* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
const double* bytes_amount, double rate) override;
+ Action* io_stream(s4u::Host* src_host, DiskImpl* src_disk, s4u::Host* dst_host, DiskImpl* dst_disk, double size) override { return nullptr; }
};
class CpuL07Model : public CpuModel {
StandardLinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) final;
StandardLinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) override;
- Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
+ Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate, bool streamed) override;
void update_actions_state(double /*now*/, double /*delta*/) override{
/* this action is done by HostL07Model which shares the LMM system with the CPU model
* Overriding to an empty function here allows us to handle the Cpu07Model as a regular
* Action *
**********/
class L07Action : public CpuAction {
- std::vector<s4u::Host*> hostList_;
- bool free_arrays_ = false; // By default, computationAmount_ and friends are freed by caller. But not for sequential
+ const std::vector<s4u::Host*> host_list_;
+ bool free_arrays_ = false; // By default, computation_amount_ and friends are freed by caller. But not for sequential
// exec and regular comms
- const double* computationAmount_; /* pointer to the data that lives in s4u action -- do not free unless if
- * free_arrays */
- const double* communicationAmount_; /* pointer to the data that lives in s4u action -- do not free unless if
- * free_arrays */
+ const double* computation_amount_; /* pointer to the data that lives in s4u action -- do not free unless if
+ * free_arrays */
+ const double* communication_amount_; /* pointer to the data that lives in s4u action -- do not free unless if
+ * free_arrays */
double latency_;
double rate_;
friend CpuAction* CpuL07::sleep(double duration);
friend CpuAction* HostL07Model::execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
const double* bytes_amount, double rate);
- friend Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate);
+ friend Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate, bool streamed);
/**
* @brief Calculate the CPU bound for the parallel task
*
* The task is bounded by the slowest CPU running the ptask, considering the current pstate of each CPU.
* Return MAX_DOUBLE if ptask has no computation.
*/
- double calculateCpuBound();
+ double calculate_cpu_bound() const;
/**
* @brief Calculate the network bound for the parallel task
* The network bound depends on the largest latency between the communication in the ptask.
* Return MAX_DOUBLE if latency is 0 (or ptask doesn't have any communication)
*/
- double calculateNetworkBound();
+ double calculate_network_bound() const;
public:
L07Action() = delete;
L07Action& operator=(const L07Action&) = delete;
~L07Action() override;
- void updateBound();
+ void update_bound() const;
double get_latency() const { return latency_; }
void set_latency(double latency) { latency_ = latency; }
void update_latency(double delta, double precision) { double_update(&latency_, delta, precision); }
};
-} // namespace resource
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::resource
#endif /* HOST_L07_HPP_ */