AutoPas  3.0.0
Loading...
Searching...
No Matches
MPIParallelizedStrategy.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <cstddef>
10#include <random>
11#include <type_traits>
12#include <vector>
13
29
30namespace autopas {
31
39 public:
48 MPIParallelizedStrategy(const Configuration &fallbackConfiguration, const AutoPas_MPI_Comm &comm,
49 double mpiTuningMaxDifferenceForBucket, double mpiTuningWeightForMaxDensity);
50
51 TuningStrategyOption getOptionType() const override;
52
53 bool optimizeSuggestions(std::vector<Configuration> &configQueue,
54 const EvidenceCollection &evidenceCollection) override;
55
56 void receiveSmoothedHomogeneityAndMaxDensity(double homogeneity, double maxDensity) override;
57
58 bool reset(size_t iteration, size_t tuningPhase, std::vector<Configuration> &configQueue,
59 const autopas::EvidenceCollection &evidenceCollection) override;
60
61 [[nodiscard]] inline bool needsSmoothedHomogeneityAndMaxDensity() const override;
62
63 void rejectConfiguration(const Configuration &configuration, bool indefinitely) override;
64
69 const AutoPas_MPI_Comm &getBucket() const;
70
80 static Configuration createFallBackConfiguration(const std::set<Configuration> &searchSpace,
81 const InteractionTypeOption &interactionType);
82
83 private:
88 double _smoothedHomogeneity{-1.};
89
94 double _maxDensity{-1.};
95
99 std::unique_ptr<TuningStrategyInterface> _tuningStrategy;
100
104 AutoPas_MPI_Comm _comm;
112 Configuration _fallbackConfiguration;
117 bool _usingFallbackConfig{false};
121 std::set<Configuration> _rejectedConfigurations{};
125 double _mpiTuningMaxDifferenceForBucket;
129 double _mpiTuningWeightForMaxDensity;
133 std::mt19937 _rng{std::random_device()()};
134};
135} // namespace autopas
#define AUTOPAS_MPI_COMM_NULL
Wrapper for MPI_COMM_NULL.
Definition: WrapMPI.h:118
Class containing multiple options that form an algorithm configuration for the pairwise iteration.
Definition: Configuration.h:24
Class to manage all evidence.
Definition: EvidenceCollection.h:21
This strategy spreads the configuration queue in a round robin fashion over all ranks (with similar d...
Definition: MPIParallelizedStrategy.h:38
void receiveSmoothedHomogeneityAndMaxDensity(double homogeneity, double maxDensity) override
Method to pass smoothed homogeneity and the maximal density to the tuning strategy.
Definition: MPIParallelizedStrategy.cpp:147
TuningStrategyOption getOptionType() const override
Get this object's associated TuningStrategyOption type.
Definition: MPIParallelizedStrategy.cpp:154
const AutoPas_MPI_Comm & getBucket() const
Get the MPI communicator for this rank's bucket.
Definition: MPIParallelizedStrategy.cpp:152
bool needsSmoothedHomogeneityAndMaxDensity() const override
Indicate whether the strategy needs smoothed values of homogeneity and max density.
Definition: MPIParallelizedStrategy.cpp:145
bool optimizeSuggestions(std::vector< Configuration > &configQueue, const EvidenceCollection &evidenceCollection) override
Optimizes the queue of configurations to process.
Definition: MPIParallelizedStrategy.cpp:27
void rejectConfiguration(const Configuration &configuration, bool indefinitely) override
Notify the strategy about a configuration that is (currently) invalid and thus can potentially be dro...
Definition: MPIParallelizedStrategy.cpp:102
static Configuration createFallBackConfiguration(const std::set< Configuration > &searchSpace, const InteractionTypeOption &interactionType)
Create a resilient configuration that should always be applicable.
Definition: MPIParallelizedStrategy.cpp:69
bool reset(size_t iteration, size_t tuningPhase, std::vector< Configuration > &configQueue, const autopas::EvidenceCollection &evidenceCollection) override
Reset all internal parameters to the beginning of a new tuning phase.
Definition: MPIParallelizedStrategy.cpp:106
Interface for tuning strategies for the auto tuner.
Definition: TuningStrategyInterface.h:23
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32
AutoPas_MPI_Comm
Dummy for MPI_Comm.
Definition: WrapMPI.h:113