Skip to content
Snippets Groups Projects
Commit 54907ae7 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add mesh database infrastructure

The database is just populated with a small 3d cartesian grid which is
still inaccessible.

This is just a proof of concept: the mesh is build for both `unit_tests`
and `mpi_unit_tests`.

The optimization resulting from the previous is already noticed even
with Release build type.

Using `ctest` (old `make test`) one gets the following execution times
- without mesh building: 3s
- with a simple mesh building: 31s

Using the new `test` target one gets the following execution times
- without mesh building: 1.3s
- with a simple mesh building: 2.7s

(the `make test` results are actually obtained using `ninja` since the
test is so fast that the majority of the spent time using `make` is
spent computing target dependencies)

Using `make test` with the new `test` target one gets the following
execution times
- without mesh building: 1.95s
- with a simple mesh building: 3.45s
parent 4c53bd36
No related branches found
No related tags found
1 merge request!61Feature/mesh based ci
...@@ -89,7 +89,11 @@ add_executable (mpi_unit_tests ...@@ -89,7 +89,11 @@ add_executable (mpi_unit_tests
mpi_test_Messenger.cpp mpi_test_Messenger.cpp
) )
add_library(test_Pugs_MeshDataBase
test_MeshDataBase.cpp)
target_link_libraries (unit_tests target_link_libraries (unit_tests
test_Pugs_MeshDataBase
PugsLanguage PugsLanguage
PugsLanguageAST PugsLanguageAST
PugsLanguageModules PugsLanguageModules
...@@ -106,6 +110,7 @@ target_link_libraries (unit_tests ...@@ -106,6 +110,7 @@ target_link_libraries (unit_tests
) )
target_link_libraries (mpi_unit_tests target_link_libraries (mpi_unit_tests
test_Pugs_MeshDataBase
PugsUtils PugsUtils
PugsAlgebra PugsAlgebra
PugsMesh PugsMesh
......
...@@ -3,9 +3,15 @@ ...@@ -3,9 +3,15 @@
#include <Kokkos_Core.hpp> #include <Kokkos_Core.hpp>
#include <mesh/DiamondDualConnectivityManager.hpp>
#include <mesh/DiamondDualMeshManager.hpp>
#include <mesh/MeshDataManager.hpp>
#include <mesh/SynchronizerManager.hpp>
#include <utils/Messenger.hpp> #include <utils/Messenger.hpp>
#include <utils/pugs_config.hpp> #include <utils/pugs_config.hpp>
#include <test_MeshDataBase.hpp>
#include <cstdlib> #include <cstdlib>
#include <filesystem> #include <filesystem>
...@@ -30,9 +36,6 @@ main(int argc, char* argv[]) ...@@ -30,9 +36,6 @@ main(int argc, char* argv[])
if (parallel::rank() != 0) { if (parallel::rank() != 0) {
// Disable outputs for ranks != 0 // Disable outputs for ranks != 0
setenv("GCOV_PREFIX", gcov_prefix.string().c_str(), 1); setenv("GCOV_PREFIX", gcov_prefix.string().c_str(), 1);
std::cout << "putting gcov infos in " << gcov_prefix.string() << '\n';
parallel_output /= output_base_name + std::to_string(parallel::rank()); parallel_output /= output_base_name + std::to_string(parallel::rank());
Catch::ConfigData data{session.configData()}; Catch::ConfigData data{session.configData()};
...@@ -43,7 +46,13 @@ main(int argc, char* argv[]) ...@@ -43,7 +46,13 @@ main(int argc, char* argv[])
if (result == 0) { if (result == 0) {
// Disable outputs from tested classes to the standard output // Disable outputs from tested classes to the standard output
std::cout.setstate(std::ios::badbit); std::cout.setstate(std::ios::badbit);
result = session.run();
SynchronizerManager::create();
MeshDataManager::create();
DiamondDualConnectivityManager::create();
DiamondDualMeshManager::create();
test_MeshDataBase::create();
if (parallel::rank() == 0) { if (parallel::rank() == 0) {
if (parallel::size() > 1) { if (parallel::size() > 1) {
...@@ -59,6 +68,15 @@ main(int argc, char* argv[]) ...@@ -59,6 +68,15 @@ main(int argc, char* argv[])
} }
} }
} }
result = session.run();
test_MeshDataBase::destroy();
DiamondDualMeshManager::destroy();
DiamondDualConnectivityManager::destroy();
MeshDataManager::destroy();
SynchronizerManager::destroy();
} }
Kokkos::finalize(); Kokkos::finalize();
......
#include <test_MeshDataBase.hpp>
#include <utils/PugsAssert.hpp>
#include <mesh/CartesianMeshBuilder.hpp>
const test_MeshDataBase* test_MeshDataBase::m_instance = nullptr;
test_MeshDataBase::test_MeshDataBase()
{
std::make_shared<CartesianMeshBuilder>(TinyVector<3>{0, 1, 0}, TinyVector<3>{2, -1, 3},
TinyVector<3, size_t>{6, 7, 3});
}
const test_MeshDataBase&
test_MeshDataBase::get()
{
return *m_instance;
}
void
test_MeshDataBase::create()
{
Assert(m_instance == nullptr);
m_instance = new test_MeshDataBase();
}
void
test_MeshDataBase::destroy()
{
Assert(m_instance != nullptr);
delete m_instance;
m_instance = nullptr;
}
#ifndef TEST_MESH_DATA_BASE_HPP
#define TEST_MESH_DATA_BASE_HPP
#include <mesh/IMesh.hpp>
#include <memory>
class test_MeshDataBase
{
private:
explicit test_MeshDataBase();
static const test_MeshDataBase* m_instance;
public:
static const test_MeshDataBase& get();
static void create();
static void destroy();
~test_MeshDataBase() = default;
};
#endif // TEST_MESH_DATA_BASE_HPP
...@@ -3,9 +3,18 @@ ...@@ -3,9 +3,18 @@
#include <Kokkos_Core.hpp> #include <Kokkos_Core.hpp>
#include <mesh/DiamondDualConnectivityManager.hpp>
#include <mesh/DiamondDualMeshManager.hpp>
#include <mesh/MeshDataManager.hpp>
#include <mesh/SynchronizerManager.hpp>
#include <utils/Messenger.hpp>
#include <test_MeshDataBase.hpp>
int int
main(int argc, char* argv[]) main(int argc, char* argv[])
{ {
parallel::Messenger::create(argc, argv);
Kokkos::initialize({4, -1, -1, true}); Kokkos::initialize({4, -1, -1, true});
Catch::Session session; Catch::Session session;
...@@ -14,10 +23,26 @@ main(int argc, char* argv[]) ...@@ -14,10 +23,26 @@ main(int argc, char* argv[])
if (result == 0) { if (result == 0) {
// Disable outputs from tested classes to the standard output // Disable outputs from tested classes to the standard output
std::cout.setstate(std::ios::badbit); std::cout.setstate(std::ios::badbit);
SynchronizerManager::create();
MeshDataManager::create();
DiamondDualConnectivityManager::create();
DiamondDualMeshManager::create();
test_MeshDataBase::create();
result = session.run(); result = session.run();
test_MeshDataBase::destroy();
DiamondDualMeshManager::destroy();
DiamondDualConnectivityManager::destroy();
MeshDataManager::destroy();
SynchronizerManager::destroy();
} }
Kokkos::finalize(); Kokkos::finalize();
parallel::Messenger::destroy();
std::cout << "finalizing\n";
return result; return result;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment