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 Dependencies #155

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
graphviz \
python3-numpy \
python3-vtk7
- uses: actions/checkout@v2
- uses: actions/checkout@v4.1.7
with:
lfs: true
- name: Build project
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
libtbb-dev \
python3-numpy \
python3-vtk7
- uses: actions/checkout@v2
- uses: actions/checkout@v4.1.7
with:
lfs: true
- name: Build project
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
libtbb-dev \
python3-numpy \
python3-vtk7
- uses: actions/checkout@v2
- uses: actions/checkout@v4.1.7
with:
lfs: true
- name: Build project
Expand All @@ -127,8 +127,8 @@ jobs:
format_check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: DoozyX/clang-format-lint-action@v0.12
- uses: actions/checkout@v4.1.7
- uses: DoozyX/clang-format-lint-action@v0.18.2
with:
source: 'src tests'
# exclude: 'none'
Expand Down
6 changes: 3 additions & 3 deletions cmake/modules/autopas.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ endif ()
FetchContent_Declare(
autopasfetch
GIT_REPOSITORY ${autopasRepoPath}
# merge of md-flex/diffuse-loadbalancing 12.07.22
GIT_TAG 71fa505172bce4ee422556018f2dc444e04fca12
# TODO: freeze 17.09.24
GIT_TAG limitNumSpacialLocks
)
# Populate dependency
FetchContent_MakeAvailable(autopasfetch)
Expand All @@ -23,4 +23,4 @@ FetchContent_MakeAvailable(autopasfetch)
target_compile_options(autopas PRIVATE -w)
# Disable warnings from included headers
get_target_property(propval autopas INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(autopas SYSTEM PUBLIC "${propval}")
target_include_directories(autopas SYSTEM PUBLIC "${propval}")
6 changes: 3 additions & 3 deletions src/ladds/CollisionFunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ void CollisionFunctor::SoAFunctorSingle(autopas::SoAView<SoAArraysType> soa, boo
void CollisionFunctor::SoAFunctorPair(autopas::SoAView<SoAArraysType> soa1,
autopas::SoAView<SoAArraysType> soa2,
bool newton3) {
if (soa1.getNumberOfParticles() == 0 or soa2.getNumberOfParticles() == 0) return;
if (soa1.size() == 0 or soa2.size() == 0) return;

// get pointers to the SoA
const auto *const __restrict ownedStatePtr1 = soa1.template begin<Particle::AttributeNames::ownershipState>();

// outer loop over SoA1
for (size_t i = 0; i < soa1.getNumberOfParticles(); ++i) {
for (size_t i = 0; i < soa1.size(); ++i) {
if (ownedStatePtr1[i] == autopas::OwnershipState::dummy) {
// If the i-th particle is a dummy, skip this loop iteration.
continue;
Expand All @@ -157,7 +157,7 @@ void CollisionFunctor::SoAFunctorPair(autopas::SoAView<SoAArraysType> soa1,
// TODO add evadedCollisions when refactoring this
auto &thisCollisions = _threadData[autopas::autopas_get_thread_num()].collisions;
#pragma omp simd reduction(vecMerge : thisCollisions)
for (size_t j = 0; j < soa2.getNumberOfParticles(); ++j) {
for (size_t j = 0; j < soa2.size(); ++j) {
SoAKernel(i, j, soa1, soa2, newton3);
}
}
Expand Down
16 changes: 9 additions & 7 deletions src/ladds/Simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ std::unique_ptr<AutoPas_t> Simulation::initAutoPas(ConfigReader &config, DomainD
autopas->setBoxMin(domainDecomp.getLocalBoxMin());
autopas->setBoxMax(domainDecomp.getLocalBoxMax());
autopas->setCutoff(cutoff);
autopas->setVerletSkin(verletSkin);
autopas->setVerletSkinPerTimestep(verletSkin / verletRebuildFrequency);
autopas->setVerletRebuildFrequency(verletRebuildFrequency);
// Scale Cell size so that we get the desired number of cells
// -2 because internally there will be two halo cells added on top of maxAltitude
Expand Down Expand Up @@ -612,12 +612,14 @@ void Simulation::processCollisions(size_t iteration,
ConjuctionWriterInterface &conjunctionWriter,
BreakupWrapper *breakupWrapper) {
if (not collisions.empty()) {
SPDLOG_LOGGER_DEBUG(logger.get(), "The following particles collided between ranks:");
for (const auto &[p1, p2, _, __] : collisions) {
SPDLOG_LOGGER_DEBUG(logger.get(),
"({}, {})",
autopas::utils::ArrayUtils::to_string(p1->getPosition()),
autopas::utils::ArrayUtils::to_string(p2->getPosition()));
if constexpr (SPDLOG_ACTIVE_LEVEL >= SPDLOG_LEVEL_DEBUG) {
SPDLOG_LOGGER_DEBUG(logger.get(), "The following particles collided between ranks:");
for (const auto &[p1, p2, _, __] : collisions) {
SPDLOG_LOGGER_DEBUG(logger.get(),
"({}, {})",
autopas::utils::ArrayUtils::to_string(p1->getPosition()),
autopas::utils::ArrayUtils::to_string(p2->getPosition()));
}
}
iterationsSinceLastCollision = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ LADDS::RegularGridDecomposition::RegularGridDecomposition(LADDS::ConfigReader &c
using autopas::utils::ArrayMath::div;
using autopas::utils::ArrayMath::mul;
using autopas::utils::ArrayMath::sub;
using autopas::utils::ArrayUtils::static_cast_array;
using autopas::utils::ArrayUtils::static_cast_copy_array;
// calculate local box extent
const auto globalBoxLength = sub(globalBoxMax, globalBoxMin);
const auto localBoxLength = div(globalBoxLength, static_cast_array<double>(dims));
localBoxMin = add(globalBoxMin, mul(localBoxLength, static_cast_array<double>(coords)));
const auto localBoxLength = div(globalBoxLength, static_cast_copy_array<double>(dims));
localBoxMin = add(globalBoxMin, mul(localBoxLength, static_cast_copy_array<double>(coords)));
localBoxMax = add(localBoxMin, localBoxLength);

// print parallelization info
Expand All @@ -52,12 +52,12 @@ int LADDS::RegularGridDecomposition::getRank(const std::array<double, 3> &coordi
using autopas::utils::ArrayMath::abs;
using autopas::utils::ArrayMath::div;
using autopas::utils::ArrayMath::sub;
using autopas::utils::ArrayUtils::static_cast_array;
using autopas::utils::ArrayUtils::static_cast_copy_array;

// we need to translate to 0 avoid problems with negative coordinates
const auto translatedCoords = sub(coordinates, globalBoxMin);
const auto localBoxLength = abs(sub(localBoxMax, localBoxMin));
const auto rankGridCoords = static_cast_array<int>(div(translatedCoords, localBoxLength));
const auto rankGridCoords = static_cast_copy_array<int>(div(translatedCoords, localBoxLength));
int targetRank{};
autopas::AutoPas_MPI_Cart_rank(communicator, rankGridCoords.data(), &targetRank);
return targetRank;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ TEST_F(RegularGridDecompositionTests, testParticleMigrationHandler) {
using autopas::utils::ArrayMath::mul;
using autopas::utils::ArrayMath::mulScalar;
using autopas::utils::ArrayMath::sub;
using autopas::utils::ArrayUtils::static_cast_array;
using autopas::utils::ArrayUtils::static_cast_copy_array;

int numRanks{};
autopas::AutoPas_MPI_Comm_size(decomposition->getCommunicator(), &numRanks);
Expand Down Expand Up @@ -97,8 +97,8 @@ TEST_F(RegularGridDecompositionTests, testParticleMigrationHandler) {
for (int z = 0; z < 2; ++z) {
const std::array<int, 3> rankGridIndex{x, y, z};
// newPos = globalBoxMin + (localBoxLength / 2) + (localBoxLength * index)
const auto newPosition =
add(globalBoxMin, add(localBoxLengthHalf, mul(localBoxLength, static_cast_array<double>(rankGridIndex))));
const auto newPosition = add(
globalBoxMin, add(localBoxLengthHalf, mul(localBoxLength, static_cast_copy_array<double>(rankGridIndex))));
// make sure all except one particle is moved away
ASSERT_TRUE(
(x == rankGridIndex[0] and y == rankGridIndex[1] and z == rankGridIndex[2]) or
Expand Down
7 changes: 3 additions & 4 deletions tests/testladds/CollisionFunctorIntegrationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "CollisionFunctorIntegrationTest.h"

#include <autopas/AutoPasDecl.h>
#include <autopasTools/generators/RandomGenerator.h>
#include <autopasTools/generators/UniformGenerator.h>
#include <gmock/gmock-matchers.h>
#include <gmock/gmock-more-matchers.h>
#include <ladds/CollisionFunctor.h>
Expand All @@ -16,7 +16,6 @@ extern template class autopas::AutoPas<LADDS::Particle>;
extern template bool autopas::AutoPas<LADDS::Particle>::iteratePairwise(LADDS::CollisionFunctor *);

void CollisionFunctorIntegrationTest::SetUpTestSuite() {
using autopasTools::generators::RandomGenerator;
constexpr size_t numDebris = 15;
LADDS::Particle defaultParticle{{
0.,
Expand All @@ -38,10 +37,10 @@ void CollisionFunctorIntegrationTest::SetUpTestSuite() {
_debris.reserve(numDebris);

// fix seed for randomPosition()
srand(42);
std::mt19937 generator(42);

for (int i = 0; i < numDebris; ++i) {
defaultParticle.setR(autopasTools::generators::RandomGenerator::randomPosition(_boxMin, _boxMax));
defaultParticle.setR(autopasTools::generators::UniformGenerator::randomPosition(generator, _boxMin, _boxMax));
defaultParticle.setID(i);
defaultParticle.setParentIdentifier(i);
_debris.push_back(defaultParticle);
Expand Down
14 changes: 8 additions & 6 deletions tests/testladds/SimulationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

/**
* Tests whether particles are correctly inserted into the simulation, when a particle
* from the simulation and from the insertion overlap (or are very very close to each other)
* from the simulation and from the insertion overlap (or are very, very close to each other)
*/
TEST_F(SimulationTest, testInsertionOverlap) {
auto [csvWriter, accumulator, integrator] = simulation.initIntegrator(*autopas, *configReader);
Expand Down Expand Up @@ -83,11 +83,11 @@ TEST_F(SimulationTest, testInsertionOverlap) {
ASSERT_EQ(autopas->getNumberOfParticles(), 2) << "Container initialized wrong!";
std::vector<LADDS::Particle> delayedSatellites = newSatellites;
// simulate some iterations and check delays against expectations from above
for (size_t iteration = 0; iteration < expectedDelayedParticles.size(); ++iteration) {
for (const auto expectedDelayedParticle : expectedDelayedParticles) {
auto escapedParticles = autopas->updateContainer();
ASSERT_EQ(escapedParticles.size(), 0) << "In this test nothing should escape.";
delayedSatellites = simulation.checkedInsert(*autopas, delayedSatellites, constellationCutoff);
EXPECT_EQ(delayedSatellites.size(), expectedDelayedParticles[iteration]);
EXPECT_EQ(delayedSatellites.size(), expectedDelayedParticle);
EXPECT_EQ(autopas->getNumberOfParticles(),
initialSatellites.size() + newSatellites.size() - delayedSatellites.size());

Expand Down Expand Up @@ -212,7 +212,7 @@ TEST_P(SimulationTest, testCheckedInsert) {
std::numeric_limits<size_t>::max()));

// particle that will be inserted
LADDS::Particle p1{posTestParticle,
const LADDS::Particle p1{posTestParticle,
zeroVec,
1,
"tester",
Expand All @@ -225,13 +225,14 @@ TEST_P(SimulationTest, testCheckedInsert) {
const auto escapedParticles = autopas->updateContainer();
ASSERT_TRUE(escapedParticles.empty()) << "Test setup faulty!";

std::vector<LADDS::Particle> delayedParticles = simulation.checkedInsert(*autopas, {p1}, constellationCutoff);
const std::vector<LADDS::Particle> delayedParticles = simulation.checkedInsert(*autopas, {p1}, constellationCutoff);
// if the position is safe the particle is inserted and there are now two. Otherwise, we remain with one.
EXPECT_EQ(autopas->getNumberOfParticles(), positionIsSafe ? 2 : 1);
// if the position is considered safe for insertion there should be no delayed particle
EXPECT_EQ(delayedParticles.empty(), positionIsSafe);
}

namespace {
// Generate tests for all configuration combinations
std::vector<ParameterTuple> generateParameters() {
using autopas::utils::ArrayMath::add;
Expand All @@ -240,7 +241,7 @@ std::vector<ParameterTuple> generateParameters() {
// alias for readability
const auto &particlePos = SimulationTest::testCheckedInsertParticlePos;
const auto &searchBoxLength = SimulationTest::constellationCutoff;
std::array<double, 3> vectorToCorner{searchBoxLength, searchBoxLength, searchBoxLength};
const std::array<double, 3> vectorToCorner{searchBoxLength, searchBoxLength, searchBoxLength};

return {
// same pos as other particle
Expand All @@ -256,6 +257,7 @@ std::vector<ParameterTuple> generateParameters() {
std::make_tuple(add(particlePos, mulScalar(vectorToCorner, 0.4)), false),
};
}
}

INSTANTIATE_TEST_SUITE_P(Generated,
SimulationTest,
Expand Down
Loading