Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AutoPas to Combined Tuning #270

Merged
merged 35 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9223d08
changes necessary due to moving application code to
FG-TUM Jul 28, 2023
0311c45
parse multiple tuning strategies
FG-TUM Jul 28, 2023
6965dc3
temporarily change the default AutoPas version to the head of the rel…
FG-TUM Jul 28, 2023
6fe83c1
get rule file name from xml
FG-TUM Jul 30, 2023
43a56ea
formatting and doc
FG-TUM Jul 30, 2023
c093707
Print rule file name and use '\n' instead of endl
FG-TUM Aug 2, 2023
3e78c5e
update xml example for AutoPas
FG-TUM Aug 8, 2023
ee15287
freeze autopas to a revision in master that contains all desired feat…
FG-TUM Jan 16, 2024
33da19a
update relevant example xmls
FG-TUM Jan 16, 2024
f0edf2f
Merge branch 'master' into updateAutoPasCombinedTuning
FG-TUM Jan 16, 2024
5cf6bba
experimental autopas version
FG-TUM Jan 16, 2024
4a1f9c7
remove fullSearch from examples
FG-TUM Jan 16, 2024
0efdd4b
dirty trick to see logs
FG-TUM Jan 16, 2024
aa36526
increase visibility
FG-TUM Jan 16, 2024
0c4e807
less parallel?
FG-TUM Jan 16, 2024
0028e12
remove debug output
FG-TUM Jan 16, 2024
7ae320d
clarify comment
FG-TUM Jan 26, 2024
31aba3c
fix AutoPasContainer::getHaloSize() to give the correct size for all …
FG-TUM Jan 26, 2024
5c1bb20
Clarify doc, update style, fix typo
FG-TUM Jan 29, 2024
69de7e2
fix wrong indent
FG-TUM Jan 29, 2024
2b36232
add getRebuildFrequency
FG-TUM Jan 31, 2024
d056136
switch to hotfix branch
FG-TUM Jan 31, 2024
35fc683
typo
FG-TUM Feb 1, 2024
1702079
Avoid race conditions by using thread local variables and restrict sc…
FG-TUM Feb 5, 2024
c5c81d8
Update AutoPas version to next hotfix
FG-TUM Feb 6, 2024
e795830
fix parsing for negative numbers
FG-TUM Feb 8, 2024
871b049
adding TuningMetricOption in autopas
manishmishra6016 Apr 8, 2024
a23dbe3
updating call to gettter and setter of tuningMetric
manishmishra6016 Apr 9, 2024
6b7e98d
tuningMetric option in all-options.xml
manishmishra6016 Apr 9, 2024
b6698e0
adding energy option in Argon simulation
manishmishra6016 Apr 9, 2024
d283782
minor fix
manishmishra6016 Apr 9, 2024
7b671ca
minor console out update
manishmishra6016 Apr 9, 2024
d7ee5f2
Merge pull request #301 from ls1mardyn/energyTuningFeatureFromAutopas
FG-TUM Apr 9, 2024
a94780f
bump autopas version for energy tuning
FG-TUM Apr 9, 2024
7c7d7b4
bump autopas version for fixed region iterators
FG-TUM Apr 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ls1_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
-DENABLE_UNIT_TESTS=ON \
..

cmake --build . --parallel 2
cmake --build . --parallel 1

cd ..

Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
-DENABLE_MPI=$mpi_enabled \
..

cmake --build . --parallel 2
cmake --build . --parallel 1

#as example list of new version is used, also the example files of new version should be used
#therefore, go back to new version
Expand Down
7 changes: 4 additions & 3 deletions cmake/modules/autopas.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ if (ENABLE_AUTOPAS)
set(AUTOPAS_USE_VECTORIZATION ${USE_VECTORIZATION} CACHE BOOL "Set via USE_VECTORIZATION" FORCE)
set(AUTOPAS_VECTOR_INSTRUCTIONS ${VECTOR_INSTRUCTIONS} CACHE STRING "Set via VECTOR_INSTRUCTIONS_OPTIONS" FORCE)

# Merge of fixSpacialLocksResize 2023-05-08; This includes the rewrites of remainder traversal and iterators.
set(AUTOPAS_TAG e47c9257bb8d0c6ab680d02823b1e8749b25369a CACHE STRING "AutoPas Git tag or commit id to use")
# Merge of #830 (fixRegionIterators); includes #787 (combined tuning)
set(AUTOPAS_TAG faef573 CACHE STRING "AutoPas Git tag or commit id to use")

