Verified Commit 5d6ebe45 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

utils: add OpenMP helpers

parent 9854fa38
//
// Copyright (c) 2021 INRIA
//
#ifndef __pinocchio_utils_openmp_hpp__
#define __pinocchio_utils_openmp_hpp__
#include <cstdlib>
namespace pinocchio
{
/// \brief Returns the number of thread defined by the environment variable OMP_NUM_THREADS.
/// If this variable is not defined, this simply returns the default value 1.
///
inline int getOpenMPNumThreadsEnv()
{
int num_threads = 1;
if(const char* env_p = std::getenv("OMP_NUM_THREADS"))
num_threads = atoi(env_p);
return num_threads;
}
}
#endif // ifndef __pinocchio_utils_openmp_hpp__
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment