OpenShot Library | libopenshot 0.5.0
Loading...
Searching...
No Matches
OpenMPUtilities.h
Go to the documentation of this file.
1
9// Copyright (c) 2008-2019 OpenShot Studios, LLC
10//
11// SPDX-License-Identifier: LGPL-3.0-or-later
12
13#ifndef OPENSHOT_OPENMP_UTILITIES_H
14#define OPENSHOT_OPENMP_UTILITIES_H
15
16#include <omp.h>
17#include <algorithm>
18#include <string>
19
20#include "Settings.h"
21
22// Calculate the # of OpenMP Threads to allow
23#define OPEN_MP_NUM_PROCESSORS std::min(omp_get_num_procs(), std::max(2, openshot::Settings::Instance()->OMP_THREADS))
24#define FF_VIDEO_NUM_PROCESSORS std::min(omp_get_num_procs(), std::max(2, openshot::Settings::Instance()->FF_THREADS))
25#define FF_AUDIO_NUM_PROCESSORS std::min(omp_get_num_procs(), std::max(2, openshot::Settings::Instance()->FF_THREADS))
26
27// Set max-active-levels to the max supported, if possible
28// (supported_active_levels is OpenMP 5.0 (November 2018) or later, only.)
29#if (_OPENMP >= 201811)
30 #define OPEN_MP_MAX_ACTIVE omp_get_supported_active_levels()
31#else
32 #define OPEN_MP_MAX_ACTIVE OPEN_MP_NUM_PROCESSORS
33#endif
34
35#endif
Header file for global Settings class.