FetchContent_Declare(
autopasfetch
Expand All @@ -41,7 +41,8 @@ if (ENABLE_AUTOPAS)
add_subdirectory(${autopasfetch_SOURCE_DIR} ${autopasfetch_BINARY_DIR} EXCLUDE_FROM_ALL)
endif ()

set(AUTOPAS_LIB "autopas")
# Linking the md lib also links AutoPas
set(AUTOPAS_LIB "molecularDynamicsLibrary")
else ()
message(STATUS "Not using AutoPas.")
set(AUTOPAS_LIB "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
<allowedTraversals>c01, c04, c08, c18, sli</allowedTraversals>
<allowedContainers>linkedCells</allowedContainers>
<selectorStrategy>fastestMedian</selectorStrategy>
<tuningStrategy>FullSearch</tuningStrategy><!--FullSearch, BayesianSearch, ...-->
<dataLayouts>SoA</dataLayouts>
<newton3>enabled</newton3>
<tuningInterval>1000</tuningInterval>
Expand Down
4 changes: 3 additions & 1 deletion examples/Argon/200K_18mol_l/config_autopas_allOptions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,18 @@
</parallelisation>
-->
<datastructure type="AutoPas">
<loglevel>off</loglevel><!--Level for the AutoPas logger-->
<allowedTraversals>ds_sequential, lc_sliced, lc_sliced_balanced, lc_sliced_c02, lc_c01, lc_c01_combined_SoA, lc_c01_cuda, lc_c04, lc_c04_HCP, lc_c04_combined_SoA, lc_c08, lc_c18, vcc_cluster_iteration_cuda, vcl_cluster_iteration, vcl_c06, vcl_c01_balanced, vl_list_iteration, vlc_c01, vlc_c18, vlc_sliced, vlc_sliced_balanced, vlc_sliced_c02, vvl_as_built</allowedTraversals>
<allowedContainers>DirectSum,LinkedCells, VerletLists, VerletListsCells, VerletClusterLists,VarVerletListsAsBuild,VerletClusterCells</allowedContainers>
<selectorStrategy>fastestMean</selectorStrategy><!--fastestMedian,fastestAbs-->
<tuningStrategy>FullSearch</tuningStrategy><!--FullSearch, BayesianSearch, ...-->
<tuningStrategies>predictive,rulebased</tuningStrategies><!--Predictive, RuleBased, BayesianSearch, ...; Leave empty for full search-->
<dataLayouts>AoS, SoA</dataLayouts>
<newton3>enabled, disabled</newton3>
<tuningAcquisitionFunction>lower-confidence-bound</tuningAcquisitionFunction> <!--only relevant for BayesianSearch-->
<maxEvidence>20</maxEvidence>
<tuningInterval>1000</tuningInterval>
<tuningSamples>10</tuningSamples>
<ruleFile>AutoPas/examples/md-flexible/input/tuningRules.rule</ruleFile><!--check the AutoPas repo for examples-->
<rebuildFrequency>10</rebuildFrequency>
<skin>0.5</skin>
</datastructure>
Expand Down
1 change: 1 addition & 0 deletions examples/Argon/200K_18mol_l/config_autopas_aos.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<allowedTraversals>lc_c01, lc_c08, lc_c18, lc_sli, ds_sequential</allowedTraversals>
<allowedContainers>linkedCells, verletLists, directsum</allowedContainers>
<selectorStrategy>fastestMedian</selectorStrategy>
<tuningMetric>energy</tuningMetric>
<dataLayouts>AoS</dataLayouts>
<newton3>enabled, disabled</newton3>
<tuningInterval>1000</tuningInterval>
Expand Down
2 changes: 2 additions & 0 deletions examples/Argon/200K_18mol_l/config_autopas_lc_ALL.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
</loadBalancer>
</parallelisation>
<datastructure type="AutoPas">
<!-- <logLevel>info</logLevel> -->
<allowedContainers>linkedCells</allowedContainers>
<tuningStrategies>predictive,ruleBased</tuningStrategies>
<tuningInterval>10000</tuningInterval>
<tuningSamples>10</tuningSamples>
<rebuildFrequency>10</rebuildFrequency>
Expand Down
7 changes: 5 additions & 2 deletions examples/all-options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,11 @@
<!-- specify what metric the selector should use to determine the optimal traversal -->
<!-- possible values: fastetAbsolute, fastestMean, fastestMedian -->
<selectorStrategy>fastestAbsolute</selectorStrategy>
<!-- set the auto tuning algorithm -->
<tuningStrategy>fullSearch</tuningStrategy>
<!-- set the tuning auto tuning pipeline -->
<!-- Leave this empty for an exhaustive full search or add any number of strategies that are applied in the stated order -->
<tuningStrategies>ruleBasedTuning, predictiveTuning</tuningStrategies>
<!-- autopas optimizes the simulation based on tuning metric: time, energy, default option is time -->
<tuningMetric>energy</tuningMetric>
<!-- Data layouts to be used: AoS, SoA -->
<dataLayouts>SoA</dataLayouts>
<!-- Allowed choices for newton 3 optimization: enabled, disabled -->
Expand Down
15 changes: 6 additions & 9 deletions src/Domain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,30 +261,27 @@ void Domain::calculateGlobalValues(
Log::global_log->debug() << "Selective thermostat will be applied to set " << thermit->first
<< " (beta_trans = " << this->_universalBTrans[thermit->first]
<< ", beta_rot = " << this->_universalBRot[thermit->first] << "!)" << std::endl;
int rot_dof;
const double limit_energy = KINLIMIT_PER_T * Ti;

#if defined(_OPENMP)
#pragma omp parallel
#endif
{

double Utrans, Urot, limit_rot_energy, vcorr, Dcorr;
for (auto tM = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); tM.isValid(); ++tM) {
Utrans = tM->U_trans();
const auto Utrans = tM->U_trans();
if (Utrans > limit_energy) {
vcorr = sqrt(limit_energy / Utrans);
const auto vcorr = sqrt(limit_energy / Utrans);
Log::global_log->debug() << ": v(m" << tM->getID() << ") *= " << vcorr << std::endl;
tM->scale_v(vcorr);
tM->scale_F(vcorr);
}

rot_dof = tM->component()->getRotationalDegreesOfFreedom();
const auto rot_dof = tM->component()->getRotationalDegreesOfFreedom();
if (rot_dof > 0) {
limit_rot_energy = 3.0 * rot_dof * Ti;
Urot = tM->U_rot();
const auto limit_rot_energy = 3.0 * rot_dof * Ti;
const auto Urot = tM->U_rot();
if (Urot > limit_rot_energy) {
Dcorr = sqrt(limit_rot_energy / Urot);
const auto Dcorr = sqrt(limit_rot_energy / Urot);
Log::global_log->debug() << "D(m" << tM->getID() << ") *= " << Dcorr << std::endl;
tM->scale_D(Dcorr);
tM->scale_M(Dcorr);
Expand Down
4 changes: 2 additions & 2 deletions src/molecules/AutoPasSimpleMolecule.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#pragma once

#include <autopas/molecularDynamics/MoleculeLJ.h>
#include <molecularDynamicsLibrary/MoleculeLJ.h>
#include <autopas/utils/SoAType.h>
#include <autopas/utils/inBox.h>

Expand Down Expand Up @@ -336,4 +336,4 @@ class AutoPasSimpleMolecule final : public MoleculeInterface, public autopas::Pa
static Quaternion _quaternion;
};

std::ostream& operator<<( std::ostream& os, const AutoPasSimpleMolecule& m );
std::ostream& operator<<( std::ostream& os, const AutoPasSimpleMolecule& m );
2 changes: 1 addition & 1 deletion src/parallel/CommunicationPartner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ bool CommunicationPartner::iprobeCount(const MPI_Comm& comm, const MPI_Datatype&
return _countReceived;
}
bool CommunicationPartner::testRecv(ParticleContainer* moleculeContainer, bool removeRecvDuplicates, bool force) {
if (_countReceived and not _msgReceived) {
if (_countReceived and not _msgReceived) {
int flag = 1;
if (_countTested > 10) {
// some MPI (Intel, IBM) implementations can produce deadlocks using MPI_Test without any MPI_Wait
Expand Down
2 changes: 1 addition & 1 deletion src/parallel/DomainDecompBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ void DomainDecompBase::handleDomainLeavingParticlesDirect(const HaloRegion& halo
};

if (moleculeContainer->isInvalidParticleReturner()) {
// move all particles that will be inserted now to the end of the container
// Shift and add all invalid particles that do belong in this halo region
auto removeBegin = std::partition(invalidParticles.begin(), invalidParticles.end(), [=](const Molecule& m) {
// if this is true, it will be put in the first part of the partition, if it is false, in the second.
return not m.inBox(haloRegion.rmin, haloRegion.rmax);
Expand Down
2 changes: 1 addition & 1 deletion src/parallel/DomainDecompMPIBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ void DomainDecompMPIBase::assertDisjunctivity(ParticleContainer* moleculeContain
}
}
if (not isOk) {
Log::global_log->error() << "Aborting because of duplicated partices." << std::endl;
Log::global_log->error() << "Aborting because of duplicated particles." << std::endl;
MPI_Abort(_comm, 1);
}

Expand Down
1 change: 1 addition & 0 deletions src/parallel/NeighbourCommunicationScheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ void DirectNeighbourCommunicationScheme::finalizeExchangeMoleculesMPI(ParticleCo
removeRecvDuplicates |= (domainDecomp->getRank() == (*_neighbours)[0][i].getRank());
}

// local helper function to apply f to all real neighbours
auto forAllRealNeighbors = [&](auto&& f) {
for (auto& neighbor : (*_neighbours)[0]) {
if (not _useSequentialFallback or domainDecomp->getRank() != neighbor.getRank()) {
Expand Down
Loading
Loading