autodetect OpenMP 4.0 semantic compatibility if not explicitly set

This commit is contained in:
Axel Kohlmeyer 2020-09-25 16:16:06 -04:00
parent 28812b1ea7
commit 2e67aa6b47
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
1 changed files with 25 additions and 6 deletions

View File

@ -25,11 +25,30 @@
// so this is what LAMMPS primarily uses. For those compilers
// that strictly implement OpenMP 4.0 (such as GCC 9.0 and later
// or Clang 10.0 and later), we give up default(none).
#if LAMMPS_OMP_COMPAT == 4
# define LMP_SHARED(...)
# define LMP_DEFAULT_NONE default(shared)
#else
# define LMP_SHARED(...) shared(__VA_ARGS__)
# define LMP_DEFAULT_NONE default(none)
// autodetect OpenMP compatibility if not explicitly set
#ifndef LAMMPS_OMP_COMPAT
# if defined(__INTEL_COMPILER)
# if __INTEL_COMPILER > 18
# define LAMMPS_OMP_COMPAT 4
# endif
# elif defined(__clang__)
# if __clang_major__ >= 10
# define LAMMPS_OMP_COMPAT 4
# endif
# elif defined(__GNUC__)
# if __GNUC__ >= 0
# define LAMMPS_OMP_COMPAT 4
# endif
# endif
#endif
#if LAMMPS_OMP_COMPAT == 4
# define LMP_SHARED(...)
# define LMP_DEFAULT_NONE default(shared)
#else
# define LMP_SHARED(...) shared(__VA_ARGS__)
# define LMP_DEFAULT_NONE default(none)
#endif