Skip to content

Commit 0bb4b62

Browse files
committed
detect simd support based on standard version instead of compiler
1 parent 73ee8b2 commit 0bb4b62

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

Common/include/omp_structure.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
/*--- The generic start of OpenMP constructs. ---*/
5656
#define SU2_OMP(ARGS) PRAGMIZE(omp ARGS)
5757

58+
/*--- Detect SIMD support (version 4+, after Jul 2013). ---*/
59+
#if _OPENMP >= 201307
60+
#define HAVE_OMP_SIMD
61+
#endif
62+
5863
#else // Compile without OpenMP
5964

6065
/*--- Disable pragmas to quiet compilation warnings. ---*/
@@ -110,8 +115,8 @@ inline void omp_destroy_lock(omp_lock_t*){}
110115
#define SU2_OMP_FOR_DYN(CHUNK) SU2_OMP(for schedule(dynamic,CHUNK))
111116
#define SU2_OMP_FOR_STAT(CHUNK) SU2_OMP(for schedule(static,CHUNK))
112117

113-
/*--- Disable some unsupported features on MSVC. ---*/
114-
#if defined(_MSC_VER)
118+
/*--- Disable some unsupported features. ---*/
119+
#ifndef HAVE_OMP_SIMD
115120
#undef SU2_OMP_SIMD
116121
#define SU2_OMP_SIMD
117122
#endif

Common/src/linear_algebra/CSysVector.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@
4040
* CSysVector and do not have the same work scheduling must use a
4141
* SU2_OMP_BARRIER before using the vector.
4242
*/
43-
#ifndef _MSC_VER
43+
#ifdef HAVE_OMP_SIMD
4444
#define PARALLEL_FOR SU2_OMP(for simd schedule(static,omp_chunk_size) nowait)
4545
#else
46-
/*--- MSVC does not support SIMD by default. ---*/
4746
#define PARALLEL_FOR SU2_OMP(for schedule(static,omp_chunk_size) nowait)
4847
#endif
4948

0 commit comments

Comments
 (0)