Skip to content
Snippets Groups Projects

cbmreco: Add option to specify OpenMP threads.

Merged Felix Weiglhofer requested to merge fweig/cbmroot:algo-omp into master
Files
7
+ 28
0
/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer] */
#ifndef CBM_ALGO_BASE_COMPAT_OPENMP_H
#define CBM_ALGO_BASE_COMPAT_OPENMP_H
#include "BuildInfo.h"
#ifdef HAVE_OMP
#include <omp.h>
#endif
namespace cbm::algo::openmp
{
#ifndef HAVE_OMP
inline int GetMaxThreads() { return 1; }
inline int GetThreadNum() { return 0; }
inline void SetNumThreads(int) {}
#else
inline int GetMaxThreads() { return omp_get_max_threads(); }
inline int GetThreadNum() { return omp_get_thread_num(); }
inline void SetNumThreads(int n) { omp_set_num_threads(n); }
#endif
} // namespace cbm::algo::openmp
#endif // CBM_ALGO_BASE_COMPAT_OPENMP_H
Loading