OpenShot Library | libopenshot  0.3.3
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_NUM_PROCESSORS (std::min(omp_get_num_procs(), std::max(2, openshot::Settings::Instance()->FF_THREADS) ))
25 
26 // Set max-active-levels to the max supported, if possible
27 // (supported_active_levels is OpenMP 5.0 (November 2018) or later, only.)
28 #if (_OPENMP >= 201811)
29  #define OPEN_MP_MAX_ACTIVE omp_get_supported_active_levels()
30 #else
31  #define OPEN_MP_MAX_ACTIVE OPEN_MP_NUM_PROCESSORS
32 #endif
33 
34 #endif
Settings.h
Header file for global Settings class.