@@ -78,8 +78,7 @@ typedef unsigned int u_int;
7878#include <sys/sysctl.h>
7979#endif
8080
81- #ifdef _OPENMP
82- # include <omp.h>
81+ #include <omp.h>
8382
8483/* See https://redmine.darktable.org/issues/12568#note-14 */
8584# ifdef HAVE_OMP_FIRSTPRIVATE_WITH_CONST
@@ -91,41 +90,30 @@ typedef unsigned int u_int;
9190# endif /* HAVE_OMP_FIRSTPRIVATE_WITH_CONST */
9291
9392#ifndef dt_omp_sharedconst
94- #ifdef _OPENMP
9593#if defined(__clang__ ) || __GNUC__ > 8
96- # define dt_omp_sharedconst (...) shared(__VA_ARGS__)
94+ # define dt_omp_sharedconst (...) shared(__VA_ARGS__)
9795#else
9896 // GCC 8.4 throws string of errors "'x' is predetermined 'shared' for 'shared'" if we explicitly declare
9997 // 'const' variables as shared
100- # define dt_omp_sharedconst (var , ...)
98+ # define dt_omp_sharedconst (var , ...)
10199#endif
102- #endif /* _OPENMP */
103100#endif /* dt_omp_sharedconst */
104101
105102#ifndef dt_omp_nontemporal
106103// Clang 10+ supports the nontemporal() OpenMP directive
107104// GCC 9 recognizes it as valid, but does not do anything with it
108105// GCC 10+ ???
109106#if (__clang__ + 0 >= 10 || __GNUC__ >= 9 )
110- # define dt_omp_nontemporal (...) nontemporal(__VA_ARGS__)
107+ # define dt_omp_nontemporal (...) nontemporal(__VA_ARGS__)
111108#else
112109// GCC7/8 only support OpenMP 4.5, which does not have the nontemporal() directive.
113- # define dt_omp_nontemporal (var , ...)
110+ # define dt_omp_nontemporal (var , ...)
114111#endif
115112#endif /* dt_omp_nontemporal */
116113
117114#define DT_OMP_STRINGIFY (...) #__VA_ARGS__
118115#define DT_OMP_PRAGMA (...) _Pragma(DT_OMP_STRINGIFY(omp __VA_ARGS__))
119116
120- #else /* _OPENMP */
121-
122- # define omp_get_max_threads () 1
123- # define omp_get_thread_num () 0
124-
125- #define DT_OMP_PRAGMA (...)
126-
127- #endif /* _OPENMP */
128-
129117#define DT_OMP_SIMD (clauses ) DT_OMP_PRAGMA(simd clauses)
130118#define DT_OMP_DECLARE_SIMD (clauses ) DT_OMP_PRAGMA(declare simd clauses)
131119#define DT_OMP_FOR (clauses ) DT_OMP_PRAGMA(parallel for default(firstprivate) schedule(static) clauses)
@@ -778,29 +766,17 @@ gboolean dt_supported_image(const gchar *filename);
778766
779767static inline size_t dt_get_num_threads ()
780768{
781- #ifdef _OPENMP
782769 return (size_t )CLAMP (omp_get_num_procs (), 1 , darktable .num_openmp_threads );
783- #else
784- return 1 ;
785- #endif
786770}
787771
788772static inline size_t dt_get_num_procs ()
789773{
790- #ifdef _OPENMP
791774 return (size_t )MAX (1 , omp_get_num_procs ());
792- #else
793- return 1 ;
794- #endif
795775}
796776
797777static inline int dt_get_thread_num ()
798778{
799- #ifdef _OPENMP
800779 return omp_get_thread_num ();
801- #else
802- return 0 ;
803- #endif
804780}
805781
806782#define DT_INITHASH 5381
@@ -871,20 +847,6 @@ static inline float *dt_calloc_perthread_float(const size_t n,
871847#define dt_get_bythread (buf , padsize , tnum ) \
872848 DT_IS_ALIGNED((buf) + ((padsize) * (tnum)))
873849
874- // Most code in dt assumes that the compiler is capable of
875- // auto-vectorization. In some cases, this will yield suboptimal code
876- // if the compiler in fact does NOT auto-vectorize. Uncomment the
877- // following line for such a compiler.
878-
879- //#define DT_NO_VECTORIZATION
880-
881- // For some combinations of compiler and architecture, the compiler
882- // may actually emit inferior code if given a hint to vectorize a
883- // loop. Uncomment the following line if such a combination is the
884- // compilation target.
885-
886- //#define DT_NO_SIMD_HINTS
887-
888850// copy the RGB channels of a pixel; includes the 'alpha' channel as
889851// well if faster due to vectorization, but subsequent code should
890852// ignore the value of the alpha unless explicitly set afterwards
0 commit comments