Skip to content

Commit

Permalink
lintfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Robadob committed Jul 21, 2023
1 parent 6293ba0 commit 37016f0
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions tests/test_cases/simulation/test_mpi_ensemble.cu
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include "flamegpu/flamegpu.h"

#ifdef FLAMEGPU_ENABLE_MPI
#include <mpi.h>
#endif

#include "gtest/gtest.h"

#include <chrono>
#include <thread>

#include "flamegpu/flamegpu.h"
#include "gtest/gtest.h"


namespace flamegpu {
namespace tests {
namespace test_mpi_ensemble {
Expand Down Expand Up @@ -68,7 +68,7 @@ class TestMPIEnsemble : public testing::Test {
void TearDown() override {
if (exit_log_cfg) delete exit_log_cfg;
if (plans) delete plans;
if (model) delete model;
if (model) delete model;
}
void initModel() {
model = new flamegpu::ModelDescription("MPITest");
Expand All @@ -80,16 +80,16 @@ class TestMPIEnsemble : public testing::Test {
void initPlans() {
// 100 runs, each 10 steps which take >100ms each,
// therefore each sim will take >1 second.
// Estimate 30 seconds for full test across 4 threads
// Estimate 30 seconds for full test across 4 threads
plans = new flamegpu::RunPlanVector(*model, 100);
plans->setSteps(10);
plans->setPropertyLerpRange<int>("counter", 0, 99);
plans->setPropertyLerpRange<int>("counter_init", 0, 99);
plans->setPropertyLerpRange<int>("counter", 0, 99);
plans->setPropertyLerpRange<int>("counter_init", 0, 99);
}
void initExitLoggingConfig() {
exit_log_cfg = new flamegpu::LoggingConfig(*model);
exit_log_cfg->logEnvironment("counter");
exit_log_cfg->logEnvironment("counter_init");
exit_log_cfg->logEnvironment("counter");
exit_log_cfg->logEnvironment("counter_init");
}
int world_rank = -1;
int group_size = -1;
Expand Down Expand Up @@ -120,22 +120,21 @@ TEST_F(TestMPIEnsemble, local) {
ensemble.setExitLog(*exit_log_cfg);

ensemble.simulate(*plans);

// Validate results
// @note Best we can currently do is check logs of each runner have correct results
// @note Ideally we'd validate between nodes to ensure all runs have been completed
const std::vector<RunLog> logs = ensemble.getLogs();
printf("Log size: %u\n", (unsigned int)logs.size());
for (const auto &log:logs) {
for (const auto &log : logs) {
const ExitLogFrame& exit_log = log.getExitLog();
//EXPECT_EQ(exit_log.getStepCount(), 10);
if (exit_log.getStepCount()){ // Temp, currently every runner gets all logs but unhandled ones are empty
// EXPECT_EQ(exit_log.getStepCount(), 10);
if (exit_log.getStepCount()) { // Temp, currently every runner gets all logs but unhandled ones are empty
// Get a logged environment property
const int counter = exit_log.getEnvironmentProperty<int>("counter");
const int counter_init = exit_log.getEnvironmentProperty<int>("counter_init"); // @todo Can't access run index via RunLog
EXPECT_EQ(counter, counter_init + 10);
}
}
}
}
}
TEST_F(TestMPIEnsemble, multi) {
if (world_size < 1) return;
Expand All @@ -152,6 +151,6 @@ TEST(TestMPIEnsemble, DISABLED_local_test) { }
TEST(TestMPIEnsemble, DISABLED_multi_test) { }
#endif

} // namespace test_cuda_ensemble
} // namespace test_mpi_ensemble
} // namespace tests
} // namespace flamegpu

0 comments on commit 37016f0

Please sign in to comment.