Commit 66ece375 authored by Praetorius, Simon's avatar Praetorius, Simon

added flag ENABLE_MPI to cmake

parent b407fa8f
...@@ -179,6 +179,11 @@ add_library(amdis ...@@ -179,6 +179,11 @@ add_library(amdis
${SOURCE_DIR}/ProblemStatDbg.cc ${SOURCE_DIR}/ProblemStatDbg.cc
) )
if (ENABLE_MPI)
target_enable_mpi(amdis_base INTERFACE)
target_compile_definitions(amdis_base INTERFACE HAVE_MPI=1)
endif (ENABLE_MPI)
include(amdis_parallel) # adds sources to amdis include(amdis_parallel) # adds sources to amdis
include(amdis_extensions) # -> target AMDiS::extensions include(amdis_extensions) # -> target AMDiS::extensions
include(muparser) # -> target muparser include(muparser) # -> target muparser
......
...@@ -39,7 +39,7 @@ namespace AMDiS { ...@@ -39,7 +39,7 @@ namespace AMDiS {
const char *funcName = NULL; const char *funcName = NULL;
#if defined(HAVE_PARALLEL_DOMAIN_AMDIS) || defined(HAVE_OPENMP) #if defined(HAVE_PARALLEL_DOMAIN_AMDIS) || defined(HAVE_OPENMP) || defined(HAVE_MPI)
bool Msg::outputMainRank = true; bool Msg::outputMainRank = true;
#endif #endif
...@@ -132,7 +132,7 @@ namespace AMDiS { ...@@ -132,7 +132,7 @@ namespace AMDiS {
void Msg::print_funcname(const char *funcName) void Msg::print_funcname(const char *funcName)
{ {
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS #if defined(HAVE_PARALLEL_DOMAIN_AMDIS) || defined(HAVE_MPI)
if (outputMainRank && MPI::COMM_WORLD.Get_rank() != 0) if (outputMainRank && MPI::COMM_WORLD.Get_rank() != 0)
return; return;
#endif #endif
...@@ -227,7 +227,7 @@ namespace AMDiS { ...@@ -227,7 +227,7 @@ namespace AMDiS {
const char *file, const char *file,
int line) int line)
{ {
#if defined(HAVE_PARALLEL_DOMAIN_AMDIS) && defined(NDEBUG) #if (defined(HAVE_PARALLEL_DOMAIN_AMDIS) || defined(HAVE_MPI)) && defined(NDEBUG)
if (outputMainRank && MPI::COMM_WORLD.Get_rank() != 0) if (outputMainRank && MPI::COMM_WORLD.Get_rank() != 0)
return; return;
#endif #endif
...@@ -265,7 +265,7 @@ namespace AMDiS { ...@@ -265,7 +265,7 @@ namespace AMDiS {
void Msg::print_warn(const char *format, ...) void Msg::print_warn(const char *format, ...)
{ {
#if defined(HAVE_PARALLEL_DOMAIN_AMDIS) && defined(NDEBUG) #if (defined(HAVE_PARALLEL_DOMAIN_AMDIS) || defined(HAVE_MPI)) && defined(NDEBUG)
if (outputMainRank && MPI::COMM_WORLD.Get_rank() != 0) if (outputMainRank && MPI::COMM_WORLD.Get_rank() != 0)
return; return;
#endif #endif
...@@ -289,7 +289,7 @@ namespace AMDiS { ...@@ -289,7 +289,7 @@ namespace AMDiS {
void Msg::print(const char *format, ...) void Msg::print(const char *format, ...)
{ {
#ifndef SUPPRESS_OUTPUT #ifndef SUPPRESS_OUTPUT
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS #if defined(HAVE_PARALLEL_DOMAIN_AMDIS) || defined(HAVE_MPI)
if (outputMainRank && MPI::COMM_WORLD.Get_rank() != 0) if (outputMainRank && MPI::COMM_WORLD.Get_rank() != 0)
return; return;
#endif #endif
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#if HAVE_PARALLEL_DOMAIN_AMDIS #if defined(HAVE_PARALLEL_DOMAIN_AMDIS) || defined(HAVE_MPI)
#include <mpi.h> #include <mpi.h>
#endif #endif
...@@ -131,7 +131,7 @@ namespace AMDiS { ...@@ -131,7 +131,7 @@ namespace AMDiS {
#if SUPPRESS_OUTPUT #if SUPPRESS_OUTPUT
#define PRINT_LINE(stream, line) #define PRINT_LINE(stream, line)
#else #else
#if HAVE_PARALLEL_DOMAIN_AMDIS #if defined(HAVE_PARALLEL_DOMAIN_AMDIS) || defined(HAVE_MPI)
#define PRINT_LINE(stream, line) stream << "[" << MPI::COMM_WORLD.Get_rank() << "] " << line #define PRINT_LINE(stream, line) stream << "[" << MPI::COMM_WORLD.Get_rank() << "] " << line
#elif defined(HAVE_OPENMP) #elif defined(HAVE_OPENMP)
#define PRINT_LINE(stream, line) stream << "[" << omp_get_thread_num() << "] " << line #define PRINT_LINE(stream, line) stream << "[" << omp_get_thread_num() << "] " << line
...@@ -333,7 +333,7 @@ namespace AMDiS { ...@@ -333,7 +333,7 @@ namespace AMDiS {
} }
public: public:
#if defined(HAVE_PARALLEL_DOMAIN_AMDIS) || defined(HAVE_OPENMP) #if defined(HAVE_PARALLEL_DOMAIN_AMDIS) || defined(HAVE_OPENMP) || defined(HAVE_MPI)
/// In parallel computations, when this variable is true, only the 0 rank will /// In parallel computations, when this variable is true, only the 0 rank will
/// print messages to the output stream. Error messages and warnings are always /// print messages to the output stream. Error messages and warnings are always
/// printed from all ranks. /// printed from all ranks.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment