AutoPas  3.0.0
Loading...
Searching...
No Matches
AutoPasDecl.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <memory>
9#include <set>
10
31
32namespace autopas {
33
34// Forward declare Handler so that including this header does not include the whole library with all
35// containers and traversals.
36template <class Particle_T>
37class LogicHandler;
38
45template <class Particle_T>
46class AutoPas {
47 public:
51 using ParticleType = Particle_T;
52
58
64
70
76
81 explicit AutoPas(std::ostream &logOutputStream = std::cout);
82
83 ~AutoPas();
84
90 AutoPas &operator=(AutoPas &&other) noexcept;
91
100 void init();
101
108 std::vector<Particle_T> resizeBox(const std::array<double, 3> &boxMin, const std::array<double, 3> &boxMax);
109
113 void forceRetune();
114
120 void finalize() {
121 if (not _externalMPICommunicator) {
122 AutoPas_MPI_Comm_free(&_tuningStrategyFactoryInfo.autopasMpiCommunicator);
123 }
124 }
125
132 [[nodiscard]] std::vector<Particle_T> updateContainer();
133
143 void reserve(size_t numParticles);
144
154 void reserve(size_t numParticles, size_t numHaloParticles);
155
164 void addParticle(const Particle_T &p);
165
173 template <class Collection>
174 void addParticles(Collection &&particles);
175
185 template <class Collection, class F>
186 void addParticlesIf(Collection &&particles, F predicate);
187
195 void addHaloParticle(const Particle_T &haloParticle);
196
204 template <class Collection>
205 void addHaloParticles(Collection &&particles);
206
216 template <class Collection, class F>
217 void addHaloParticlesIf(Collection &&particles, F predicate);
218
223 void deleteAllParticles();
224
233 void deleteParticle(IteratorT &iter);
234
241
254 bool deleteParticle(Particle_T &particle);
255
262 template <class Functor>
264
272 IteratorT begin(IteratorBehavior behavior = IteratorBehavior::ownedOrHalo);
273
278 ConstIteratorT begin(IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const;
279
287 template <typename Lambda>
288 void forEachParallel(Lambda forEachLambda, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
289 // TODO lgaertner: parallelize with kokkos integration
290 withStaticContainerType(getContainer(), [&](auto &container) { container.forEach(forEachLambda, behavior); });
291 }
292
297 template <typename Lambda>
298 void forEachParallel(Lambda forEachLambda, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
299 // TODO lgaertner: parallelize with kokkos integration
300 withStaticContainerType(getContainer(), [&](auto &container) { container.forEach(forEachLambda, behavior); });
301 }
302
309 template <typename Lambda>
310 void forEach(Lambda forEachLambda, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
311 withStaticContainerType(getContainer(), [&](auto &container) { container.forEach(forEachLambda, behavior); });
312 }
313
318 template <typename Lambda>
319 void forEach(Lambda forEachLambda, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
320 withStaticContainerType(getContainer(), [&](auto &container) { container.forEach(forEachLambda, behavior); });
321 }
322
332 template <typename Lambda, typename A>
333 void reduceParallel(Lambda reduceLambda, A &result, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
334 // TODO lgaertner: parallelize with kokkos integration
335 withStaticContainerType(getContainer(), [&](auto &container) { container.reduce(reduceLambda, result, behavior); });
336 }
337
342 template <typename Lambda, typename A>
343 void reduceParallel(Lambda reduceLambda, A &result, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
344 // TODO lgaertner: parallelize with kokkos integration
345 withStaticContainerType(getContainer(), [&](auto &container) { container.reduce(reduceLambda, result, behavior); });
346 }
347
356 template <typename Lambda, typename A>
357 void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
358 withStaticContainerType(getContainer(), [&](auto &container) { container.reduce(reduceLambda, result, behavior); });
359 }
360
365 template <typename Lambda, typename A>
366 void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
367 withStaticContainerType(getContainer(), [&](auto &container) { container.reduce(reduceLambda, result, behavior); });
368 }
369
374 ConstIteratorT cbegin(IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const { return begin(behavior); }
375
386 [[nodiscard]] constexpr bool end() const { return false; }
387
399 RegionIteratorT getRegionIterator(const std::array<double, 3> &lowerCorner, const std::array<double, 3> &higherCorner,
400 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo);
405 RegionConstIteratorT getRegionIterator(const std::array<double, 3> &lowerCorner,
406 const std::array<double, 3> &higherCorner,
407 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const;
408
418 template <typename Lambda>
419 void forEachInRegionParallel(Lambda forEachLambda, const std::array<double, 3> &lowerCorner,
420 const std::array<double, 3> &higherCorner,
421 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
422 // TODO (lgaertner): parallelize with kokkos integration
423 withStaticContainerType(getContainer(), [&](auto &container) {
424 container.forEachInRegion(forEachLambda, lowerCorner, higherCorner, behavior);
425 });
426 }
427
432 template <typename Lambda>
433 void forEachInRegionParallel(Lambda forEachLambda, const std::array<double, 3> &lowerCorner,
434 const std::array<double, 3> &higherCorner,
435 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
436 // TODO (lgaertner): parallelize with kokkos integration
437 withStaticContainerType(getContainer(), [&](auto &container) {
438 container.forEachInRegion(forEachLambda, lowerCorner, higherCorner, behavior);
439 });
440 }
441
450 template <typename Lambda>
451 void forEachInRegion(Lambda forEachLambda, const std::array<double, 3> &lowerCorner,
452 const std::array<double, 3> &higherCorner,
453 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
454 withStaticContainerType(getContainer(), [&](auto &container) {
455 container.forEachInRegion(forEachLambda, lowerCorner, higherCorner, behavior);
456 });
457 }
458
463 template <typename Lambda>
464 void forEachInRegion(Lambda forEachLambda, const std::array<double, 3> &lowerCorner,
465 const std::array<double, 3> &higherCorner,
466 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
467 withStaticContainerType(getContainer(), [&](auto &container) {
468 container.forEachInRegion(forEachLambda, lowerCorner, higherCorner, behavior);
469 });
470 }
471
483 template <typename Lambda, typename A>
484 void reduceInRegionParallel(Lambda reduceLambda, A &result, const std::array<double, 3> &lowerCorner,
485 const std::array<double, 3> &higherCorner,
486 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
487 // TODO lgaertner: parallelize with kokkos integration
488 withStaticContainerType(getContainer(), [&](auto &container) {
489 container.reduceInRegion(reduceLambda, result, lowerCorner, higherCorner, behavior);
490 });
491 }
492
497 template <typename Lambda, typename A>
498 void reduceInRegionParallel(Lambda reduceLambda, A &result, const std::array<double, 3> &lowerCorner,
499 const std::array<double, 3> &higherCorner,
500 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
501 // TODO lgaertner: parallelize with kokkos integration
502 withStaticContainerType(getContainer(), [&](auto &container) {
503 container.reduceInRegion(reduceLambda, result, lowerCorner, higherCorner, behavior);
504 });
505 }
506
517 template <typename Lambda, typename A>
518 void reduceInRegion(Lambda reduceLambda, A &result, const std::array<double, 3> &lowerCorner,
519 const std::array<double, 3> &higherCorner,
520 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
521 withStaticContainerType(getContainer(), [&](auto &container) {
522 container.reduceInRegion(reduceLambda, result, lowerCorner, higherCorner, behavior);
523 });
524 }
525
530 template <typename Lambda, typename A>
531 void reduceInRegion(Lambda reduceLambda, A &result, const std::array<double, 3> &lowerCorner,
532 const std::array<double, 3> &higherCorner,
533 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
534 withStaticContainerType(getContainer(), [&](auto &container) {
535 container.reduceInRegion(reduceLambda, result, lowerCorner, higherCorner, behavior);
536 });
537 }
538
544 double getVerletSkin() { return _logicHandlerInfo.verletSkin; };
545
551 [[nodiscard]] size_t getNumberOfParticles(IteratorBehavior behavior = IteratorBehavior::owned) const;
552
557 [[nodiscard]] unsigned long getContainerType() const;
558
563 [[nodiscard]] const std::array<double, 3> &getBoxMin() const;
564
569 [[nodiscard]] const std::array<double, 3> &getBoxMax() const;
570
575 [[nodiscard]] bool searchSpaceIsTrivial();
576
581 void setBoxMin(const std::array<double, 3> &boxMin) { _logicHandlerInfo.boxMin = boxMin; }
582
587 void setBoxMax(const std::array<double, 3> &boxMax) { _logicHandlerInfo.boxMax = boxMax; }
588
593 [[nodiscard]] double getCutoff() const { return _logicHandlerInfo.cutoff; }
594
599 void setCutoff(double cutoff) {
600 if (cutoff <= 0.0) {
601 utils::ExceptionHandler::exception("Error: Cutoff has to be positive {} <= 0.0!", cutoff);
602 }
603 _logicHandlerInfo.cutoff = cutoff;
604 }
605
610 [[nodiscard]] const NumberSet<double> &getAllowedCellSizeFactors() const { return *_allowedCellSizeFactors; }
611
616 void setAllowedCellSizeFactors(const NumberSet<double> &allowedCellSizeFactors) {
617 if (allowedCellSizeFactors.getMin() <= 0.0) {
618 utils::ExceptionHandler::exception("Error: minimum cell size factor has to be positive {} <= 0.0!",
619 allowedCellSizeFactors.getMin());
620 }
621 _allowedCellSizeFactors = std::move(allowedCellSizeFactors.clone());
622 }
623
628 void setCellSizeFactor(double cellSizeFactor) {
629 if (cellSizeFactor <= 0.0) {
630 utils::ExceptionHandler::exception("Error: cell size factor has to be positive! {}<= 0.0!", cellSizeFactor);
631 }
632 _allowedCellSizeFactors = std::make_unique<NumberSetFinite<double>>(std::set<double>{cellSizeFactor});
633 }
634
639 void setVerletSkin(double verletSkin) { _logicHandlerInfo.verletSkin = verletSkin; }
640
646 void setDeltaT(double deltaT) { _logicHandlerInfo.deltaT = deltaT; }
647
652 [[nodiscard]] unsigned int getVerletRebuildFrequency() const { return _verletRebuildFrequency; }
653
658 void setVerletRebuildFrequency(unsigned int verletRebuildFrequency) {
659 _verletRebuildFrequency = verletRebuildFrequency;
660 }
665 [[nodiscard]] unsigned int getVerletClusterSize() const { return _logicHandlerInfo.verletClusterSize; }
666
671 void setVerletClusterSize(unsigned int verletClusterSize) { _logicHandlerInfo.verletClusterSize = verletClusterSize; }
672
677 [[nodiscard]] unsigned int getTuningInterval() const { return _autoTunerInfo.tuningInterval; }
678
683 void setTuningInterval(unsigned int tuningInterval) { _autoTunerInfo.tuningInterval = tuningInterval; }
684
689 [[nodiscard]] unsigned int getNumSamples() const { return _autoTunerInfo.maxSamples; }
690
695 void setNumSamples(unsigned int numSamples) { _autoTunerInfo.maxSamples = numSamples; }
696
702 void setEarlyStoppingFactor(double earlyStoppingFactor) { _autoTunerInfo.earlyStoppingFactor = earlyStoppingFactor; }
703
708 [[nodiscard]] bool getUseLOESSSmoothening() const { return _autoTunerInfo.useLOESSSmoothening; }
709
714 void setUseLOESSSmoothening(bool useLOESSSmoothening) { _autoTunerInfo.useLOESSSmoothening = useLOESSSmoothening; }
715
720 [[nodiscard]] unsigned int getMaxEvidence() const { return _tuningStrategyFactoryInfo.maxEvidence; }
721
726 void setMaxEvidence(unsigned int maxEvidence) { _tuningStrategyFactoryInfo.maxEvidence = maxEvidence; }
727
732 [[nodiscard]] double getRelativeOptimumRange() const { return _tuningStrategyFactoryInfo.relativeOptimumRange; }
733
738 void setRelativeOptimumRange(double relativeOptimumRange) {
739 _tuningStrategyFactoryInfo.relativeOptimumRange = relativeOptimumRange;
740 }
741
746 [[nodiscard]] unsigned int getMaxTuningPhasesWithoutTest() const {
747 return _tuningStrategyFactoryInfo.maxTuningPhasesWithoutTest;
748 }
749
754 void setMaxTuningPhasesWithoutTest(unsigned int maxTuningPhasesWithoutTest) {
755 _tuningStrategyFactoryInfo.maxTuningPhasesWithoutTest = maxTuningPhasesWithoutTest;
756 }
757
763 [[nodiscard]] double getRelativeBlacklistRange() const { return _tuningStrategyFactoryInfo.relativeBlacklistRange; }
764
769 void setRelativeBlacklistRange(double relativeBlacklistRange) {
770 _tuningStrategyFactoryInfo.relativeBlacklistRange = relativeBlacklistRange;
771 }
772
778 [[nodiscard]] unsigned int getEvidenceFirstPrediction() const {
779 return _tuningStrategyFactoryInfo.minNumberOfEvidence;
780 }
781
787 void setEvidenceFirstPrediction(unsigned int evidenceFirstPrediction) {
788 _tuningStrategyFactoryInfo.minNumberOfEvidence = evidenceFirstPrediction;
789 }
790
795 [[nodiscard]] AcquisitionFunctionOption getAcquisitionFunction() const {
796 return _tuningStrategyFactoryInfo.acquisitionFunctionOption;
797 }
798
805 void setAcquisitionFunction(AcquisitionFunctionOption acqFun) {
806 _tuningStrategyFactoryInfo.acquisitionFunctionOption = acqFun;
807 }
808
813 ExtrapolationMethodOption getExtrapolationMethodOption() const {
814 return _tuningStrategyFactoryInfo.extrapolationMethodOption;
815 }
816
821 void setExtrapolationMethodOption(ExtrapolationMethodOption extrapolationMethodOption) {
822 _tuningStrategyFactoryInfo.extrapolationMethodOption = extrapolationMethodOption;
823 }
824
829 [[nodiscard]] SelectorStrategyOption getSelectorStrategy() const { return _autoTunerInfo.selectorStrategy; }
830
836 void setSelectorStrategy(SelectorStrategyOption selectorStrategy) {
837 _autoTunerInfo.selectorStrategy = selectorStrategy;
838 }
839
844 const std::set<LoadEstimatorOption> &getAllowedLoadEstimators() const { return _allowedLoadEstimators; }
845
851 void setAllowedLoadEstimators(const std::set<LoadEstimatorOption> &allowedLoadEstimators) {
852 _allowedLoadEstimators = allowedLoadEstimators;
853 }
854
859 [[nodiscard]] const std::set<ContainerOption> &getAllowedContainers() const { return _allowedContainers; }
860
866 void setAllowedContainers(const std::set<ContainerOption> &allowedContainers) {
867 _allowedContainers = allowedContainers;
868 }
869
876 [[nodiscard]] const std::set<TraversalOption> &getAllowedTraversals(
877 const InteractionTypeOption interactionType = InteractionTypeOption::pairwise) const {
878 return _allowedTraversals.at(interactionType);
879 }
880
888 void setAllowedTraversals(const std::set<TraversalOption> &allowedTraversals,
889 const InteractionTypeOption interactionType = InteractionTypeOption::pairwise) {
890 if (interactionType == InteractionTypeOption::all) {
891 for (auto iType : InteractionTypeOption::getMostOptions()) {
892 _allowedTraversals[iType] = allowedTraversals;
893 }
894 } else {
895 _allowedTraversals[interactionType] = allowedTraversals;
896 }
897 }
898
905 [[nodiscard]] const std::set<DataLayoutOption> &getAllowedDataLayouts(
906 const InteractionTypeOption interactionType = InteractionTypeOption::pairwise) const {
907 return _allowedDataLayouts.at(interactionType);
908 }
909
917 void setAllowedDataLayouts(const std::set<DataLayoutOption> &allowedDataLayouts,
918 const InteractionTypeOption interactionType = InteractionTypeOption::pairwise) {
919 if (interactionType == InteractionTypeOption::all) {
920 for (auto iType : InteractionTypeOption::getMostOptions()) {
921 _allowedDataLayouts[iType] = allowedDataLayouts;
922 }
923 } else {
924 _allowedDataLayouts[interactionType] = allowedDataLayouts;
925 }
926 }
927
934 [[nodiscard]] const std::set<Newton3Option> &getAllowedNewton3Options(
935 const InteractionTypeOption interactionType = InteractionTypeOption::pairwise) const {
936 return _allowedNewton3Options.at(interactionType);
937 }
938
946 void setAllowedNewton3Options(const std::set<Newton3Option> &allowedNewton3Options,
947 const InteractionTypeOption interactionType = InteractionTypeOption::pairwise) {
948 if (interactionType == InteractionTypeOption::all) {
949 for (auto iType : InteractionTypeOption::getMostOptions()) {
950 _allowedNewton3Options[iType] = allowedNewton3Options;
951 }
952 } else {
953 _allowedNewton3Options[interactionType] = allowedNewton3Options;
954 }
955 }
956
963 void setAllowedInteractionTypeOptions(const std::set<InteractionTypeOption> &allowedInteractionTypeOptions) {
964 _allowedInteractionTypeOptions = allowedInteractionTypeOptions;
965 }
966
971 [[nodiscard]] std::unordered_map<InteractionTypeOption::Value, std::reference_wrapper<const Configuration>>
973 std::unordered_map<InteractionTypeOption::Value, std::reference_wrapper<const Configuration>> currentConfigs;
974 currentConfigs.reserve(_autoTuners.size());
975
976 for (const auto &[type, tuner] : _autoTuners) {
977 currentConfigs.emplace(type, std::cref(tuner->getCurrentConfig()));
978 }
979 return currentConfigs;
980 }
981
986 [[nodiscard]] const std::vector<TuningStrategyOption> &getTuningStrategyOptions() const {
987 return _tuningStrategyOptions;
988 }
989
995 void setTuningStrategyOption(const std::vector<TuningStrategyOption> &tuningStrategyOptions) {
996 _tuningStrategyOptions = tuningStrategyOptions;
997 }
998
1003 [[nodiscard]] const TuningMetricOption &getTuningMetricOption() const { return _autoTunerInfo.tuningMetric; }
1004
1011 _autoTunerInfo.tuningMetric = tuningMetricOption;
1012 }
1013
1018 [[nodiscard]] const EnergySensorOption &getEnergySensorOption() const { return _autoTunerInfo.energySensor; }
1019
1025 _autoTunerInfo.energySensor = energySensorOption;
1026 }
1027
1032 void setMPITuningMaxDifferenceForBucket(double MPITuningMaxDifferenceForBucket) {
1033 _tuningStrategyFactoryInfo.mpiTuningMaxDifferenceForBucket = MPITuningMaxDifferenceForBucket;
1034 }
1035
1040 void setMPITuningWeightForMaxDensity(double MPITuningWeightForMaxDensity) {
1041 _tuningStrategyFactoryInfo.mpiTuningWeightForMaxDensity = MPITuningWeightForMaxDensity;
1042 }
1043
1044// Only define the interface for the MPI communicator if AUTOPAS_INCLUDE_MPI=ON
1045// The internal implementation will use _autopasMPICommunicator with WrapMPI regardless of AUTOPAS_INCLUDE_MPI
1046#if defined(AUTOPAS_INCLUDE_MPI)
1052 void setMPICommunicator(MPI_Comm comm) { _tuningStrategyFactoryInfo.autopasMpiCommunicator = comm; }
1053
1058 MPI_Comm getMPICommunicator() { return _tuningStrategyFactoryInfo.autopasMpiCommunicator; }
1059#endif
1060
1066 void setOutputSuffix(const std::string &suffix) { _outputSuffix = suffix; }
1067
1074 double getMeanRebuildFrequency() { return _logicHandler->getMeanRebuildFrequency(); }
1075
1080 void setUseTuningLogger(bool useTuningLogger) { _useTuningStrategyLoggerProxy = useTuningLogger; }
1081
1086 void setRuleFileName(const std::string &ruleFileName) { _tuningStrategyFactoryInfo.ruleFileName = ruleFileName; }
1087
1092 void setFuzzyRuleFileName(const std::string &fuzzyRuleFileName) {
1093 _tuningStrategyFactoryInfo.fuzzyRuleFileName = fuzzyRuleFileName;
1094 }
1095
1100 const std::string &getRuleFileName() const { return _tuningStrategyFactoryInfo.ruleFileName; }
1101
1108 void setSortingThreshold(size_t sortingThreshold) { _sortingThreshold = sortingThreshold; }
1109
1114 size_t getSortingThreshold() const { return _sortingThreshold; }
1115
1116 private:
1118
1119 const autopas::ParticleContainerInterface<Particle_T> &getContainer() const;
1123 TuningStrategyFactoryInfo _tuningStrategyFactoryInfo{};
1127 AutoTunerInfo _autoTunerInfo{};
1131 LogicHandlerInfo _logicHandlerInfo{};
1135 bool _useTuningStrategyLoggerProxy{false};
1140 unsigned int _verletRebuildFrequency{100};
1145 std::vector<TuningStrategyOption> _tuningStrategyOptions{};
1150 std::set<ContainerOption> _allowedContainers{ContainerOption::getMostOptions()};
1155 std::unordered_map<InteractionTypeOption::Value, std::set<TraversalOption>> _allowedTraversals{
1156 {InteractionTypeOption::pairwise, TraversalOption::getMostPairwiseOptions()},
1157 {InteractionTypeOption::triwise, TraversalOption::getMostTriwiseOptions()}};
1162 std::unordered_map<InteractionTypeOption::Value, std::set<DataLayoutOption>> _allowedDataLayouts{
1163 {InteractionTypeOption::pairwise, DataLayoutOption::getMostOptions()},
1164 {InteractionTypeOption::triwise, DataLayoutOption::getMostOptions()}};
1168 std::unordered_map<InteractionTypeOption::Value, std::set<Newton3Option>> _allowedNewton3Options{
1169 {InteractionTypeOption::pairwise, Newton3Option::getMostOptions()},
1170 {InteractionTypeOption::triwise, Newton3Option::getMostOptions()}};
1175 std::set<InteractionTypeOption> _allowedInteractionTypeOptions{InteractionTypeOption::pairwise};
1179 std::unique_ptr<NumberSet<double>> _allowedCellSizeFactors{
1180 std::make_unique<NumberSetFinite<double>>(std::set<double>({1.}))};
1185 std::set<LoadEstimatorOption> _allowedLoadEstimators{LoadEstimatorOption::getAllOptions()};
1189 std::unique_ptr<autopas::LogicHandler<Particle_T>> _logicHandler;
1190
1195 std::unordered_map<InteractionTypeOption::Value, std::unique_ptr<autopas::AutoTuner>> _autoTuners;
1196
1200 bool _externalMPICommunicator{false};
1205 std::string _outputSuffix{""};
1209 size_t _sortingThreshold{8};
1220 template <class F>
1221 void addParticlesAux(size_t numParticlesToAdd, size_t numHalosToAdd, size_t collectionSize, F loopBody);
1222}; // class AutoPas
1223} // namespace autopas
The AutoPas class is intended to be the main point of Interaction for the user.
Definition: AutoPasDecl.h:46
void setMaxEvidence(unsigned int maxEvidence)
Set maximum number of evidence for tuning.
Definition: AutoPasDecl.h:726
void setNumSamples(unsigned int numSamples)
Set number of samples taken per configuration during the tuning.
Definition: AutoPasDecl.h:695
void setAllowedNewton3Options(const std::set< Newton3Option > &allowedNewton3Options, const InteractionTypeOption interactionType=InteractionTypeOption::pairwise)
Set the list of allowed newton 3 options.
Definition: AutoPasDecl.h:946
void setSelectorStrategy(SelectorStrategyOption selectorStrategy)
Set the strategy of how to select a performance value for a piece of evidence from multiple time meas...
Definition: AutoPasDecl.h:836
void setFuzzyRuleFileName(const std::string &fuzzyRuleFileName)
Set fuzzy rule file name for the RuleBasedTuning.
Definition: AutoPasDecl.h:1092
unsigned int getTuningInterval() const
Get tuning interval.
Definition: AutoPasDecl.h:677
unsigned int getMaxTuningPhasesWithoutTest() const
Get the maximum number of tuning phases before a configuration is certainly tested again.
Definition: AutoPasDecl.h:746
const std::set< TraversalOption > & getAllowedTraversals(const InteractionTypeOption interactionType=InteractionTypeOption::pairwise) const
Get the list of allowed traversals.
Definition: AutoPasDecl.h:876
std::vector< Particle_T > updateContainer()
Updates the container.
Definition: AutoPasImpl.h:224
void setTuningMetricOption(TuningMetricOption tuningMetricOption)
Setter for the tuning metric option.
Definition: AutoPasDecl.h:1010
void reduceInRegion(Lambda reduceLambda, A &result, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo) const
Execute code on all particles in a certain region as defined by a lambda function.
Definition: AutoPasDecl.h:531
autopas::ContainerIterator< Particle_T, false, true > RegionConstIteratorT
Define the const region iterator type for ease of use.
Definition: AutoPasDecl.h:75
const std::array< double, 3 > & getBoxMin() const
Get the lower corner of the container without the halo.
Definition: AutoPasImpl.h:339
unsigned int getNumSamples() const
Get number of samples taken per configuration during the tuning.
Definition: AutoPasDecl.h:689
unsigned int getMaxEvidence() const
Get maximum number of evidence for tuning.
Definition: AutoPasDecl.h:720
void setBoxMax(const std::array< double, 3 > &boxMax)
Set coordinates of the upper corner of the domain.
Definition: AutoPasDecl.h:587
void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo) const
Reduce properties of particles as defined by a lambda function.
Definition: AutoPasDecl.h:366
bool searchSpaceIsTrivial()
get the bool value indicating if the search space is trivial (not more than one configuration to test...
Definition: AutoPasImpl.h:359
void setUseTuningLogger(bool useTuningLogger)
Set if the tuning information should be logged to a file.
Definition: AutoPasDecl.h:1080
unsigned int getVerletRebuildFrequency() const
Get Verlet rebuild frequency.
Definition: AutoPasDecl.h:652
ConstIteratorT cbegin(IteratorBehavior behavior=IteratorBehavior::ownedOrHalo) const
Iterate over all particles by using for(auto iter = autoPas.begin(); iter.isValid(); ++iter)
Definition: AutoPasDecl.h:374
void addHaloParticles(Collection &&particles)
Adds all halo particles from the collection to the container.
Definition: AutoPasImpl.h:256
void reserve(size_t numParticles)
Reserve memory for a given number of particles in the container and logic layers.
Definition: AutoPasImpl.h:169
const std::string & getRuleFileName() const
Get the name / path of the rule file for the RuleBasedTuning.
Definition: AutoPasDecl.h:1100
void setRuleFileName(const std::string &ruleFileName)
Set rule file name for the RuleBasedTuning.
Definition: AutoPasDecl.h:1086
ExtrapolationMethodOption getExtrapolationMethodOption() const
Get extrapolation method for the prediction of the configuration performance.
Definition: AutoPasDecl.h:813
const std::set< DataLayoutOption > & getAllowedDataLayouts(const InteractionTypeOption interactionType=InteractionTypeOption::pairwise) const
Get the list of allowed data layouts.
Definition: AutoPasDecl.h:905
SelectorStrategyOption getSelectorStrategy() const
Get the selector configuration strategy.
Definition: AutoPasDecl.h:829
unsigned int getVerletClusterSize() const
Get Verlet cluster size.
Definition: AutoPasDecl.h:665
void addHaloParticlesIf(Collection &&particles, F predicate)
Adds all halo particles for which predicate(particle) == true to the container.
Definition: AutoPasImpl.h:262
void addParticles(Collection &&particles)
Adds all particles from the collection to the container.
Definition: AutoPasImpl.h:197
void setVerletSkin(double verletSkin)
Set length added to the cutoff for the Verlet lists' skin per timestep.
Definition: AutoPasDecl.h:639
void setOutputSuffix(const std::string &suffix)
Suffix for all output files produced by this instance of AutoPas, e.g.
Definition: AutoPasDecl.h:1066
void setMaxTuningPhasesWithoutTest(unsigned int maxTuningPhasesWithoutTest)
Set the maximum number of tuning phases before a configuration is certainly tested again.
Definition: AutoPasDecl.h:754
void setEnergySensorOption(EnergySensorOption energySensorOption)
Setter for the energy sensor.
Definition: AutoPasDecl.h:1024
unsigned long getContainerType() const
Returns the type of the currently used container.
Definition: AutoPasImpl.h:334
void forEach(Lambda forEachLambda, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo)
Execute code on all particles as defined by a lambda function.
Definition: AutoPasDecl.h:310
const std::set< ContainerOption > & getAllowedContainers() const
Get the list of allowed containers.
Definition: AutoPasDecl.h:859
void deleteParticle(IteratorT &iter)
Deletes the particle behind the current iterator position and leaves the container in a valid state.
Definition: AutoPasImpl.h:288
void setAcquisitionFunction(AcquisitionFunctionOption acqFun)
Set acquisition function for tuning.
Definition: AutoPasDecl.h:805
void setEarlyStoppingFactor(double earlyStoppingFactor)
Set the earlyStoppingFactor for the auto tuner.
Definition: AutoPasDecl.h:702
void setMPITuningWeightForMaxDensity(double MPITuningWeightForMaxDensity)
Setter for the maxDensity-Weight in calculation for bucket distribution.
Definition: AutoPasDecl.h:1040
void reduceParallel(Lambda reduceLambda, A &result, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo) const
Reduce properties of particles as defined by a lambda function.
Definition: AutoPasDecl.h:343
void reduceInRegion(Lambda reduceLambda, A &result, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo)
Execute code on all particles in a certain region as defined by a lambda function.
Definition: AutoPasDecl.h:518
void setEvidenceFirstPrediction(unsigned int evidenceFirstPrediction)
Set the number of tests that need to have happened for a configuration until the first predictions ar...
Definition: AutoPasDecl.h:787
void forEachParallel(Lambda forEachLambda, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo)
execute code on all particles in parallel as defined by a lambda function
Definition: AutoPasDecl.h:288
const EnergySensorOption & getEnergySensorOption() const
Getter for the energy sensor.
Definition: AutoPasDecl.h:1018
double getRelativeOptimumRange() const
Get the range for the optimum in which has to be to be tested.
Definition: AutoPasDecl.h:732
void finalize()
Free the AutoPas MPI communicator.
Definition: AutoPasDecl.h:120
void setCellSizeFactor(double cellSizeFactor)
Set allowed cell size factors to one element (only relevant for LinkedCells, VerletLists and VerletLi...
Definition: AutoPasDecl.h:628
void setRelativeBlacklistRange(double relativeBlacklistRange)
Set the range of the configurations that are not going to be blacklisted.
Definition: AutoPasDecl.h:769
size_t getSortingThreshold() const
Get the sorting-threshold for traversals that use the CellFunctor.
Definition: AutoPasDecl.h:1114
unsigned int getEvidenceFirstPrediction() const
Get the number of tests that need to have happened for a configuration until the first predictions ar...
Definition: AutoPasDecl.h:778
void addParticlesIf(Collection &&particles, F predicate)
Adds all particles for which predicate(particle) == true to the container.
Definition: AutoPasImpl.h:203
double getRelativeBlacklistRange() const
For Predictive tuning: Get the relative cutoff for configurations to be blacklisted.
Definition: AutoPasDecl.h:763
void setTuningStrategyOption(const std::vector< TuningStrategyOption > &tuningStrategyOptions)
Setter for the tuning strategy option.
Definition: AutoPasDecl.h:995
autopas::ContainerIterator< Particle_T, true, true > RegionIteratorT
Define the region iterator type for ease of use.
Definition: AutoPasDecl.h:69
void forEachParallel(Lambda forEachLambda, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo) const
execute code on all particles in parallel as defined by a lambda function
Definition: AutoPasDecl.h:298
std::vector< Particle_T > resizeBox(const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax)
Resizes the bounding box of the AutoPas object.
Definition: AutoPasImpl.h:229
void setMPITuningMaxDifferenceForBucket(double MPITuningMaxDifferenceForBucket)
Setter for the maximal Difference for the bucket distribution.
Definition: AutoPasDecl.h:1032
const TuningMetricOption & getTuningMetricOption() const
Getter for the tuning metric option.
Definition: AutoPasDecl.h:1003
void setAllowedCellSizeFactors(const NumberSet< double > &allowedCellSizeFactors)
Set allowed cell size factors (only relevant for LinkedCells, VerletLists and VerletListsCells).
Definition: AutoPasDecl.h:616
void forEachInRegion(Lambda forEachLambda, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo) const
Execute code on all particles in a certain region as defined by a lambda function.
Definition: AutoPasDecl.h:464
void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo)
Reduce properties of particles as defined by a lambda function.
Definition: AutoPasDecl.h:357
void setAllowedLoadEstimators(const std::set< LoadEstimatorOption > &allowedLoadEstimators)
Set the list of allowed load estimation algorithms.
Definition: AutoPasDecl.h:851
double getVerletSkin()
Function to iterate over all pairs of particles in the container.
Definition: AutoPasDecl.h:544
void setAllowedTraversals(const std::set< TraversalOption > &allowedTraversals, const InteractionTypeOption interactionType=InteractionTypeOption::pairwise)
Set the list of allowed traversals.
Definition: AutoPasDecl.h:888
void reduceParallel(Lambda reduceLambda, A &result, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo)
Reduce properties of particles in parallel as defined by a lambda function.
Definition: AutoPasDecl.h:333
AcquisitionFunctionOption getAcquisitionFunction() const
Get acquisition function used for tuning.
Definition: AutoPasDecl.h:795
void setVerletClusterSize(unsigned int verletClusterSize)
Set Verlet cluster size.
Definition: AutoPasDecl.h:671
void forEach(Lambda forEachLambda, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo) const
Execute code on all particles as defined by a lambda function.
Definition: AutoPasDecl.h:319
const std::array< double, 3 > & getBoxMax() const
Get the upper corner of the container without the halo.
Definition: AutoPasImpl.h:344
const NumberSet< double > & getAllowedCellSizeFactors() const
Get allowed cell size factors (only relevant for LinkedCells, VerletLists and VerletListsCells).
Definition: AutoPasDecl.h:610
void addHaloParticle(const Particle_T &haloParticle)
Adds a particle to the container that lies in the halo region of the container.
Definition: AutoPasImpl.h:250
void setAllowedDataLayouts(const std::set< DataLayoutOption > &allowedDataLayouts, const InteractionTypeOption interactionType=InteractionTypeOption::pairwise)
Set the list of allowed data layouts.
Definition: AutoPasDecl.h:917
void setSortingThreshold(size_t sortingThreshold)
Set the sorting-threshold for traversals that use the CellFunctor If the sum of the number of particl...
Definition: AutoPasDecl.h:1108
Particle_T ParticleType
Particle type to be accessible after initialization.
Definition: AutoPasDecl.h:51
autopas::ContainerIterator< Particle_T, true, false > IteratorT
Define the iterator type for ease of use.
Definition: AutoPasDecl.h:57
RegionIteratorT getRegionIterator(const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo)
Iterate over all particles in a specified region.
Definition: AutoPasImpl.h:321
void reduceInRegionParallel(Lambda reduceLambda, A &result, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo)
Execute code on all particles in a certain region in parallel as defined by a lambda function.
Definition: AutoPasDecl.h:484
double getMeanRebuildFrequency()
Getter for the mean rebuild frequency.
Definition: AutoPasDecl.h:1074
AutoPas & operator=(AutoPas &&other) noexcept
Move assignment operator.
Definition: AutoPasImpl.h:59
void setExtrapolationMethodOption(ExtrapolationMethodOption extrapolationMethodOption)
Set extrapolation method for the prediction of the configuration performance.
Definition: AutoPasDecl.h:821
void setBoxMin(const std::array< double, 3 > &boxMin)
Set coordinates of the lower corner of the domain.
Definition: AutoPasDecl.h:581
void init()
Initialize AutoPas.
Definition: AutoPasImpl.h:66
const std::vector< TuningStrategyOption > & getTuningStrategyOptions() const
Getter for the tuning strategy option.
Definition: AutoPasDecl.h:986
autopas::ContainerIterator< Particle_T, false, false > ConstIteratorT
Define the const iterator type for ease of use.
Definition: AutoPasDecl.h:63
void forceRetune()
Force the internal tuner to enter a new tuning phase upon the next call to computeInteractions().
Definition: AutoPasImpl.h:243
void setAllowedInteractionTypeOptions(const std::set< InteractionTypeOption > &allowedInteractionTypeOptions)
Set the list of allowed interaction types.
Definition: AutoPasDecl.h:963
void setVerletRebuildFrequency(unsigned int verletRebuildFrequency)
Set Verlet rebuild frequency.
Definition: AutoPasDecl.h:658
void setDeltaT(double deltaT)
Set time step of the simulation.
Definition: AutoPasDecl.h:646
void forEachInRegion(Lambda forEachLambda, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo)
Execute code on all particles in a certain region as defined by a lambda function.
Definition: AutoPasDecl.h:451
const std::set< LoadEstimatorOption > & getAllowedLoadEstimators() const
Get the list of allowed load estimation algorithms.
Definition: AutoPasDecl.h:844
void setUseLOESSSmoothening(bool useLOESSSmoothening)
Set flag for whether a LOESS-based smoothening is used.
Definition: AutoPasDecl.h:714
size_t getNumberOfParticles(IteratorBehavior behavior=IteratorBehavior::owned) const
Returns the number of particles in this container.
Definition: AutoPasImpl.h:151
void reduceInRegionParallel(Lambda reduceLambda, A &result, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo) const
Execute code on all particles in a certain region as defined by a lambda function.
Definition: AutoPasDecl.h:498
void deleteAllParticles()
Deletes all particles.
Definition: AutoPasImpl.h:283
bool computeInteractions(Functor *f)
Function to iterate over all inter-particle interactions in the container This function only handles ...
Definition: AutoPasImpl.h:128
void forEachInRegionParallel(Lambda forEachLambda, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo)
Execute code on all particles in a certain region in parallel as defined by a lambda function.
Definition: AutoPasDecl.h:419
void addParticle(const Particle_T &p)
Adds a particle to the container.
Definition: AutoPasImpl.h:191
void forEachInRegionParallel(Lambda forEachLambda, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo) const
Execute code on all particles in a certain region in parallel as defined by a lambda function.
Definition: AutoPasDecl.h:433
bool getUseLOESSSmoothening() const
Get flag for whether a LOESS-based smoothening is used.
Definition: AutoPasDecl.h:708
double getCutoff() const
Get cutoff radius.
Definition: AutoPasDecl.h:593
IteratorT begin(IteratorBehavior behavior=IteratorBehavior::ownedOrHalo)
Iterate over all particles by using for(auto iter = autoPas.begin(); iter.isValid(); ++iter)
Definition: AutoPasImpl.h:311
std::unordered_map< InteractionTypeOption::Value, std::reference_wrapper< const Configuration > > getCurrentConfigs() const
Getter for the currently selected configuration.
Definition: AutoPasDecl.h:972
void setRelativeOptimumRange(double relativeOptimumRange)
Set the range for the optimum in which has to be to be tested.
Definition: AutoPasDecl.h:738
void setAllowedContainers(const std::set< ContainerOption > &allowedContainers)
Set the list of allowed containers.
Definition: AutoPasDecl.h:866
void setCutoff(double cutoff)
Set cutoff radius.
Definition: AutoPasDecl.h:599
void setTuningInterval(unsigned int tuningInterval)
Set tuning interval.
Definition: AutoPasDecl.h:683
constexpr bool end() const
Dummy to make range-based for loops work.
Definition: AutoPasDecl.h:386
const std::set< Newton3Option > & getAllowedNewton3Options(const InteractionTypeOption interactionType=InteractionTypeOption::pairwise) const
Get the list of allowed newton 3 options.
Definition: AutoPasDecl.h:934
Public iterator class that iterates over a particle container and additional vectors (which are typic...
Definition: ContainerIterator.h:93
Class representing the different energy sensor options.
Definition: EnergySensorOption.h:19
Functor base class.
Definition: Functor.h:40
double verletSkin
Length added to the cutoff for the Verlet lists' skin.
Definition: LogicHandlerInfo.h:33
std::array< double, 3 > boxMax
Upper corner of the container without halo.
Definition: LogicHandlerInfo.h:25
double deltaT
Time step used in the simulation.
Definition: LogicHandlerInfo.h:46
unsigned int verletClusterSize
Number of particles in a cluster to use in VCL.
Definition: LogicHandlerInfo.h:37
double cutoff
Cutoff radius to be used in this simulation.
Definition: LogicHandlerInfo.h:29
std::array< double, 3 > boxMin
Lower corner of the container without halo.
Definition: LogicHandlerInfo.h:21
The LogicHandler takes care of the containers s.t.
Definition: LogicHandler.h:45
Virtual class describing a finite or infinite set of numbers.
Definition: NumberSet.h:22
virtual Number getMin() const =0
Get the smallest number in the set.
virtual std::unique_ptr< NumberSet > clone() const =0
Create a copy of a NumberSet.
The ParticleContainerInterface class provides a basic interface for all Containers within AutoPas.
Definition: ParticleContainerInterface.h:37
Class representing the load estimator choices.
Definition: TuningMetricOption.h:18
static void exception(const Exception e)
Handle an exception derived by std::exception.
Definition: ExceptionHandler.h:63
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32
decltype(auto) withStaticContainerType(ParticleContainerInterface< Particle_T > &container, FunctionType &&function)
Will execute the passed function body with the static container type of container.
Definition: StaticContainerSelector.h:35
int AutoPas_MPI_Comm_free(AutoPas_MPI_Comm *comm)
Wrapper for MPI_Comm_free.
Definition: WrapMPI.h:820
unsigned int tuningInterval
Number of time steps after which the auto-tuner shall reevaluate the optimum.
Definition: AutoTunerInfo.h:29
SelectorStrategyOption selectorStrategy
Strategy how to select the optimum from the collected samples.
Definition: AutoTunerInfo.h:21
unsigned int maxSamples
Number of samples that shall be collected per combination.
Definition: AutoTunerInfo.h:33
bool useLOESSSmoothening
Flag for whether LOESS Smoothening is used to smoothen the tuning results.
Definition: AutoTunerInfo.h:46
TuningMetricOption tuningMetric
Metric used to rate configurations (time or energy).
Definition: AutoTunerInfo.h:25
double earlyStoppingFactor
EarlyStoppingFactor for the auto-tuner.
Definition: AutoTunerInfo.h:38
EnergySensorOption energySensor
Used energy sensor of energy metric selected.
Definition: AutoTunerInfo.h:42
Helper struct encapsulating most information needed to build TuningStrategies by the TuningStrategyFa...
Definition: TuningStrategyFactoryInfo.h:22
double mpiTuningWeightForMaxDensity
Weight for maxDensity in the calculation for bucket distribution.
Definition: TuningStrategyFactoryInfo.h:83
double mpiTuningMaxDifferenceForBucket
Maximum absolute difference in similarity metric for two ranks to fall in the same bucket.
Definition: TuningStrategyFactoryInfo.h:79
std::string ruleFileName
The name and path of the file where the rules are stored.
Definition: TuningStrategyFactoryInfo.h:62
unsigned int maxEvidence
Strategies that don't converge (or not quickly enough) can be told to limit the number of evidence to...
Definition: TuningStrategyFactoryInfo.h:27
AcquisitionFunctionOption acquisitionFunctionOption
Function used to predict informational gain.
Definition: TuningStrategyFactoryInfo.h:56
std::string fuzzyRuleFileName
The name and path of the file where the rules are stored.
Definition: TuningStrategyFactoryInfo.h:68
unsigned int maxTuningPhasesWithoutTest
If a config is not tested for this number of tuning phases test it again to make predictions more rel...
Definition: TuningStrategyFactoryInfo.h:40
double relativeBlacklistRange
Any configuration that is slower than the fastest times this factor will be blacklisted.
Definition: TuningStrategyFactoryInfo.h:50
ExtrapolationMethodOption extrapolationMethodOption
Function option used for extrapolating performance from observed evidence.
Definition: TuningStrategyFactoryInfo.h:32
double relativeOptimumRange
Factor of the range of the optimal configurations for the optimalSearchSpace.
Definition: TuningStrategyFactoryInfo.h:36
unsigned int minNumberOfEvidence
The number of evidence that have to be collected until the first prediction can be made.
Definition: TuningStrategyFactoryInfo.h:44
AutoPas_MPI_Comm autopasMpiCommunicator
MPI Communicator used within AutoPas.
Definition: TuningStrategyFactoryInfo.h:87