From b11cb472fba7ded074803425f63e648bd3814082 Mon Sep 17 00:00:00 2001 From: Bruce J Palmer Date: Tue, 31 Oct 2023 08:54:49 -0700 Subject: [PATCH] Modified environment so that no preprocessor symbols are in header. These may confuse builds outside of gridpack. --- src/environment/environment.cpp | 19 +++++++++++++++++-- src/environment/environment.hpp | 2 -- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/environment/environment.cpp b/src/environment/environment.cpp index 4f8fbd52c..5a6cd69b7 100644 --- a/src/environment/environment.cpp +++ b/src/environment/environment.cpp @@ -92,9 +92,9 @@ Environment::Environment(int argc, char **argv,const char* help,const long int& } -#ifdef ENABLE_ENVIRONMENT_FROM_COMM Environment::Environment(int argc, char **argv, MPI_Comm &comm): p_boostEnv(argc,argv),clparser(argc,argv),p_from_comm(false) { +#ifdef ENABLE_ENVIRONMENT_FROM_COMM PrintStatus(); pma_stack = 200000; pma_heap = 200000; @@ -102,9 +102,24 @@ Environment::Environment(int argc, char **argv, MPI_Comm &comm): p_boostEnv(argc p_from_comm = true; MA_init(C_DBL,pma_stack,pma_heap); gridpack::math::Initialize(&argc,&argv); + } else { + int rank; + MPI_Comm_rank(comm,&rank); + if (rank == 0) { + std::cout<<"Initialize GA from communicator failed" << std::endl; + } + MPI_Abort(comm, 1); } -} +#else + int rank; + MPI_Comm_rank(comm,&rank); + if (rank == 0) { + std::cout<<"Initialize GridPACK Environment from communicator not implemented" + << std::endl; + } + MPI_Abort(comm, 1); #endif +} Environment::~Environment(void) { diff --git a/src/environment/environment.hpp b/src/environment/environment.hpp index 025eec12e..e9d34de82 100644 --- a/src/environment/environment.hpp +++ b/src/environment/environment.hpp @@ -80,7 +80,6 @@ class Environment : private utility::Uncopyable const long int& ma_heap); Environment(int argc, char **argv); -#ifdef ENABLE_ENVIRONMENT_FROM_COMM /** * Initialize environment from existing communicator * @param argc number of program command line arguments @@ -90,7 +89,6 @@ class Environment : private utility::Uncopyable * @return */ Environment(int argc, char **argv, MPI_Comm &comm); -#endif /** * Return true if processor is active in this environment, false otherwise.