mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-29 10:21:54 -06:00
Move get number of threads logic to RiaMain
This commit is contained in:
parent
f498c79f35
commit
4df9eabf9c
@ -18,6 +18,7 @@
|
||||
|
||||
#include "RiaArgumentParser.h"
|
||||
#include "RiaMainTools.h"
|
||||
#include "RiaOpenMPTools.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#ifdef ENABLE_GRPC
|
||||
@ -139,6 +140,9 @@ int main( int argc, char* argv[] )
|
||||
|
||||
RiaApplication::ApplicationStatus status = app->handleArguments( &progOpt );
|
||||
|
||||
int numOmpThreads = RiaOpenMPTools::numberOfThreads();
|
||||
app->showFormattedTextInMessageBoxOrConsole( QString( "OpenMP Num Threads: %1\n" ).arg( numOmpThreads ) );
|
||||
|
||||
if ( status == RiaApplication::ApplicationStatus::EXIT_COMPLETED )
|
||||
{
|
||||
// Make sure project is closed to avoid assert and crash in destruction of widgets
|
||||
|
@ -48,3 +48,22 @@ int RiaOpenMPTools::currentThreadIndex()
|
||||
|
||||
return myThread;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiaOpenMPTools::numberOfThreads()
|
||||
{
|
||||
int numberOfThreads = 1;
|
||||
|
||||
#ifdef USE_OPENMP
|
||||
|
||||
#pragma omp parallel
|
||||
{
|
||||
numberOfThreads = omp_get_num_threads();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return numberOfThreads;
|
||||
}
|
||||
|
@ -27,4 +27,5 @@ namespace RiaOpenMPTools
|
||||
{
|
||||
int availableThreadCount();
|
||||
int currentThreadIndex();
|
||||
int numberOfThreads();
|
||||
}; // namespace RiaOpenMPTools
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include <grpcpp/grpcpp.h>
|
||||
|
||||
#include <QTcpServer>
|
||||
#include <omp.h>
|
||||
|
||||
using grpc::CompletionQueue;
|
||||
using grpc::Server;
|
||||
@ -142,13 +141,6 @@ void RiaGrpcServerImpl::initialize()
|
||||
|
||||
ServerBuilder builder;
|
||||
|
||||
int numOmpThreads = 0;
|
||||
#pragma omp parallel
|
||||
{
|
||||
numOmpThreads = omp_get_num_threads();
|
||||
}
|
||||
RiaLogging::info( QString( "OpenMP Num Threads: %1" ).arg( numOmpThreads ) );
|
||||
|
||||
// When setting port number to 0, grpc will find and use a valid port number
|
||||
// The port number is assigned to the m_portNumber variable after calling builder.BuildAndStart()
|
||||
QString requestedServerAddress = QString( "localhost:%1" ).arg( m_portNumber );
|
||||
|
Loading…
Reference in New Issue
Block a user