Add read out of OpenMP number of threads

Read out of number of threads for OpenMP. Expected to be equal set environment variable OMP_NUM_THREADS
This commit is contained in:
Jørgen Herje 2024-03-20 15:02:07 +01:00
parent b9589b3719
commit 9b119e6c04

View File

@ -37,6 +37,7 @@
#include <grpcpp/grpcpp.h>
#include <QTcpServer>
#include <omp.h>
using grpc::CompletionQueue;
using grpc::Server;
@ -141,6 +142,13 @@ 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 );