From 9467f00cd740b8bdf14b23bc629fb1cc8657e2c8 Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Fri, 30 Jul 2021 20:01:30 +0000 Subject: [PATCH 01/20] Add Matt W.'s fix for the documentation --- .github/workflows/documentation.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index b1ec41197e..f92f0b0050 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -40,8 +40,8 @@ jobs: ref: gh-pages clean: false - - name: Move generated files where git can see them - run: cp -rp docs/html/* . + - name: Prevent generated docs dir from being committed and overwriting on the next run. + run: rm -Rf docs/html - name: Prevent generated docs dir from being committed and overwriting on the next run. run: rm -Rf docs/html From 0c7b9a9b72d1a01a80fbb9ff68eff14351b87c5b Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Fri, 30 Jul 2021 20:13:40 +0000 Subject: [PATCH 02/20] Add back the two lines deleted from original .github/workflows/documentation.yml --- .github/workflows/documentation.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index f92f0b0050..69aa15e721 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -39,6 +39,9 @@ jobs: with: ref: gh-pages clean: false + + - name: Move generated files where git can see them + run: cp -rp docs/html/* . - name: Prevent generated docs dir from being committed and overwriting on the next run. run: rm -Rf docs/html From 2b25429624e9ecbaf11a7ba28697c226f7408a4c Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Fri, 2 Feb 2024 16:29:54 +0000 Subject: [PATCH 03/20] Parallel run with one proc w/o partition file --- include/core/Partition_Data.hpp | 14 ++++++ include/core/Partition_One.hpp | 47 ++++++++++++++++++ include/core/Partition_Parser.hpp | 13 +---- src/NGen.cpp | 80 +++++++++++++++++++++---------- 4 files changed, 116 insertions(+), 38 deletions(-) create mode 100644 include/core/Partition_Data.hpp create mode 100644 include/core/Partition_One.hpp diff --git a/include/core/Partition_Data.hpp b/include/core/Partition_Data.hpp new file mode 100644 index 0000000000..5fe1de14a1 --- /dev/null +++ b/include/core/Partition_Data.hpp @@ -0,0 +1,14 @@ +#ifndef PARTITION_DATA_H +#define PARTITION_DATA_H + +using Tuple = std::tuple; + +struct PartitionData +{ + int mpi_world_rank; + std::unordered_set catchment_ids; + std::unordered_set nexus_ids; + std::vector remote_connections; +}; + +#endif //PARTITION_DATA_H diff --git a/include/core/Partition_One.hpp b/include/core/Partition_One.hpp new file mode 100644 index 0000000000..20f756d643 --- /dev/null +++ b/include/core/Partition_One.hpp @@ -0,0 +1,47 @@ +#ifndef PARTITION_ONE_H +#define PARTITION_ONE_H + +#ifdef NGEN_MPI_ACTIVE + +#include +#include +#include +#include +#include +#include +#include "features/Features.hpp" +#include +#include "Partition_Data.hpp" + +class Partition_One { + + public: + Partition_One() {}; + + void generate_partition(geojson::GeoJSON& catchment_collection) + { + int counter = 0; + for(auto& feature: *catchment_collection) + { + std::string cat_id = feature->get_id(); + catchment_ids.emplace(cat_id); + std::string nex_id = feature->get_property("toid").as_string(); + nexus_ids.emplace(nex_id); + counter++; + } + std::cout << "counter = " << counter << std::endl; + } + + virtual ~Partition_One(){}; + + PartitionData partition_data; + + private: + int mpi_world_rank; + std::unordered_set catchment_ids; + std::unordered_set nexus_ids; + std::vector remote_connections; +}; + +#endif // NGEN_MPI_ACTIVE +#endif // PARTITION_ONE_H diff --git a/include/core/Partition_Parser.hpp b/include/core/Partition_Parser.hpp index 9c0e740bfb..d9f1adfe44 100644 --- a/include/core/Partition_Parser.hpp +++ b/include/core/Partition_Parser.hpp @@ -20,18 +20,7 @@ #include "features/Features.hpp" #include #include "JSONProperty.hpp" - -using Tuple = std::tuple; - -//This struct is moved from private section to here so that the unit test function can access it -struct PartitionData -{ - int mpi_world_rank; - std::unordered_set catchment_ids; - std::unordered_set nexus_ids; - std::vector remote_connections; -}; - +#include "Partition_Data.hpp" class Partitions_Parser { diff --git a/src/NGen.cpp b/src/NGen.cpp index 74817737db..4101722940 100644 --- a/src/NGen.cpp +++ b/src/NGen.cpp @@ -52,6 +52,8 @@ int mpi_rank = 0; #include "core/Partition_Parser.hpp" #include +#include "core/Partition_One.hpp" + std::string PARTITION_PATH = ""; int mpi_num_procs; #endif // NGEN_MPI_ACTIVE @@ -249,10 +251,16 @@ int main(int argc, char *argv[]) { REALIZATION_CONFIG_PATH = argv[5]; #ifdef NGEN_MPI_ACTIVE + + // Initalize MPI + MPI_Init(NULL, NULL); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + MPI_Comm_size(MPI_COMM_WORLD, &mpi_num_procs); + if (argc >= 7) { PARTITION_PATH = argv[6]; } - else { + else if (mpi_num_procs > 1) { std::cout << "Missing required argument for partition file path." << std::endl; exit(-1); } @@ -261,17 +269,11 @@ int main(int argc, char *argv[]) { if (strcmp(argv[7], MPI_HF_SUB_CLI_FLAG) == 0) { is_subdivided_hydrofabric_wanted = true; } - else { + else if (mpi_num_procs > 1) { std::cout << "Unexpected arg '" << argv[7] << "'; try " << MPI_HF_SUB_CLI_FLAG << std::endl; exit(-1); } } - - // Initalize MPI - MPI_Init(NULL, NULL); - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - MPI_Comm_size(MPI_COMM_WORLD, &mpi_num_procs); - #endif // NGEN_MPI_ACTIVE #ifdef WRITE_PID_FILE_FOR_GDB_SERVER @@ -336,20 +338,24 @@ int main(int argc, char *argv[]) { std::cout << "Building Nexus collection" << std::endl; #ifdef NGEN_MPI_ACTIVE - Partitions_Parser partition_parser(PARTITION_PATH); - // TODO: add something here to make sure this step worked for every rank, and maybe to checksum the file - partition_parser.parse_partition_file(); - - std::vector &partitions = partition_parser.partition_ranks; - PartitionData &local_data = partitions[mpi_rank]; - if (!nexus_subset_ids.empty()) { - std::cerr << "Warning: CLI provided nexus subset will be ignored when using partition config"; - } - if (!catchment_subset_ids.empty()) { - std::cerr << "Warning: CLI provided catchment subset will be ignored when using partition config"; + PartitionData local_data_tmp; + if (mpi_num_procs > 1) { + Partitions_Parser partition_parser(PARTITION_PATH); + // TODO: add something here to make sure this step worked for every rank, and maybe to checksum the file + partition_parser.parse_partition_file(); + + std::vector &partitions = partition_parser.partition_ranks; + PartitionData local_data_tmp = partitions[mpi_rank]; + if (!nexus_subset_ids.empty()) { + std::cerr << "Warning: CLI provided nexus subset will be ignored when using partition config"; + } + if (!catchment_subset_ids.empty()) { + std::cerr << "Warning: CLI provided catchment subset will be ignored when using partition config"; + } + nexus_subset_ids = std::vector(local_data_tmp.nexus_ids.begin(), local_data_tmp.nexus_ids.end()); + catchment_subset_ids = std::vector(local_data_tmp.catchment_ids.begin(), local_data_tmp.catchment_ids.end()); } - nexus_subset_ids = std::vector(local_data.nexus_ids.begin(), local_data.nexus_ids.end()); - catchment_subset_ids = std::vector(local_data.catchment_ids.begin(), local_data.catchment_ids.end()); + PartitionData& local_data = local_data_tmp; #endif // NGEN_MPI_ACTIVE // TODO: Instead of iterating through a collection of FeatureBase objects mapping to nexi, we instead want to iterate through HY_HydroLocation objects @@ -376,17 +382,20 @@ int main(int argc, char *argv[]) { } else { catchment_collection = geojson::read(catchmentDataFile, catchment_subset_ids); } + std::cout << "Building Nexus collection" << std::endl; for(auto& feature: *catchment_collection) { - //feature->set_id(feature->get_property("ID").as_string()); + std::cout << "cat feature: " << feature << std::endl; + //feature->set_id(feature->get_property("id").as_string()); nexus_collection->add_feature(feature); - //std::cout<<"Catchment "<get_id()<<" -> Nexus "<get_property("toID").as_string()<get_id()<<" -> Nexus "<get_property("toid").as_string()<update_ids("id"); - std::cout<<"Initializing formulations\n"; + //std::cout<<"Initializing formulations\n"; + std::cout<<"Initializing formulations" << std::endl; std::shared_ptr manager = std::make_shared(REALIZATION_CONFIG_PATH); manager->read(catchment_collection, utils::getStdOut()); @@ -406,10 +415,17 @@ int main(int argc, char *argv[]) { } } #endif //NGEN_ROUTING_ACTIVE - std::cout<<"Building Feature Index\n"; + std::cout<<"Building Feature Index" <link_features_from_property(nullptr, &link_key); + #ifdef NGEN_MPI_ACTIVE + Partition_One partition_one; + //mpirun with one processor without partition file + if (mpi_num_procs == 1) { + partition_one.generate_partition(catchment_collection); + local_data = partition_one.partition_data; + } hy_features::HY_Features_MPI features = hy_features::HY_Features_MPI(local_data, nexus_collection, manager, mpi_rank, mpi_num_procs); #else hy_features::HY_Features features = hy_features::HY_Features(nexus_collection, manager); @@ -425,7 +441,11 @@ int main(int argc, char *argv[]) { //Still hacking nexus output for the moment for(const auto& id : features.nexuses()) { #ifdef NGEN_MPI_ACTIVE - if (!features.is_remote_sender_nexus(id)) { + if (mpi_num_procs > 1) { + if (!features.is_remote_sender_nexus(id)) { + nexus_outfiles[id].open(manager->get_output_root() + id + "_output.csv", std::ios::trunc); + } + } else { nexus_outfiles[id].open(manager->get_output_root() + id + "_output.csv", std::ios::trunc); } #else @@ -472,6 +492,13 @@ int main(int argc, char *argv[]) { // make a new simulation time object with a different output interval Simulation_Time sim_time(*manager->Simulation_Time_Object, time_steps[i]); + /* + for ( std::string id : features.catchments(keys[i]) ) { cat_ids.push_back(id); } + if (keys[i] != 0 ) + { + layers[i] = std::make_shared(desc, cat_ids, sim_time, features, catchment_collection, 0); + } + */ for ( std::string id : features.catchments(keys[i]) ) { cat_ids.push_back(id); } if (keys[i] != 0 ) { @@ -479,6 +506,7 @@ int main(int argc, char *argv[]) { } else { + //layers[i] = std::make_shared(desc, cat_ids, sim_time, features, catchment_collection, 0, nexus_subset_ids, nexus_outfiles); layers[i] = std::make_shared(desc, cat_ids, sim_time, features, catchment_collection, 0, nexus_subset_ids, nexus_outfiles); } From ea037dc99e0fa60c1fbb062b3baab28ca482e19b Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Mon, 5 Feb 2024 14:04:43 +0000 Subject: [PATCH 04/20] Add comments to function and some revisions --- include/core/Partition_One.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/core/Partition_One.hpp b/include/core/Partition_One.hpp index 20f756d643..b088776f06 100644 --- a/include/core/Partition_One.hpp +++ b/include/core/Partition_One.hpp @@ -18,22 +18,25 @@ class Partition_One { public: Partition_One() {}; + /** + * The function that parses geojson::GeoJSON data and build unordered sets of catchment_ids and nexus_ids + + * @param catchment_collection the geojson::GeoJSON data containing all the necessary hydrofabric info + */ void generate_partition(geojson::GeoJSON& catchment_collection) { - int counter = 0; for(auto& feature: *catchment_collection) { std::string cat_id = feature->get_id(); catchment_ids.emplace(cat_id); std::string nex_id = feature->get_property("toid").as_string(); nexus_ids.emplace(nex_id); - counter++; } - std::cout << "counter = " << counter << std::endl; } virtual ~Partition_One(){}; + //PartitionData is a struct PartitionData partition_data; private: From 07d0fc7f0e272c13bd0e13ce0623f6cf885dd931 Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Mon, 5 Feb 2024 20:02:41 +0000 Subject: [PATCH 05/20] Fix a potential bug --- include/core/Partition_One.hpp | 3 +++ src/NGen.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/core/Partition_One.hpp b/include/core/Partition_One.hpp index b088776f06..4cbe8b6f38 100644 --- a/include/core/Partition_One.hpp +++ b/include/core/Partition_One.hpp @@ -32,6 +32,9 @@ class Partition_One { std::string nex_id = feature->get_property("toid").as_string(); nexus_ids.emplace(nex_id); } + partition_data.mpi_world_rank = 0; + partition_data.catchment_ids = catchment_ids; + partition_data.nexus_ids = nexus_ids; } virtual ~Partition_One(){}; diff --git a/src/NGen.cpp b/src/NGen.cpp index 4101722940..25e56114dc 100644 --- a/src/NGen.cpp +++ b/src/NGen.cpp @@ -345,7 +345,7 @@ int main(int argc, char *argv[]) { partition_parser.parse_partition_file(); std::vector &partitions = partition_parser.partition_ranks; - PartitionData local_data_tmp = partitions[mpi_rank]; + local_data_tmp = partitions[mpi_rank]; if (!nexus_subset_ids.empty()) { std::cerr << "Warning: CLI provided nexus subset will be ignored when using partition config"; } From d016eb7fb76cedef1ca10ae42fb57b24703697c2 Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Tue, 6 Feb 2024 19:19:28 +0000 Subject: [PATCH 06/20] Add unit test for Patition_One --- test/CMakeLists.txt | 12 +++ test/utils/Partition_One_Test.cpp | 172 ++++++++++++++++++++++++++++++ 2 files changed, 184 insertions(+) create mode 100644 test/utils/Partition_One_Test.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a6aed84bf0..5da893be33 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -229,6 +229,17 @@ ngen_add_test( # NGEN_WITH_MPI ) +########################## Partition_One Tests +ngen_add_test( + test_partition_one + OBJECTS + utils/Partition_One_Test.cpp + LIBRARIES + gmock + NGen::core + NGen::geojson +) + ########################## MultiLayer Tests ngen_add_test( test_multilayer @@ -434,6 +445,7 @@ ngen_add_test( utils/include/StreamOutputTest.cpp realizations/Formulation_Manager_Test.cpp utils/Partition_Test.cpp + utils/Partition_One_Test.cpp utils/mdarray_Test.cpp utils/mdframe_Test.cpp utils/mdframe_netcdf_Test.cpp diff --git a/test/utils/Partition_One_Test.cpp b/test/utils/Partition_One_Test.cpp new file mode 100644 index 0000000000..a0fa3a2ddd --- /dev/null +++ b/test/utils/Partition_One_Test.cpp @@ -0,0 +1,172 @@ +#include "gtest/gtest.h" +#include "gmock/gmock.h" +#include + +#include +#include +#include + +//This way we can test the partition, since this doesn't have an explicit MPI dependency +#define NGEN_MPI_ACTIVE +#include "core/Partition_One.hpp" +#include "FileChecker.h" + + +class PartitionOneTest: public ::testing::Test { + + protected: + + std::vector hydro_fabric_paths; + + std::string catchmentDataFile; + geojson::GeoJSON catchment_collection; + + std::vector catchment_subset_ids; + std::vector nexus_subset_ids; + + std::unordered_set catchment_ids; + std::unordered_set nexus_ids; + + PartitionOneTest() {} + + ~PartitionOneTest() override {} + + std::string file_search(const std::vector &parent_dir_options, const std::string& file_basename) + { + // Build vector of names by building combinations of the path and basename options + std::vector name_combinations; + + // Build so that all path names are tried for given basename before trying a different basename option + for (auto & path_option : parent_dir_options) + name_combinations.push_back(path_option + file_basename); + + return utils::FileChecker::find_first_readable(name_combinations); + } + + void read_file_generate_partition_data() + { + const std::string file_path = file_search(hydro_fabric_paths, "catchment_data.geojson"); + if (boost::algorithm::ends_with(catchmentDataFile, "gpkg")) { + #ifdef NGEN_WITH_SQLITE3 + catchment_collection = ngen::geopackage::read(catchmentDataFile, "divides", catchment_subset_ids); + #else + throw std::runtime_error("SQLite3 support required to read GeoPackage files."); + #endif + } else { + catchment_collection = geojson::read(file_path, catchment_subset_ids); + } + + for(auto& feature: *catchment_collection) + { + std::string cat_id = feature->get_id(); + catchment_ids.emplace(cat_id); + std::string nex_id = feature->get_property("toid").as_string(); + nexus_ids.emplace(nex_id); + } + } + + void SetUp() override; + + void TearDown() override; + + void setupArbitraryExampleCase(); + +}; + +void PartitionOneTest::SetUp() { + setupArbitraryExampleCase(); +} + +void PartitionOneTest::TearDown() { + +} + +void PartitionOneTest::setupArbitraryExampleCase() { + hydro_fabric_paths = { + "data/", + "./data/", + "../data/", + "../../data/", + + }; +} + +TEST_F(PartitionOneTest, TestPartitionOne) +{ + read_file_generate_partition_data(); + + // Using the PartitionData struct for validating the Partition_One class result + Partition_One partition_one; + partition_one.generate_partition(catchment_collection); + PartitionData data_struct = partition_one.partition_data; + + ASSERT_TRUE(catchment_ids.size() == data_struct.catchment_ids.size()); + ASSERT_TRUE(nexus_ids.size() == data_struct.nexus_ids.size()); +} + +TEST_F(PartitionOneTest, TestPartitionData_1a) +{ + read_file_generate_partition_data(); + + Partition_One partition_one; + partition_one.generate_partition(catchment_collection); + PartitionData data_struct = partition_one.partition_data; + catchment_ids = data_struct.catchment_ids; + + //check catchment partition + std::vector cat_id_vec; + // convert unordered_set to vector + for (const auto& id: catchment_ids) { + cat_id_vec.push_back(id); + } + + //sort ids + std::sort(cat_id_vec.begin(), cat_id_vec.end()); + //create set of unique ids + std::set unique(cat_id_vec.begin(), cat_id_vec.end()); + std::set duplicates; + //use set difference to identify all duplicates + std::set_difference(cat_id_vec.begin(), cat_id_vec.end(), unique.begin(), unique.end(), std::inserter(duplicates, duplicates.end())); + if( duplicates.size() > 0 ){ + for( auto& id: duplicates){ + std::cout << "catchment "< nex_id_vec; + //convert unordered_set to vector + for (const auto& id: nexus_ids) { + nex_id_vec.push_back(id); + } + + //sort ids + std::sort(nex_id_vec.begin(), nex_id_vec.end()); + //create set of unique ids + std::set unique(nex_id_vec.begin(), nex_id_vec.end()); + std::set duplicates; + //use set difference to identify all duplicates + std::set_difference(nex_id_vec.begin(), nex_id_vec.end(), unique.begin(), unique.end(), std::inserter(duplicates, duplicates.end())); + if( duplicates.size() > 0 ){ + for( auto& id: duplicates){ + std::cout << "nexus "< Date: Tue, 6 Feb 2024 19:44:18 +0000 Subject: [PATCH 07/20] Fix unit test error --- test/utils/Partition_One_Test.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/utils/Partition_One_Test.cpp b/test/utils/Partition_One_Test.cpp index a0fa3a2ddd..526a4f5eaf 100644 --- a/test/utils/Partition_One_Test.cpp +++ b/test/utils/Partition_One_Test.cpp @@ -6,6 +6,10 @@ #include #include +#ifdef NGEN_WITH_SQLITE3 +#include +#endif + //This way we can test the partition, since this doesn't have an explicit MPI dependency #define NGEN_MPI_ACTIVE #include "core/Partition_One.hpp" From 3e6a0d18f63fa46d4de5cb1379a4321f3273df75 Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Tue, 6 Feb 2024 21:15:48 +0000 Subject: [PATCH 08/20] Fix build tree --- test/CMakeLists.txt | 4 ++++ test/utils/Partition_One_Test.cpp | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5da893be33..4c04ab08e4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -238,6 +238,9 @@ ngen_add_test( gmock NGen::core NGen::geojson + NGen::geopackage + #REQUIRES + # NGEN_WITH_SQLITE ) ########################## MultiLayer Tests @@ -458,6 +461,7 @@ ngen_add_test( NGen::core_mediator NGen::forcing NGen::geojson + NGen::geopackage NGen::realizations_catchment NGen::mdarray NGen::mdframe diff --git a/test/utils/Partition_One_Test.cpp b/test/utils/Partition_One_Test.cpp index 526a4f5eaf..f679ddb755 100644 --- a/test/utils/Partition_One_Test.cpp +++ b/test/utils/Partition_One_Test.cpp @@ -6,9 +6,7 @@ #include #include -#ifdef NGEN_WITH_SQLITE3 -#include -#endif +#include "geopackage.hpp" //This way we can test the partition, since this doesn't have an explicit MPI dependency #define NGEN_MPI_ACTIVE From 7ff27dce5b1198a7d23f130c7ff92c6e0d17ba11 Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Tue, 6 Feb 2024 22:32:48 +0000 Subject: [PATCH 09/20] Try an example --- test/CMakeLists.txt | 4 ++-- test/utils/Partition_One_Test.cpp | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4c04ab08e4..c87cd2efed 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -239,8 +239,8 @@ ngen_add_test( NGen::core NGen::geojson NGen::geopackage - #REQUIRES - # NGEN_WITH_SQLITE + REQUIRES + NGEN_WITH_SQLITE ) ########################## MultiLayer Tests diff --git a/test/utils/Partition_One_Test.cpp b/test/utils/Partition_One_Test.cpp index f679ddb755..526a4f5eaf 100644 --- a/test/utils/Partition_One_Test.cpp +++ b/test/utils/Partition_One_Test.cpp @@ -6,7 +6,9 @@ #include #include -#include "geopackage.hpp" +#ifdef NGEN_WITH_SQLITE3 +#include +#endif //This way we can test the partition, since this doesn't have an explicit MPI dependency #define NGEN_MPI_ACTIVE From ee33633587ebe89afeb5b22fe1750550ebc41852 Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Tue, 6 Feb 2024 22:47:59 +0000 Subject: [PATCH 10/20] Fix CMakeLists.txt --- test/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c87cd2efed..4443382b54 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -468,6 +468,8 @@ ngen_add_test( NGen::logging NGen::ngen_bmi testbmicppmodel + REQUIRES + NGEN_WITH_SQLITE ) From 1ce05c0bed69903caf0ce5f9ca5f90d14f2fc6e8 Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Wed, 7 Feb 2024 19:47:07 +0000 Subject: [PATCH 11/20] Incorporate reviewer's suggestions --- include/core/Partition_Data.hpp | 3 ++- include/core/Partition_One.hpp | 13 +++---------- include/core/Partition_Parser.hpp | 5 +++-- test/utils/Partition_One_Test.cpp | 24 +++++------------------- 4 files changed, 13 insertions(+), 32 deletions(-) diff --git a/include/core/Partition_Data.hpp b/include/core/Partition_Data.hpp index 5fe1de14a1..0fe8a0f2cf 100644 --- a/include/core/Partition_Data.hpp +++ b/include/core/Partition_Data.hpp @@ -1,10 +1,11 @@ #ifndef PARTITION_DATA_H #define PARTITION_DATA_H -using Tuple = std::tuple; +//using Tuple = std::tuple; struct PartitionData { +using Tuple = std::tuple; int mpi_world_rank; std::unordered_set catchment_ids; std::unordered_set nexus_ids; diff --git a/include/core/Partition_One.hpp b/include/core/Partition_One.hpp index 4cbe8b6f38..3ed28806a8 100644 --- a/include/core/Partition_One.hpp +++ b/include/core/Partition_One.hpp @@ -25,28 +25,21 @@ class Partition_One { */ void generate_partition(geojson::GeoJSON& catchment_collection) { + //PartitionData partition_data; for(auto& feature: *catchment_collection) { std::string cat_id = feature->get_id(); - catchment_ids.emplace(cat_id); + partition_data.catchment_ids.emplace(cat_id); std::string nex_id = feature->get_property("toid").as_string(); - nexus_ids.emplace(nex_id); + partition_data.nexus_ids.emplace(nex_id); } partition_data.mpi_world_rank = 0; - partition_data.catchment_ids = catchment_ids; - partition_data.nexus_ids = nexus_ids; } virtual ~Partition_One(){}; //PartitionData is a struct PartitionData partition_data; - - private: - int mpi_world_rank; - std::unordered_set catchment_ids; - std::unordered_set nexus_ids; - std::vector remote_connections; }; #endif // NGEN_MPI_ACTIVE diff --git a/include/core/Partition_Parser.hpp b/include/core/Partition_Parser.hpp index d9f1adfe44..fcdd3a9542 100644 --- a/include/core/Partition_Parser.hpp +++ b/include/core/Partition_Parser.hpp @@ -52,8 +52,9 @@ class Partitions_Parser { std::string remote_nex_id; std::string remote_cat_id; std::string direction; - Tuple tmp_tuple; - std::vector remote_conn_vec; + //Tuple tmp_tuple; + PartitionData::Tuple tmp_tuple; + std::vector remote_conn_vec; int part_counter = 0; for(auto &partition: tree.get_child("partitions")) { //Get partition id diff --git a/test/utils/Partition_One_Test.cpp b/test/utils/Partition_One_Test.cpp index 526a4f5eaf..bc33db4201 100644 --- a/test/utils/Partition_One_Test.cpp +++ b/test/utils/Partition_One_Test.cpp @@ -31,6 +31,9 @@ class PartitionOneTest: public ::testing::Test { std::unordered_set catchment_ids; std::unordered_set nexus_ids; + Partition_One partition_one; + PartitionData partition_data; + PartitionOneTest() {} ~PartitionOneTest() override {} @@ -63,9 +66,9 @@ class PartitionOneTest: public ::testing::Test { for(auto& feature: *catchment_collection) { std::string cat_id = feature->get_id(); - catchment_ids.emplace(cat_id); + partition_data.catchment_ids.emplace(cat_id); std::string nex_id = feature->get_property("toid").as_string(); - nexus_ids.emplace(nex_id); + partition_data.nexus_ids.emplace(nex_id); } } @@ -95,24 +98,10 @@ void PartitionOneTest::setupArbitraryExampleCase() { }; } -TEST_F(PartitionOneTest, TestPartitionOne) -{ - read_file_generate_partition_data(); - - // Using the PartitionData struct for validating the Partition_One class result - Partition_One partition_one; - partition_one.generate_partition(catchment_collection); - PartitionData data_struct = partition_one.partition_data; - - ASSERT_TRUE(catchment_ids.size() == data_struct.catchment_ids.size()); - ASSERT_TRUE(nexus_ids.size() == data_struct.nexus_ids.size()); -} - TEST_F(PartitionOneTest, TestPartitionData_1a) { read_file_generate_partition_data(); - Partition_One partition_one; partition_one.generate_partition(catchment_collection); PartitionData data_struct = partition_one.partition_data; catchment_ids = data_struct.catchment_ids; @@ -133,7 +122,6 @@ TEST_F(PartitionOneTest, TestPartitionData_1a) std::set_difference(cat_id_vec.begin(), cat_id_vec.end(), unique.begin(), unique.end(), std::inserter(duplicates, duplicates.end())); if( duplicates.size() > 0 ){ for( auto& id: duplicates){ - std::cout << "catchment "< 0 ){ for( auto& id: duplicates){ - std::cout << "nexus "< Date: Wed, 7 Feb 2024 21:46:53 +0000 Subject: [PATCH 12/20] Some minor clean up --- src/NGen.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/NGen.cpp b/src/NGen.cpp index 25e56114dc..8caafee3eb 100644 --- a/src/NGen.cpp +++ b/src/NGen.cpp @@ -382,19 +382,16 @@ int main(int argc, char *argv[]) { } else { catchment_collection = geojson::read(catchmentDataFile, catchment_subset_ids); } - std::cout << "Building Nexus collection" << std::endl; for(auto& feature: *catchment_collection) { - std::cout << "cat feature: " << feature << std::endl; //feature->set_id(feature->get_property("id").as_string()); nexus_collection->add_feature(feature); - std::cout<<"Catchment "<get_id()<<" -> Nexus "<get_property("toid").as_string()<get_id()<<" -> Nexus "<get_property("toid").as_string()<update_ids("id"); - //std::cout<<"Initializing formulations\n"; std::cout<<"Initializing formulations" << std::endl; std::shared_ptr manager = std::make_shared(REALIZATION_CONFIG_PATH); manager->read(catchment_collection, utils::getStdOut()); @@ -492,13 +489,6 @@ int main(int argc, char *argv[]) { // make a new simulation time object with a different output interval Simulation_Time sim_time(*manager->Simulation_Time_Object, time_steps[i]); - /* - for ( std::string id : features.catchments(keys[i]) ) { cat_ids.push_back(id); } - if (keys[i] != 0 ) - { - layers[i] = std::make_shared(desc, cat_ids, sim_time, features, catchment_collection, 0); - } - */ for ( std::string id : features.catchments(keys[i]) ) { cat_ids.push_back(id); } if (keys[i] != 0 ) { @@ -506,7 +496,6 @@ int main(int argc, char *argv[]) { } else { - //layers[i] = std::make_shared(desc, cat_ids, sim_time, features, catchment_collection, 0, nexus_subset_ids, nexus_outfiles); layers[i] = std::make_shared(desc, cat_ids, sim_time, features, catchment_collection, 0, nexus_subset_ids, nexus_outfiles); } From 16e766197582a080b55658a08282936869a488a4 Mon Sep 17 00:00:00 2001 From: Phil Miller Date: Fri, 23 Feb 2024 15:41:47 -0800 Subject: [PATCH 13/20] Clean up commented replaced code and indentation --- include/core/Partition_Data.hpp | 4 +--- include/core/Partition_One.hpp | 2 -- include/core/Partition_Parser.hpp | 1 - 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/include/core/Partition_Data.hpp b/include/core/Partition_Data.hpp index 0fe8a0f2cf..992edfab9b 100644 --- a/include/core/Partition_Data.hpp +++ b/include/core/Partition_Data.hpp @@ -1,11 +1,9 @@ #ifndef PARTITION_DATA_H #define PARTITION_DATA_H -//using Tuple = std::tuple; - struct PartitionData { -using Tuple = std::tuple; + using Tuple = std::tuple; int mpi_world_rank; std::unordered_set catchment_ids; std::unordered_set nexus_ids; diff --git a/include/core/Partition_One.hpp b/include/core/Partition_One.hpp index 3ed28806a8..2b141c866a 100644 --- a/include/core/Partition_One.hpp +++ b/include/core/Partition_One.hpp @@ -25,7 +25,6 @@ class Partition_One { */ void generate_partition(geojson::GeoJSON& catchment_collection) { - //PartitionData partition_data; for(auto& feature: *catchment_collection) { std::string cat_id = feature->get_id(); @@ -38,7 +37,6 @@ class Partition_One { virtual ~Partition_One(){}; - //PartitionData is a struct PartitionData partition_data; }; diff --git a/include/core/Partition_Parser.hpp b/include/core/Partition_Parser.hpp index fcdd3a9542..cc29a40377 100644 --- a/include/core/Partition_Parser.hpp +++ b/include/core/Partition_Parser.hpp @@ -52,7 +52,6 @@ class Partitions_Parser { std::string remote_nex_id; std::string remote_cat_id; std::string direction; - //Tuple tmp_tuple; PartitionData::Tuple tmp_tuple; std::vector remote_conn_vec; int part_counter = 0; From 5c2568ad96968da619c80a3dbfb3f57fa0886252 Mon Sep 17 00:00:00 2001 From: Phil Miller Date: Fri, 23 Feb 2024 15:45:49 -0800 Subject: [PATCH 14/20] Don't specify empty default constructor and destructor --- include/core/Partition_One.hpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/core/Partition_One.hpp b/include/core/Partition_One.hpp index 2b141c866a..c18fa6b696 100644 --- a/include/core/Partition_One.hpp +++ b/include/core/Partition_One.hpp @@ -16,8 +16,6 @@ class Partition_One { public: - Partition_One() {}; - /** * The function that parses geojson::GeoJSON data and build unordered sets of catchment_ids and nexus_ids @@ -35,8 +33,6 @@ class Partition_One { partition_data.mpi_world_rank = 0; } - virtual ~Partition_One(){}; - PartitionData partition_data; }; From 03ac3a2b4a9aec93234fbb8b37de4d9d22fac15b Mon Sep 17 00:00:00 2001 From: Phil Miller Date: Fri, 23 Feb 2024 16:49:20 -0800 Subject: [PATCH 15/20] Simplify and optimize logic selecting between explicit partition and implicit single-process partition --- src/NGen.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/NGen.cpp b/src/NGen.cpp index 8caafee3eb..f68ba15a9d 100644 --- a/src/NGen.cpp +++ b/src/NGen.cpp @@ -338,24 +338,23 @@ int main(int argc, char *argv[]) { std::cout << "Building Nexus collection" << std::endl; #ifdef NGEN_MPI_ACTIVE - PartitionData local_data_tmp; + PartitionData local_data; if (mpi_num_procs > 1) { Partitions_Parser partition_parser(PARTITION_PATH); // TODO: add something here to make sure this step worked for every rank, and maybe to checksum the file partition_parser.parse_partition_file(); std::vector &partitions = partition_parser.partition_ranks; - local_data_tmp = partitions[mpi_rank]; + local_data = std::move(partitions[mpi_rank]); if (!nexus_subset_ids.empty()) { std::cerr << "Warning: CLI provided nexus subset will be ignored when using partition config"; } if (!catchment_subset_ids.empty()) { std::cerr << "Warning: CLI provided catchment subset will be ignored when using partition config"; } - nexus_subset_ids = std::vector(local_data_tmp.nexus_ids.begin(), local_data_tmp.nexus_ids.end()); - catchment_subset_ids = std::vector(local_data_tmp.catchment_ids.begin(), local_data_tmp.catchment_ids.end()); + nexus_subset_ids = std::vector(local_data.nexus_ids.begin(), local_data.nexus_ids.end()); + catchment_subset_ids = std::vector(local_data.catchment_ids.begin(), local_data.catchment_ids.end()); } - PartitionData& local_data = local_data_tmp; #endif // NGEN_MPI_ACTIVE // TODO: Instead of iterating through a collection of FeatureBase objects mapping to nexi, we instead want to iterate through HY_HydroLocation objects @@ -417,11 +416,11 @@ int main(int argc, char *argv[]) { nexus_collection->link_features_from_property(nullptr, &link_key); #ifdef NGEN_MPI_ACTIVE - Partition_One partition_one; //mpirun with one processor without partition file if (mpi_num_procs == 1) { + Partition_One partition_one; partition_one.generate_partition(catchment_collection); - local_data = partition_one.partition_data; + local_data = std::move(partition_one.partition_data); } hy_features::HY_Features_MPI features = hy_features::HY_Features_MPI(local_data, nexus_collection, manager, mpi_rank, mpi_num_procs); #else From 7576421a342cbfaba7604ddde5093fb8780b0d9e Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Mon, 26 Feb 2024 20:48:00 +0000 Subject: [PATCH 16/20] Refactor & revise Partition_One_Test --- test/CMakeLists.txt | 5 ----- test/utils/Partition_One_Test.cpp | 21 ++++++++++++--------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4443382b54..ba8f0624d8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -448,7 +448,6 @@ ngen_add_test( utils/include/StreamOutputTest.cpp realizations/Formulation_Manager_Test.cpp utils/Partition_Test.cpp - utils/Partition_One_Test.cpp utils/mdarray_Test.cpp utils/mdframe_Test.cpp utils/mdframe_netcdf_Test.cpp @@ -461,16 +460,12 @@ ngen_add_test( NGen::core_mediator NGen::forcing NGen::geojson - NGen::geopackage NGen::realizations_catchment NGen::mdarray NGen::mdframe NGen::logging NGen::ngen_bmi testbmicppmodel - REQUIRES - NGEN_WITH_SQLITE - ) # Discover for test_all diff --git a/test/utils/Partition_One_Test.cpp b/test/utils/Partition_One_Test.cpp index bc33db4201..3125b885f5 100644 --- a/test/utils/Partition_One_Test.cpp +++ b/test/utils/Partition_One_Test.cpp @@ -120,13 +120,14 @@ TEST_F(PartitionOneTest, TestPartitionData_1a) std::set duplicates; //use set difference to identify all duplicates std::set_difference(cat_id_vec.begin(), cat_id_vec.end(), unique.begin(), unique.end(), std::inserter(duplicates, duplicates.end())); - if( duplicates.size() > 0 ){ - for( auto& id: duplicates){ + + for( auto& id: duplicates){ + if (!id.empty()) { + std::cout << "duplicates string set is not empty" << std::endl; + break; } - exit(1); } - - ASSERT_TRUE(true); + ASSERT_EQ(duplicates.size(), 0); } TEST_F(PartitionOneTest, TestPartitionData_1b) @@ -151,12 +152,14 @@ TEST_F(PartitionOneTest, TestPartitionData_1b) std::set duplicates; //use set difference to identify all duplicates std::set_difference(nex_id_vec.begin(), nex_id_vec.end(), unique.begin(), unique.end(), std::inserter(duplicates, duplicates.end())); - if( duplicates.size() > 0 ){ - for( auto& id: duplicates){ + + for( auto& id: duplicates){ + if (!id.empty()) { + std::cout << "duplicates string set is not empty" << std::endl; + break; } - exit(1); } - ASSERT_TRUE(true); + ASSERT_EQ(duplicates.size(), 0); } #undef NGEN_MPI_ACTIVE From 793e2f14105e6d2f70aea44e446d5b7d3193d87a Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Wed, 28 Feb 2024 19:48:22 +0000 Subject: [PATCH 17/20] Revise Pattition_One_Test and restore documentation.yml in workflows --- .github/workflows/documentation.yml | 3 --- test/utils/Partition_One_Test.cpp | 16 ++-------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 69aa15e721..87caed2573 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -46,9 +46,6 @@ jobs: - name: Prevent generated docs dir from being committed and overwriting on the next run. run: rm -Rf docs/html - - name: Prevent generated docs dir from being committed and overwriting on the next run. - run: rm -Rf docs/html - - name: Update branch information run: git fetch --all; git branch --list -r; diff --git a/test/utils/Partition_One_Test.cpp b/test/utils/Partition_One_Test.cpp index 3125b885f5..8015c57114 100644 --- a/test/utils/Partition_One_Test.cpp +++ b/test/utils/Partition_One_Test.cpp @@ -6,11 +6,7 @@ #include #include -#ifdef NGEN_WITH_SQLITE3 -#include -#endif - -//This way we can test the partition, since this doesn't have an explicit MPI dependency +//This way we can test the partition_one, since this doesn't have an explicit MPI dependency #define NGEN_MPI_ACTIVE #include "core/Partition_One.hpp" #include "FileChecker.h" @@ -53,15 +49,7 @@ class PartitionOneTest: public ::testing::Test { void read_file_generate_partition_data() { const std::string file_path = file_search(hydro_fabric_paths, "catchment_data.geojson"); - if (boost::algorithm::ends_with(catchmentDataFile, "gpkg")) { - #ifdef NGEN_WITH_SQLITE3 - catchment_collection = ngen::geopackage::read(catchmentDataFile, "divides", catchment_subset_ids); - #else - throw std::runtime_error("SQLite3 support required to read GeoPackage files."); - #endif - } else { - catchment_collection = geojson::read(file_path, catchment_subset_ids); - } + catchment_collection = geojson::read(file_path, catchment_subset_ids); for(auto& feature: *catchment_collection) { From 5c3b7d969bd786e9abcc0c1f6283aa9f76718830 Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Fri, 8 Mar 2024 20:33:48 +0000 Subject: [PATCH 18/20] Revise Partition_One_Test.cpp --- test/utils/Partition_One_Test.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/test/utils/Partition_One_Test.cpp b/test/utils/Partition_One_Test.cpp index 8015c57114..1a6bb6f7e1 100644 --- a/test/utils/Partition_One_Test.cpp +++ b/test/utils/Partition_One_Test.cpp @@ -110,10 +110,7 @@ TEST_F(PartitionOneTest, TestPartitionData_1a) std::set_difference(cat_id_vec.begin(), cat_id_vec.end(), unique.begin(), unique.end(), std::inserter(duplicates, duplicates.end())); for( auto& id: duplicates){ - if (!id.empty()) { - std::cout << "duplicates string set is not empty" << std::endl; - break; - } + std::cout << "duplicates string set contains " << id << std::endl; } ASSERT_EQ(duplicates.size(), 0); } @@ -142,10 +139,7 @@ TEST_F(PartitionOneTest, TestPartitionData_1b) std::set_difference(nex_id_vec.begin(), nex_id_vec.end(), unique.begin(), unique.end(), std::inserter(duplicates, duplicates.end())); for( auto& id: duplicates){ - if (!id.empty()) { - std::cout << "duplicates string set is not empty" << std::endl; - break; - } + std::cout << "duplicates string set contains " << id << std::endl; } ASSERT_EQ(duplicates.size(), 0); } From a16e76b169b94dec6f083f7bcc2f2b39790dd5a7 Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Mon, 11 Mar 2024 20:05:50 +0000 Subject: [PATCH 19/20] Add input and partition data test --- test/utils/Partition_One_Test.cpp | 49 ++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/test/utils/Partition_One_Test.cpp b/test/utils/Partition_One_Test.cpp index 1a6bb6f7e1..c708858157 100644 --- a/test/utils/Partition_One_Test.cpp +++ b/test/utils/Partition_One_Test.cpp @@ -19,7 +19,7 @@ class PartitionOneTest: public ::testing::Test { std::vector hydro_fabric_paths; std::string catchmentDataFile; - geojson::GeoJSON catchment_collection; + geojson::GeoJSON catchment_collection, nexus_collection; std::vector catchment_subset_ids; std::vector nexus_subset_ids; @@ -60,6 +60,12 @@ class PartitionOneTest: public ::testing::Test { } } + void read_file_nexus_data() + { + const std::string file_path = file_search(hydro_fabric_paths, "nexus_data.geojson"); + nexus_collection = geojson::read(file_path, nexus_subset_ids); + } + void SetUp() override; void TearDown() override; @@ -112,12 +118,33 @@ TEST_F(PartitionOneTest, TestPartitionData_1a) for( auto& id: duplicates){ std::cout << "duplicates string set contains " << id << std::endl; } + + //process the original read in data + std::vector input_cat_ids; + for(auto& feature: *catchment_collection) + { + std::string cat_id = feature->get_id(); + input_cat_ids.push_back(cat_id); + } + std::sort(input_cat_ids.begin(), input_cat_ids.end()); + + for (int i = 0; i < input_cat_ids.size(); ++i) { + if (input_cat_ids[i] != cat_id_vec[i]) { + std::cout << "Input cat_id: " << input_cat_ids[i] << " differs from patition cat_id: " << cat_id_vec[i] << std::endl; + } + } + + //get input number of catchments + int num_catchments = catchment_collection->get_size(); + + ASSERT_EQ(catchment_ids.size(), num_catchments); ASSERT_EQ(duplicates.size(), 0); } TEST_F(PartitionOneTest, TestPartitionData_1b) { read_file_generate_partition_data(); + read_file_nexus_data(); partition_one.generate_partition(catchment_collection); PartitionData data_struct = partition_one.partition_data; @@ -141,6 +168,26 @@ TEST_F(PartitionOneTest, TestPartitionData_1b) for( auto& id: duplicates){ std::cout << "duplicates string set contains " << id << std::endl; } + + //process the original read in data + std::vector input_nex_ids; + for(auto& feature: *nexus_collection) + { + std::string nex_id = feature->get_id(); + input_nex_ids.push_back(nex_id); + } + std::sort(input_nex_ids.begin(), input_nex_ids.end()); + + for (int i = 0; i < input_nex_ids.size(); ++i) { + if (input_nex_ids[i] != nex_id_vec[i]) { + std::cout << "Input nex_id: " << input_nex_ids[i] << " differs from patition nex_id: " << nex_id_vec[i] << std::endl; + } + } + + //get input number of nexus + int num_nexus = nexus_collection->get_size(); + + ASSERT_EQ(nexus_ids.size(), num_nexus); ASSERT_EQ(duplicates.size(), 0); } From 1847b28706ac7bb13350ddd0407fcd26c82b5426 Mon Sep 17 00:00:00 2001 From: Phil Miller Date: Mon, 18 Mar 2024 16:40:04 -0700 Subject: [PATCH 20/20] Drop unnecessary MPI guards --- include/core/Partition_One.hpp | 3 --- test/utils/Partition_One_Test.cpp | 4 ---- 2 files changed, 7 deletions(-) diff --git a/include/core/Partition_One.hpp b/include/core/Partition_One.hpp index c18fa6b696..293160837a 100644 --- a/include/core/Partition_One.hpp +++ b/include/core/Partition_One.hpp @@ -1,8 +1,6 @@ #ifndef PARTITION_ONE_H #define PARTITION_ONE_H -#ifdef NGEN_MPI_ACTIVE - #include #include #include @@ -36,5 +34,4 @@ class Partition_One { PartitionData partition_data; }; -#endif // NGEN_MPI_ACTIVE #endif // PARTITION_ONE_H diff --git a/test/utils/Partition_One_Test.cpp b/test/utils/Partition_One_Test.cpp index c708858157..2e3e1f747a 100644 --- a/test/utils/Partition_One_Test.cpp +++ b/test/utils/Partition_One_Test.cpp @@ -6,8 +6,6 @@ #include #include -//This way we can test the partition_one, since this doesn't have an explicit MPI dependency -#define NGEN_MPI_ACTIVE #include "core/Partition_One.hpp" #include "FileChecker.h" @@ -190,5 +188,3 @@ TEST_F(PartitionOneTest, TestPartitionData_1b) ASSERT_EQ(nexus_ids.size(), num_nexus); ASSERT_EQ(duplicates.size(), 0); } - -#undef NGEN_MPI_ACTIVE