Skip to content

Commit

Permalink
Merge pull request #12947 from KratosMultiphysics/core/adding-additio…
Browse files Browse the repository at this point in the history
…nal-theading-info-to-kernel

[Core] Adding additional SMP information into header information
  • Loading branch information
loumalouomega authored Dec 18, 2024
2 parents f9c61cf + 384fe0e commit 429f262
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions kratos/sources/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
//
// License: BSD License
// Kratos default license: kratos/license.txt
// License: BSD License
// Kratos default license: kratos/license.txt
//
// Main authors: Pooyan Dadvand
//
Expand Down Expand Up @@ -204,33 +204,39 @@ void Kernel::SetPythonVersion(std::string pyVersion) {

void Kernel::PrintParallelismSupportInfo() const
{
#ifdef KRATOS_SMP_NONE
#ifdef KRATOS_SMP_NONE
constexpr bool threading_support = false;
#else
constexpr auto smp = "None";
#else
constexpr bool threading_support = true;
std::string scheduling_str;
#if defined(KRATOS_SMP_OPENMP)
const auto smp = "OpenMP";
#elif defined(KRATOS_SMP_CXX11)
constexpr auto smp = "C++11";
#else
constexpr auto smp = "Unknown";
#endif
#endif

#ifdef KRATOS_USING_MPI
#ifdef KRATOS_USING_MPI
constexpr bool mpi_support = true;
#else
#else
constexpr bool mpi_support = false;
#endif
#endif

Logger logger("");
logger << LoggerMessage::Severity::INFO;

if (threading_support) {
if (mpi_support) {
logger << "Compiled with threading and MPI support." << std::endl;
logger << "Compiled with threading and MPI support. Threading support with " << smp << "." << std::endl;
} else {
logger << "Compiled with threading support. Threading support with " << smp << "." << std::endl;
}
else {
logger << "Compiled with threading support." << std::endl;
}
}
else if (mpi_support) {
} else if (mpi_support) {
logger << "Compiled with MPI support." << std::endl;
}
else {
} else {
logger << "Serial compilation." << std::endl;
}

Expand All @@ -242,8 +248,7 @@ void Kernel::PrintParallelismSupportInfo() const
if (mIsDistributedRun) {
const DataCommunicator& r_world = ParallelEnvironment::GetDataCommunicator("World");
logger << "MPI world size: " << r_world.Size() << "." << std::endl;
}
else {
} else {
logger << "Running without MPI." << std::endl;
}
}
Expand Down

0 comments on commit 429f262

Please sign in to comment.