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
44template <class Particle_T>
45class AutoPas {
46 public:
50 using ParticleType = Particle_T;
51
57
63
69
75
80 explicit AutoPas(std::ostream &logOutputStream = std::cout);
81
87 explicit AutoPas(const std::string &logFileName);
88
89 ~AutoPas();
90
96 AutoPas &operator=(AutoPas &&other) noexcept;
97
106 void init();
107
114 std::vector<Particle_T> resizeBox(const std::array<double, 3> &boxMin, const std::array<double, 3> &boxMax);
115
119 void forceRetune();
120
126 void finalize() {
127 if (not _externalMPICommunicator) {
128 AutoPas_MPI_Comm_free(&_tuningStrategyFactoryInfo.autopasMpiCommunicator);
129 }
130 }
131
138 [[nodiscard]] std::vector<Particle_T> updateContainer();
139
149 void reserve(size_t numParticles);
150
160 void reserve(size_t numParticles, size_t numHaloParticles);
161
170 void addParticle(const Particle_T &p);
171
179 template <class Collection>
180 void addParticles(Collection &&particles);
181
191 template <class Collection, class F>
192 void addParticlesIf(Collection &&particles, F predicate);
193
201 void addHaloParticle(const Particle_T &haloParticle);
202
210 template <class Collection>
211 void addHaloParticles(Collection &&particles);
212
222 template <class Collection, class F>
223 void addHaloParticlesIf(Collection &&particles, F predicate);
224
229 void deleteAllParticles();
230
239 void deleteParticle(IteratorT &iter);
240
247
260 bool deleteParticle(Particle_T &particle);
261
268 template <class Functor>
270
278 IteratorT begin(IteratorBehavior behavior = IteratorBehavior::ownedOrHalo);
279
284 ConstIteratorT begin(IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const;
285
293 template <typename Lambda>
294 void forEachParallel(Lambda forEachLambda, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
295 // TODO lgaertner: parallelize with kokkos integration
296 withStaticContainerType(getContainer(), [&](auto &container) { container.forEach(forEachLambda, behavior); });
297 }
298
303 template <typename Lambda>
304 void forEachParallel(Lambda forEachLambda, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
305 // TODO lgaertner: parallelize with kokkos integration
306 withStaticContainerType(getContainer(), [&](auto &container) { container.forEach(forEachLambda, behavior); });
307 }
308
315 template <typename Lambda>
316 void forEach(Lambda forEachLambda, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
317 withStaticContainerType(getContainer(), [&](auto &container) { container.forEach(forEachLambda, behavior); });
318 }
319
324 template <typename Lambda>
325 void forEach(Lambda forEachLambda, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
326 withStaticContainerType(getContainer(), [&](auto &container) { container.forEach(forEachLambda, behavior); });
327 }
328
338 template <typename Lambda, typename A>
339 void reduceParallel(Lambda reduceLambda, A &result, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
340 // TODO lgaertner: parallelize with kokkos integration
341 withStaticContainerType(getContainer(), [&](auto &container) { container.reduce(reduceLambda, result, behavior); });
342 }
343
348 template <typename Lambda, typename A>
349 void reduceParallel(Lambda reduceLambda, A &result, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
350 // TODO lgaertner: parallelize with kokkos integration
351 withStaticContainerType(getContainer(), [&](auto &container) { container.reduce(reduceLambda, result, behavior); });
352 }
353
362 template <typename Lambda, typename A>
363 void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
364 withStaticContainerType(getContainer(), [&](auto &container) { container.reduce(reduceLambda, result, behavior); });
365 }
366
371 template <typename Lambda, typename A>
372 void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
373 withStaticContainerType(getContainer(), [&](auto &container) { container.reduce(reduceLambda, result, behavior); });
374 }
375
380 ConstIteratorT cbegin(IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const { return begin(behavior); }
381
392 [[nodiscard]] constexpr bool end() const { return false; }
393
405 RegionIteratorT getRegionIterator(const std::array<double, 3> &lowerCorner, const std::array<double, 3> &higherCorner,
406 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo);
411 RegionConstIteratorT getRegionIterator(const std::array<double, 3> &lowerCorner,
412 const std::array<double, 3> &higherCorner,
413 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const;
414
424 template <typename Lambda>
425 void forEachInRegionParallel(Lambda forEachLambda, const std::array<double, 3> &lowerCorner,
426 const std::array<double, 3> &higherCorner,
427 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
428 // TODO (lgaertner): parallelize with kokkos integration
429 withStaticContainerType(getContainer(), [&](auto &container) {
430 container.forEachInRegion(forEachLambda, lowerCorner, higherCorner, behavior);
431 });
432 }
433
438 template <typename Lambda>
439 void forEachInRegionParallel(Lambda forEachLambda, const std::array<double, 3> &lowerCorner,
440 const std::array<double, 3> &higherCorner,
441 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
442 // TODO (lgaertner): parallelize with kokkos integration
443 withStaticContainerType(getContainer(), [&](auto &container) {
444 container.forEachInRegion(forEachLambda, lowerCorner, higherCorner, behavior);
445 });
446 }
447
456 template <typename Lambda>
457 void forEachInRegion(Lambda forEachLambda, const std::array<double, 3> &lowerCorner,
458 const std::array<double, 3> &higherCorner,
459 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
460 withStaticContainerType(getContainer(), [&](auto &container) {
461 container.forEachInRegion(forEachLambda, lowerCorner, higherCorner, behavior);
462 });
463 }
464
469 template <typename Lambda>
470 void forEachInRegion(Lambda forEachLambda, const std::array<double, 3> &lowerCorner,
471 const std::array<double, 3> &higherCorner,
472 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
473 withStaticContainerType(getContainer(), [&](auto &container) {
474 container.forEachInRegion(forEachLambda, lowerCorner, higherCorner, behavior);
475 });
476 }
477
489 template <typename Lambda, typename A>
490 void reduceInRegionParallel(Lambda reduceLambda, A &result, const std::array<double, 3> &lowerCorner,
491 const std::array<double, 3> &higherCorner,
492 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
493 // TODO lgaertner: parallelize with kokkos integration
494 withStaticContainerType(getContainer(), [&](auto &container) {
495 container.reduceInRegion(reduceLambda, result, lowerCorner, higherCorner, behavior);
496 });
497 }
498
503 template <typename Lambda, typename A>
504 void reduceInRegionParallel(Lambda reduceLambda, A &result, const std::array<double, 3> &lowerCorner,
505 const std::array<double, 3> &higherCorner,
506 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
507 // TODO lgaertner: parallelize with kokkos integration
508 withStaticContainerType(getContainer(), [&](auto &container) {
509 container.reduceInRegion(reduceLambda, result, lowerCorner, higherCorner, behavior);
510 });
511 }
512
523 template <typename Lambda, typename A>
524 void reduceInRegion(Lambda reduceLambda, A &result, const std::array<double, 3> &lowerCorner,
525 const std::array<double, 3> &higherCorner,
526 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) {
527 withStaticContainerType(getContainer(), [&](auto &container) {
528 container.reduceInRegion(reduceLambda, result, lowerCorner, higherCorner, behavior);
529 });
530 }
531
536 template <typename Lambda, typename A>
537 void reduceInRegion(Lambda reduceLambda, A &result, const std::array<double, 3> &lowerCorner,
538 const std::array<double, 3> &higherCorner,
539 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo) const {
540 withStaticContainerType(getContainer(), [&](auto &container) {
541 container.reduceInRegion(reduceLambda, result, lowerCorner, higherCorner, behavior);
542 });
543 }
544
550 double getVerletSkin() { return _logicHandlerInfo.verletSkin; };
551
557 [[nodiscard]] size_t getNumberOfParticles(IteratorBehavior behavior = IteratorBehavior::owned) const;
558
563 [[nodiscard]] unsigned long getContainerType() const;
564
569 [[nodiscard]] const std::array<double, 3> &getBoxMin() const;
570
575 [[nodiscard]] const std::array<double, 3> &getBoxMax() const;
576
581 [[nodiscard]] bool searchSpaceIsTrivial();
582
587 void setBoxMin(const std::array<double, 3> &boxMin) { _logicHandlerInfo.boxMin = boxMin; }
588
593 void setBoxMax(const std::array<double, 3> &boxMax) { _logicHandlerInfo.boxMax = boxMax; }
594
599 [[nodiscard]] double getCutoff() const { return _logicHandlerInfo.cutoff; }
600
605 void setCutoff(double cutoff) {
606 if (cutoff <= 0.0) {
607 utils::ExceptionHandler::exception("Error: Cutoff has to be positive {} <= 0.0!", cutoff);
608 }
609 _logicHandlerInfo.cutoff = cutoff;
610 }
611
616 [[nodiscard]] const NumberSet<double> &getAllowedCellSizeFactors() const { return *_allowedCellSizeFactors; }
617
622 void setAllowedCellSizeFactors(const NumberSet<double> &allowedCellSizeFactors) {
623 if (allowedCellSizeFactors.getMin() <= 0.0) {
624 utils::ExceptionHandler::exception("Error: minimum cell size factor has to be positive {} <= 0.0!",
625 allowedCellSizeFactors.getMin());
626 }
627 _allowedCellSizeFactors = std::move(allowedCellSizeFactors.clone());
628 }
629
634 void setCellSizeFactor(double cellSizeFactor) {
635 if (cellSizeFactor <= 0.0) {
636 utils::ExceptionHandler::exception("Error: cell size factor has to be positive! {}<= 0.0!", cellSizeFactor);
637 }
638 _allowedCellSizeFactors = std::make_unique<NumberSetFinite<double>>(std::set<double>{cellSizeFactor});
639 }
640
645 void setVerletSkin(double verletSkin) { _logicHandlerInfo.verletSkin = verletSkin; }
646
652 void setDeltaT(double deltaT) { _logicHandlerInfo.deltaT = deltaT; }
653
658 [[nodiscard]] unsigned int getVerletRebuildFrequency() const { return _verletRebuildFrequency; }
659
664 void setVerletRebuildFrequency(unsigned int verletRebuildFrequency) {
665 _verletRebuildFrequency = verletRebuildFrequency;
666 }
671 [[nodiscard]] unsigned int getVerletClusterSize() const { return _logicHandlerInfo.verletClusterSize; }
672
677 void setVerletClusterSize(unsigned int verletClusterSize) { _logicHandlerInfo.verletClusterSize = verletClusterSize; }
678
683 [[nodiscard]] unsigned int getTuningInterval() const { return _autoTunerInfo.tuningInterval; }
684
689 void setTuningInterval(unsigned int tuningInterval) { _autoTunerInfo.tuningInterval = tuningInterval; }
690
695 [[nodiscard]] unsigned int getNumSamples() const { return _autoTunerInfo.maxSamples; }
696
701 void setNumSamples(unsigned int numSamples) { _autoTunerInfo.maxSamples = numSamples; }
702
708 void setEarlyStoppingFactor(double earlyStoppingFactor) { _autoTunerInfo.earlyStoppingFactor = earlyStoppingFactor; }
709
714 [[nodiscard]] bool getUseLOESSSmoothening() const { return _autoTunerInfo.useLOESSSmoothening; }
715
720 void setUseLOESSSmoothening(bool useLOESSSmoothening) { _autoTunerInfo.useLOESSSmoothening = useLOESSSmoothening; }
721
726 [[nodiscard]] unsigned int getMaxEvidence() const { return _tuningStrategyFactoryInfo.maxEvidence; }
727
732 void setMaxEvidence(unsigned int maxEvidence) { _tuningStrategyFactoryInfo.maxEvidence = maxEvidence; }
733
738 [[nodiscard]] double getRelativeOptimumRange() const { return _tuningStrategyFactoryInfo.relativeOptimumRange; }
739
744 void setRelativeOptimumRange(double relativeOptimumRange) {
745 _tuningStrategyFactoryInfo.relativeOptimumRange = relativeOptimumRange;
746 }
747
752 [[nodiscard]] unsigned int getMaxTuningPhasesWithoutTest() const {
753 return _tuningStrategyFactoryInfo.maxTuningPhasesWithoutTest;
754 }
755
760 void setMaxTuningPhasesWithoutTest(unsigned int maxTuningPhasesWithoutTest) {
761 _tuningStrategyFactoryInfo.maxTuningPhasesWithoutTest = maxTuningPhasesWithoutTest;
762 }
763
769 [[nodiscard]] double getRelativeBlacklistRange() const { return _tuningStrategyFactoryInfo.relativeBlacklistRange; }
770
775 void setRelativeBlacklistRange(double relativeBlacklistRange) {
776 _tuningStrategyFactoryInfo.relativeBlacklistRange = relativeBlacklistRange;
777 }
778
784 [[nodiscard]] unsigned int getEvidenceFirstPrediction() const {
785 return _tuningStrategyFactoryInfo.minNumberOfEvidence;
786 }
787
793 void setEvidenceFirstPrediction(unsigned int evidenceFirstPrediction) {
794 _tuningStrategyFactoryInfo.minNumberOfEvidence = evidenceFirstPrediction;
795 }
796
801 [[nodiscard]] AcquisitionFunctionOption getAcquisitionFunction() const {
802 return _tuningStrategyFactoryInfo.acquisitionFunctionOption;
803 }
804
811 void setAcquisitionFunction(AcquisitionFunctionOption acqFun) {
812 _tuningStrategyFactoryInfo.acquisitionFunctionOption = acqFun;
813 }
814
819 ExtrapolationMethodOption getExtrapolationMethodOption() const {
820 return _tuningStrategyFactoryInfo.extrapolationMethodOption;
821 }
822
827 void setExtrapolationMethodOption(ExtrapolationMethodOption extrapolationMethodOption) {
828 _tuningStrategyFactoryInfo.extrapolationMethodOption = extrapolationMethodOption;
829 }
830
835 [[nodiscard]] SelectorStrategyOption getSelectorStrategy() const { return _autoTunerInfo.selectorStrategy; }
836
842 void setSelectorStrategy(SelectorStrategyOption selectorStrategy) {
843 _autoTunerInfo.selectorStrategy = selectorStrategy;
844 }
845
850 const std::set<LoadEstimatorOption> &getAllowedLoadEstimators() const { return _allowedLoadEstimators; }
851
857 void setAllowedLoadEstimators(const std::set<LoadEstimatorOption> &allowedLoadEstimators) {
858 _allowedLoadEstimators = allowedLoadEstimators;
859 }
860
865 [[nodiscard]] const std::set<ContainerOption> &getAllowedContainers() const { return _allowedContainers; }
866
872 void setAllowedContainers(const std::set<ContainerOption> &allowedContainers) {
873 _allowedContainers = allowedContainers;
874 }
875
882 [[nodiscard]] const std::set<TraversalOption> &getAllowedTraversals(
883 const InteractionTypeOption interactionType = InteractionTypeOption::pairwise) const {
884 return _allowedTraversals.at(interactionType);
885 }
886
894 void setAllowedTraversals(const std::set<TraversalOption> &allowedTraversals,
895 const InteractionTypeOption interactionType = InteractionTypeOption::pairwise) {
896 if (interactionType == InteractionTypeOption::all) {
897 for (auto iType : InteractionTypeOption::getMostOptions()) {
898 _allowedTraversals[iType] = allowedTraversals;
899 }
900 } else {
901 _allowedTraversals[interactionType] = allowedTraversals;
902 }
903 }
904
911 [[nodiscard]] const std::set<DataLayoutOption> &getAllowedDataLayouts(
912 const InteractionTypeOption interactionType = InteractionTypeOption::pairwise) const {
913 return _allowedDataLayouts.at(interactionType);
914 }
915
923 void setAllowedDataLayouts(const std::set<DataLayoutOption> &allowedDataLayouts,
924 const InteractionTypeOption interactionType = InteractionTypeOption::pairwise) {
925 if (interactionType == InteractionTypeOption::all) {
926 for (auto iType : InteractionTypeOption::getMostOptions()) {
927 _allowedDataLayouts[iType] = allowedDataLayouts;
928 }
929 } else {
930 _allowedDataLayouts[interactionType] = allowedDataLayouts;
931 }
932 }
933
940 [[nodiscard]] const std::set<Newton3Option> &getAllowedNewton3Options(
941 const InteractionTypeOption interactionType = InteractionTypeOption::pairwise) const {
942 return _allowedNewton3Options.at(interactionType);
943 }
944
952 void setAllowedNewton3Options(const std::set<Newton3Option> &allowedNewton3Options,
953 const InteractionTypeOption interactionType = InteractionTypeOption::pairwise) {
954 if (interactionType == InteractionTypeOption::all) {
955 for (auto iType : InteractionTypeOption::getMostOptions()) {
956 _allowedNewton3Options[iType] = allowedNewton3Options;
957 }
958 } else {
959 _allowedNewton3Options[interactionType] = allowedNewton3Options;
960 }
961 }
962
969 void setAllowedInteractionTypeOptions(const std::set<InteractionTypeOption> &allowedInteractionTypeOptions) {
970 _allowedInteractionTypeOptions = allowedInteractionTypeOptions;
971 }
972
977 [[nodiscard]] std::unordered_map<InteractionTypeOption::Value, std::reference_wrapper<const Configuration>>
979 std::unordered_map<InteractionTypeOption::Value, std::reference_wrapper<const Configuration>> currentConfigs;
980 currentConfigs.reserve(_autoTuners.size());
981
982 for (const auto &[type, tuner] : _autoTuners) {
983 currentConfigs.emplace(type, std::cref(tuner->getCurrentConfig()));
984 }
985 return currentConfigs;
986 }
987
992 [[nodiscard]] const std::vector<TuningStrategyOption> &getTuningStrategyOptions() const {
993 return _tuningStrategyOptions;
994 }
995
1001 void setTuningStrategyOption(const std::vector<TuningStrategyOption> &tuningStrategyOptions) {
1002 _tuningStrategyOptions = tuningStrategyOptions;
1003 }
1004
1009 [[nodiscard]] const TuningMetricOption &getTuningMetricOption() const { return _autoTunerInfo.tuningMetric; }
1010
1017 _autoTunerInfo.tuningMetric = tuningMetricOption;
1018 }
1019
1024 [[nodiscard]] const EnergySensorOption &getEnergySensorOption() const { return _autoTunerInfo.energySensor; }
1025
1031 _autoTunerInfo.energySensor = energySensorOption;
1032 }
1033
1038 void setMPITuningMaxDifferenceForBucket(double MPITuningMaxDifferenceForBucket) {
1039 _tuningStrategyFactoryInfo.mpiTuningMaxDifferenceForBucket = MPITuningMaxDifferenceForBucket;
1040 }
1041
1046 void setMPITuningWeightForMaxDensity(double MPITuningWeightForMaxDensity) {
1047 _tuningStrategyFactoryInfo.mpiTuningWeightForMaxDensity = MPITuningWeightForMaxDensity;
1048 }
1049
1050// Only define the interface for the MPI communicator if AUTOPAS_INCLUDE_MPI=ON
1051// The internal implementation will use _autopasMPICommunicator with WrapMPI regardless of AUTOPAS_INCLUDE_MPI
1052#if defined(AUTOPAS_INCLUDE_MPI)
1058 void setMPICommunicator(MPI_Comm comm) { _tuningStrategyFactoryInfo.autopasMpiCommunicator = comm; }
1059
1064 MPI_Comm getMPICommunicator() { return _tuningStrategyFactoryInfo.autopasMpiCommunicator; }
1065#endif
1066
1072 void setOutputSuffix(const std::string &suffix) { _outputSuffix = suffix; }
1073
1080 double getMeanRebuildFrequency() { return _logicHandler->getMeanRebuildFrequency(); }
1081
1086 void setUseTuningLogger(bool useTuningLogger) { _useTuningStrategyLoggerProxy = useTuningLogger; }
1087
1092 void setRuleFileName(const std::string &ruleFileName) { _tuningStrategyFactoryInfo.ruleFileName = ruleFileName; }
1093
1098 void setFuzzyRuleFileName(const std::string &fuzzyRuleFileName) {
1099 _tuningStrategyFactoryInfo.fuzzyRuleFileName = fuzzyRuleFileName;
1100 }
1101
1106 const std::string &getRuleFileName() const { return _tuningStrategyFactoryInfo.ruleFileName; }
1107
1114 void setSortingThreshold(size_t sortingThreshold) { _sortingThreshold = sortingThreshold; }
1115
1120 size_t getSortingThreshold() const { return _sortingThreshold; }
1121
1122 private:
1124
1125 const autopas::ParticleContainerInterface<Particle_T> &getContainer() const;
1129 TuningStrategyFactoryInfo _tuningStrategyFactoryInfo{};
1133 AutoTunerInfo _autoTunerInfo{};
1137 LogicHandlerInfo _logicHandlerInfo{};
1141 bool _useTuningStrategyLoggerProxy{false};
1146 unsigned int _verletRebuildFrequency{100};
1151 std::vector<TuningStrategyOption> _tuningStrategyOptions{};
1156 std::set<ContainerOption> _allowedContainers{ContainerOption::getMostOptions()};
1161 std::unordered_map<InteractionTypeOption::Value, std::set<TraversalOption>> _allowedTraversals{
1162 {InteractionTypeOption::pairwise, TraversalOption::getMostPairwiseOptions()},
1163 {InteractionTypeOption::triwise, TraversalOption::getMostTriwiseOptions()}};
1168 std::unordered_map<InteractionTypeOption::Value, std::set<DataLayoutOption>> _allowedDataLayouts{
1169 {InteractionTypeOption::pairwise, DataLayoutOption::getMostOptions()},
1170 {InteractionTypeOption::triwise, DataLayoutOption::getMostOptions()}};
1174 std::unordered_map<InteractionTypeOption::Value, std::set<Newton3Option>> _allowedNewton3Options{
1175 {InteractionTypeOption::pairwise, Newton3Option::getMostOptions()},
1176 {InteractionTypeOption::triwise, Newton3Option::getMostOptions()}};
1181 std::set<InteractionTypeOption> _allowedInteractionTypeOptions{InteractionTypeOption::pairwise};
1185 std::unique_ptr<NumberSet<double>> _allowedCellSizeFactors{
1186 std::make_unique<NumberSetFinite<double>>(std::set<double>({1.}))};
1191 std::set<LoadEstimatorOption> _allowedLoadEstimators{LoadEstimatorOption::getAllOptions()};
1195 std::unique_ptr<autopas::LogicHandler<Particle_T>> _logicHandler;
1196
1201 std::unordered_map<InteractionTypeOption::Value, std::unique_ptr<autopas::AutoTuner>> _autoTuners;
1202
1206 bool _externalMPICommunicator{false};
1211 std::string _outputSuffix{""};
1215 size_t _sortingThreshold{8};
1226 template <class F>
1227 void addParticlesAux(size_t numParticlesToAdd, size_t numHalosToAdd, size_t collectionSize, F loopBody);
1228}; // class AutoPas
1229} // namespace autopas
The AutoPas class is intended to be the main point of Interaction for the user.
Definition: AutoPasDecl.h:45
void setMaxEvidence(unsigned int maxEvidence)
Set maximum number of evidence for tuning.
Definition: AutoPasDecl.h:732
void setNumSamples(unsigned int numSamples)
Set number of samples taken per configuration during the tuning.
Definition: AutoPasDecl.h:701
void setAllowedNewton3Options(const std::set< Newton3Option > &allowedNewton3Options, const InteractionTypeOption interactionType=InteractionTypeOption::pairwise)
Set the list of allowed newton 3 options.
Definition: AutoPasDecl.h:952
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:842
void setFuzzyRuleFileName(const std::string &fuzzyRuleFileName)
Set fuzzy rule file name for the RuleBasedTuning.
Definition: AutoPasDecl.h:1098
unsigned int getTuningInterval() const
Get tuning interval.
Definition: AutoPasDecl.h:683
unsigned int getMaxTuningPhasesWithoutTest() const
Get the maximum number of tuning phases before a configuration is certainly tested again.
Definition: AutoPasDecl.h:752
const std::set< TraversalOption > & getAllowedTraversals(const InteractionTypeOption interactionType=InteractionTypeOption::pairwise) const
Get the list of allowed traversals.
Definition: AutoPasDecl.h:882
std::vector< Particle_T > updateContainer()
Updates the container.
Definition: AutoPasImpl.h:213
void setTuningMetricOption(TuningMetricOption tuningMetricOption)
Setter for the tuning metric option.
Definition: AutoPasDecl.h:1016
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:537
autopas::ContainerIterator< Particle_T, false, true > RegionConstIteratorT
Define the const region iterator type for ease of use.
Definition: AutoPasDecl.h:74
const std::array< double, 3 > & getBoxMin() const
Get the lower corner of the container without the halo.
Definition: AutoPasImpl.h:328
unsigned int getNumSamples() const
Get number of samples taken per configuration during the tuning.
Definition: AutoPasDecl.h:695
unsigned int getMaxEvidence() const
Get maximum number of evidence for tuning.
Definition: AutoPasDecl.h:726
void setBoxMax(const std::array< double, 3 > &boxMax)
Set coordinates of the upper corner of the domain.
Definition: AutoPasDecl.h:593
void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo) const
Reduce properties of particles as defined by a lambda function.
Definition: AutoPasDecl.h:372
bool searchSpaceIsTrivial()
get the bool value indicating if the search space is trivial (not more than one configuration to test...
Definition: AutoPasImpl.h:348
void setUseTuningLogger(bool useTuningLogger)
Set if the tuning information should be logged to a file.
Definition: AutoPasDecl.h:1086
unsigned int getVerletRebuildFrequency() const
Get Verlet rebuild frequency.
Definition: AutoPasDecl.h:658
ConstIteratorT cbegin(IteratorBehavior behavior=IteratorBehavior::ownedOrHalo) const
Iterate over all particles by using for(auto iter = autoPas.begin(); iter.isValid(); ++iter)
Definition: AutoPasDecl.h:380
void addHaloParticles(Collection &&particles)
Adds all halo particles from the collection to the container.
Definition: AutoPasImpl.h:245
void reserve(size_t numParticles)
Reserve memory for a given number of particles in the container and logic layers.
Definition: AutoPasImpl.h:158
const std::string & getRuleFileName() const
Get the name / path of the rule file for the RuleBasedTuning.
Definition: AutoPasDecl.h:1106
void setRuleFileName(const std::string &ruleFileName)
Set rule file name for the RuleBasedTuning.
Definition: AutoPasDecl.h:1092
ExtrapolationMethodOption getExtrapolationMethodOption() const
Get extrapolation method for the prediction of the configuration performance.
Definition: AutoPasDecl.h:819
const std::set< DataLayoutOption > & getAllowedDataLayouts(const InteractionTypeOption interactionType=InteractionTypeOption::pairwise) const
Get the list of allowed data layouts.
Definition: AutoPasDecl.h:911
SelectorStrategyOption getSelectorStrategy() const
Get the selector configuration strategy.
Definition: AutoPasDecl.h:835
unsigned int getVerletClusterSize() const
Get Verlet cluster size.
Definition: AutoPasDecl.h:671
void addHaloParticlesIf(Collection &&particles, F predicate)
Adds all halo particles for which predicate(particle) == true to the container.
Definition: AutoPasImpl.h:251
void addParticles(Collection &&particles)
Adds all particles from the collection to the container.
Definition: AutoPasImpl.h:186
void setVerletSkin(double verletSkin)
Set length added to the cutoff for the Verlet lists' skin per timestep.
Definition: AutoPasDecl.h:645
void setOutputSuffix(const std::string &suffix)
Suffix for all output files produced by this instance of AutoPas, e.g.
Definition: AutoPasDecl.h:1072
void setMaxTuningPhasesWithoutTest(unsigned int maxTuningPhasesWithoutTest)
Set the maximum number of tuning phases before a configuration is certainly tested again.
Definition: AutoPasDecl.h:760
void setEnergySensorOption(EnergySensorOption energySensorOption)
Setter for the energy sensor.
Definition: AutoPasDecl.h:1030
unsigned long getContainerType() const
Returns the type of the currently used container.
Definition: AutoPasImpl.h:323
void forEach(Lambda forEachLambda, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo)
Execute code on all particles as defined by a lambda function.
Definition: AutoPasDecl.h:316
const std::set< ContainerOption > & getAllowedContainers() const
Get the list of allowed containers.
Definition: AutoPasDecl.h:865
void deleteParticle(IteratorT &iter)
Deletes the particle behind the current iterator position and leaves the container in a valid state.
Definition: AutoPasImpl.h:277
void setAcquisitionFunction(AcquisitionFunctionOption acqFun)
Set acquisition function for tuning.
Definition: AutoPasDecl.h:811
void setEarlyStoppingFactor(double earlyStoppingFactor)
Set the earlyStoppingFactor for the auto tuner.
Definition: AutoPasDecl.h:708
void setMPITuningWeightForMaxDensity(double MPITuningWeightForMaxDensity)
Setter for the maxDensity-Weight in calculation for bucket distribution.
Definition: AutoPasDecl.h:1046
void reduceParallel(Lambda reduceLambda, A &result, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo) const
Reduce properties of particles as defined by a lambda function.
Definition: AutoPasDecl.h:349
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:524
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:793
void forEachParallel(Lambda forEachLambda, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo)
execute code on all particles in parallel as defined by a lambda function
Definition: AutoPasDecl.h:294
const EnergySensorOption & getEnergySensorOption() const
Getter for the energy sensor.
Definition: AutoPasDecl.h:1024
double getRelativeOptimumRange() const
Get the range for the optimum in which has to be to be tested.
Definition: AutoPasDecl.h:738
void finalize()
Free the AutoPas MPI communicator.
Definition: AutoPasDecl.h:126
void setCellSizeFactor(double cellSizeFactor)
Set allowed cell size factors to one element (only relevant for LinkedCells, VerletLists and VerletLi...
Definition: AutoPasDecl.h:634
void setRelativeBlacklistRange(double relativeBlacklistRange)
Set the range of the configurations that are not going to be blacklisted.
Definition: AutoPasDecl.h:775
size_t getSortingThreshold() const
Get the sorting-threshold for traversals that use the CellFunctor.
Definition: AutoPasDecl.h:1120
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:784
void addParticlesIf(Collection &&particles, F predicate)
Adds all particles for which predicate(particle) == true to the container.
Definition: AutoPasImpl.h:192
double getRelativeBlacklistRange() const
For Predictive tuning: Get the relative cutoff for configurations to be blacklisted.
Definition: AutoPasDecl.h:769
void setTuningStrategyOption(const std::vector< TuningStrategyOption > &tuningStrategyOptions)
Setter for the tuning strategy option.
Definition: AutoPasDecl.h:1001
autopas::ContainerIterator< Particle_T, true, true > RegionIteratorT
Define the region iterator type for ease of use.
Definition: AutoPasDecl.h:68
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:304
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:218
void setMPITuningMaxDifferenceForBucket(double MPITuningMaxDifferenceForBucket)
Setter for the maximal Difference for the bucket distribution.
Definition: AutoPasDecl.h:1038
const TuningMetricOption & getTuningMetricOption() const
Getter for the tuning metric option.
Definition: AutoPasDecl.h:1009
void setAllowedCellSizeFactors(const NumberSet< double > &allowedCellSizeFactors)
Set allowed cell size factors (only relevant for LinkedCells, VerletLists and VerletListsCells).
Definition: AutoPasDecl.h:622
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:470
void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo)
Reduce properties of particles as defined by a lambda function.
Definition: AutoPasDecl.h:363
void setAllowedLoadEstimators(const std::set< LoadEstimatorOption > &allowedLoadEstimators)
Set the list of allowed load estimation algorithms.
Definition: AutoPasDecl.h:857
double getVerletSkin()
Function to iterate over all pairs of particles in the container.
Definition: AutoPasDecl.h:550
void setAllowedTraversals(const std::set< TraversalOption > &allowedTraversals, const InteractionTypeOption interactionType=InteractionTypeOption::pairwise)
Set the list of allowed traversals.
Definition: AutoPasDecl.h:894
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:339
AcquisitionFunctionOption getAcquisitionFunction() const
Get acquisition function used for tuning.
Definition: AutoPasDecl.h:801
void setVerletClusterSize(unsigned int verletClusterSize)
Set Verlet cluster size.
Definition: AutoPasDecl.h:677
void forEach(Lambda forEachLambda, IteratorBehavior behavior=IteratorBehavior::ownedOrHalo) const
Execute code on all particles as defined by a lambda function.
Definition: AutoPasDecl.h:325
const std::array< double, 3 > & getBoxMax() const
Get the upper corner of the container without the halo.
Definition: AutoPasImpl.h:333
const NumberSet< double > & getAllowedCellSizeFactors() const
Get allowed cell size factors (only relevant for LinkedCells, VerletLists and VerletListsCells).
Definition: AutoPasDecl.h:616
void addHaloParticle(const Particle_T &haloParticle)
Adds a particle to the container that lies in the halo region of the container.
Definition: AutoPasImpl.h:239
void setAllowedDataLayouts(const std::set< DataLayoutOption > &allowedDataLayouts, const InteractionTypeOption interactionType=InteractionTypeOption::pairwise)
Set the list of allowed data layouts.
Definition: AutoPasDecl.h:923
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:1114
Particle_T ParticleType
Particle type to be accessible after initialization.
Definition: AutoPasDecl.h:50
autopas::ContainerIterator< Particle_T, true, false > IteratorT
Define the iterator type for ease of use.
Definition: AutoPasDecl.h:56
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:310
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:490
double getMeanRebuildFrequency()
Getter for the mean rebuild frequency.
Definition: AutoPasDecl.h:1080
AutoPas & operator=(AutoPas &&other) noexcept
Move assignment operator.
Definition: AutoPasImpl.h:48
void setExtrapolationMethodOption(ExtrapolationMethodOption extrapolationMethodOption)
Set extrapolation method for the prediction of the configuration performance.
Definition: AutoPasDecl.h:827
void setBoxMin(const std::array< double, 3 > &boxMin)
Set coordinates of the lower corner of the domain.
Definition: AutoPasDecl.h:587
void init()
Initialize AutoPas.
Definition: AutoPasImpl.h:55
const std::vector< TuningStrategyOption > & getTuningStrategyOptions() const
Getter for the tuning strategy option.
Definition: AutoPasDecl.h:992
autopas::ContainerIterator< Particle_T, false, false > ConstIteratorT
Define the const iterator type for ease of use.
Definition: AutoPasDecl.h:62
void forceRetune()
Force the internal tuner to enter a new tuning phase upon the next call to computeInteractions().
Definition: AutoPasImpl.h:232
void setAllowedInteractionTypeOptions(const std::set< InteractionTypeOption > &allowedInteractionTypeOptions)
Set the list of allowed interaction types.
Definition: AutoPasDecl.h:969
void setVerletRebuildFrequency(unsigned int verletRebuildFrequency)
Set Verlet rebuild frequency.
Definition: AutoPasDecl.h:664
void setDeltaT(double deltaT)
Set time step of the simulation.
Definition: AutoPasDecl.h:652
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:457
const std::set< LoadEstimatorOption > & getAllowedLoadEstimators() const
Get the list of allowed load estimation algorithms.
Definition: AutoPasDecl.h:850
void setUseLOESSSmoothening(bool useLOESSSmoothening)
Set flag for whether a LOESS-based smoothening is used.
Definition: AutoPasDecl.h:720
size_t getNumberOfParticles(IteratorBehavior behavior=IteratorBehavior::owned) const
Returns the number of particles in this container.
Definition: AutoPasImpl.h:140
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:504
void deleteAllParticles()
Deletes all particles.
Definition: AutoPasImpl.h:272
bool computeInteractions(Functor *f)
Function to iterate over all inter-particle interactions in the container This function only handles ...
Definition: AutoPasImpl.h:117
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:425
void addParticle(const Particle_T &p)
Adds a particle to the container.
Definition: AutoPasImpl.h:180
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:439
bool getUseLOESSSmoothening() const
Get flag for whether a LOESS-based smoothening is used.
Definition: AutoPasDecl.h:714
double getCutoff() const
Get cutoff radius.
Definition: AutoPasDecl.h:599
IteratorT begin(IteratorBehavior behavior=IteratorBehavior::ownedOrHalo)
Iterate over all particles by using for(auto iter = autoPas.begin(); iter.isValid(); ++iter)
Definition: AutoPasImpl.h:300
std::unordered_map< InteractionTypeOption::Value, std::reference_wrapper< const Configuration > > getCurrentConfigs() const
Getter for the currently selected configuration.
Definition: AutoPasDecl.h:978
void setRelativeOptimumRange(double relativeOptimumRange)
Set the range for the optimum in which has to be to be tested.
Definition: AutoPasDecl.h:744
void setAllowedContainers(const std::set< ContainerOption > &allowedContainers)
Set the list of allowed containers.
Definition: AutoPasDecl.h:872
void setCutoff(double cutoff)
Set cutoff radius.
Definition: AutoPasDecl.h:605
void setTuningInterval(unsigned int tuningInterval)
Set tuning interval.
Definition: AutoPasDecl.h:689
constexpr bool end() const
Dummy to make range-based for loops work.
Definition: AutoPasDecl.h:392
const std::set< Newton3Option > & getAllowedNewton3Options(const InteractionTypeOption interactionType=InteractionTypeOption::pairwise) const
Get the list of allowed newton 3 options.
Definition: AutoPasDecl.h:940
Public iterator class that iterates over a particle container and additional vectors (which are typic...
Definition: ContainerIterator.h:95
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:48
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:38
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