Skip to content
Snippets Groups Projects
Commit 5694d43e authored by Markus Holzer's avatar Markus Holzer Committed by Philipp Suffa
Browse files

Use omp_get_max_threads in performance evaluation

parent 33af3994
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "core/DataTypes.h" #include "core/DataTypes.h"
#include "core/Hostname.h" #include "core/Hostname.h"
#include "core/Set.h" #include "core/Set.h"
#include "core/OpenMP.h"
#include "core/waLBerlaBuildInfo.h" #include "core/waLBerlaBuildInfo.h"
#include "core/debug/CheckFunctions.h" #include "core/debug/CheckFunctions.h"
#include "core/logging/Logging.h" #include "core/logging/Logging.h"
...@@ -223,10 +224,17 @@ PerformanceEvaluationBase< CellCounter_T, FluidCellCounter_T >::PerformanceEvalu ...@@ -223,10 +224,17 @@ PerformanceEvaluationBase< CellCounter_T, FluidCellCounter_T >::PerformanceEvalu
fluidCells_( fluidCellCounter ) fluidCells_( fluidCellCounter )
{ {
#ifdef _OPENMP #ifdef _OPENMP
if( std::getenv( "OMP_NUM_THREADS" ) == NULL ) if( std::getenv( "OMP_NUM_THREADS" ) )
WALBERLA_ABORT( "If you are using a version of the program that was compiled with OpenMP you have to " {
"specify the environment variable \'OMP_NUM_THREADS\' accordingly!" ); threadsPerProcess_ = std::atoi( std::getenv( "OMP_NUM_THREADS" ) );
threadsPerProcess_ = std::atoi( std::getenv( "OMP_NUM_THREADS" ) ); }
else
{
WALBERLA_LOG_WARNING( "You are using a version of the program that was compiled with OpenMP and the environment "
"variable \'OMP_NUM_THREADS\' was not set!\nThe number of threads will now determined with "
"\'omp_get_max_threads\'.\nIf this not correct in your case please set \'OMP_NUM_THREADS\'" );
threadsPerProcess_ = omp_get_max_threads();
}
#endif #endif
if( std::getenv( "THREADS_PER_CORE" ) ) if( std::getenv( "THREADS_PER_CORE" ) )
...@@ -256,7 +264,7 @@ std::string PerformanceEvaluationBase< CellCounter_T, FluidCellCounter_T >::logg ...@@ -256,7 +264,7 @@ std::string PerformanceEvaluationBase< CellCounter_T, FluidCellCounter_T >::logg
{ {
std::ostringstream oss; std::ostringstream oss;
std::string na( "n/a *)" ); const std::string na( "n/a *)" );
std::ostringstream threadsPerCoreString; std::ostringstream threadsPerCoreString;
threadsPerCoreString << threadsPerCore_; threadsPerCoreString << threadsPerCore_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment