-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding
LoadBalancer::AbstractFactory
(c.f. #61)
Abstract factory manages the respective load balancer factories, which are at the moment `LoadBalancer::Random`. At the moment, the rebalance requests are getting properly issued. The next step will be building a proper world model, and actually issuing migrates.
- Loading branch information
Showing
9 changed files
with
110 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
source/simulation/load_balancer/abstract_load_balancer_factory.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef ABSTRACT_LOAD_BALANCER_FACTORY_HPP | ||
#define ABSTRACT_LOAD_BALANCER_FACTORY_HPP | ||
|
||
#include "base_model.hpp" | ||
|
||
namespace LoadBalancer { | ||
class AbstractFactory { | ||
public: | ||
template <typename ProblemType> | ||
static hpx::future<void> initialize_locality_and_world_models(const uint locality_id); | ||
|
||
template <typename ProblemType> | ||
static void reset_locality_and_world_models(); | ||
|
||
template <typename ProblemType> | ||
static std::unique_ptr<SubmeshModel> create_submesh_model(uint locality_id, uint submesh_id); | ||
}; | ||
} | ||
#endif |
24 changes: 24 additions & 0 deletions
24
source/simulation/load_balancer/abstract_load_balancer_factory_impl.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef ABSTRACT_LOAD_BALANCER_FACTORY_IMPL_HPP | ||
#define ABSTRACT_LOAD_BALANCER_FACTORY_IMPL_HPP | ||
|
||
#include "abstract_load_balancer_factory.hpp" | ||
#include "random.hpp" | ||
|
||
|
||
namespace LoadBalancer { | ||
template <typename ProblemType> | ||
hpx::future<void> AbstractFactory::initialize_locality_and_world_models(const uint locality_id) { | ||
return Random<ProblemType>::initialize_locality_and_world_models(locality_id); | ||
} | ||
|
||
template <typename ProblemType> | ||
void AbstractFactory::reset_locality_and_world_models() { | ||
return Random<ProblemType>::reset_locality_and_world_models(); | ||
} | ||
|
||
template <typename ProblemType> | ||
std::unique_ptr<SubmeshModel> AbstractFactory::create_submesh_model(uint locality_id, uint submesh_id) { | ||
return Random<ProblemType>::create_submesh_model(locality_id, submesh_id); | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef LOAD_BALANCER_BASE_MODEL_HPP | ||
#define LOAD_BALANCER_BASE_MODEL_HPP | ||
|
||
namespace LoadBalancer { | ||
class SubmeshModel { | ||
public: | ||
SubmeshModel() = default; | ||
SubmeshModel(uint locality_id, uint submesh_id) | ||
: locality_id(locality_id), submesh_id(submesh_id) {} | ||
|
||
virtual void InStep(uint64_t compute_cost, uint64_t memory_cost) { | ||
std::cout << "Firing base_model::Instep()\n"; | ||
} | ||
|
||
template <typename Archive> | ||
void serialize(Archive& ar, unsigned) { | ||
ar & locality_id & submesh_id; | ||
} | ||
HPX_SERIALIZATION_POLYMORPHIC(SubmeshModel); | ||
|
||
protected: | ||
uint locality_id, submesh_id; | ||
}; | ||
} | ||
#endif |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters