From 9b119e6c0428d61ba4e6d9f434fc047e1eca7f61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Herje?= Date: Wed, 20 Mar 2024 15:02:07 +0100 Subject: [PATCH] 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 --- GrpcInterface/RiaGrpcServer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/GrpcInterface/RiaGrpcServer.cpp b/GrpcInterface/RiaGrpcServer.cpp index 6ca1062d92..1b26eeb94f 100644 --- a/GrpcInterface/RiaGrpcServer.cpp +++ b/GrpcInterface/RiaGrpcServer.cpp @@ -37,6 +37,7 @@ #include #include +#include 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 );