diff --git a/lib/spack/spack/compilers/clang.py b/lib/spack/spack/compilers/clang.py index 8a60ebcaed..44de77af4f 100644 --- a/lib/spack/spack/compilers/clang.py +++ b/lib/spack/spack/compilers/clang.py @@ -47,6 +47,14 @@ class Clang(Compiler): 'f77' : 'f77', 'fc' : 'f90' } + @property + def openmp_flag(self): + ver = '%s' % self.version + if ver.endswith('-apple'): + tty.die("Clang from Apple does not support Openmp yet.") + else: + return "-fopenmp" + @property def cxx11_flag(self): if ver.endswith('-apple'): diff --git a/lib/spack/spack/compilers/gcc.py b/lib/spack/spack/compilers/gcc.py index 2e57e44856..91c498ac82 100644 --- a/lib/spack/spack/compilers/gcc.py +++ b/lib/spack/spack/compilers/gcc.py @@ -49,6 +49,10 @@ class Gcc(Compiler): 'f77' : 'gcc/gfortran', 'fc' : 'gcc/gfortran' } + @property + def openmp_flag(self): + return "-fopenmp" + @property def cxx11_flag(self): if self.version < ver('4.3'): diff --git a/lib/spack/spack/compilers/intel.py b/lib/spack/spack/compilers/intel.py index 69e9764790..f04a6aa899 100644 --- a/lib/spack/spack/compilers/intel.py +++ b/lib/spack/spack/compilers/intel.py @@ -43,6 +43,10 @@ class Intel(Compiler): 'f77' : 'intel/ifort', 'fc' : 'intel/ifort' } + @property + def openmp_flag(self): + return "-openmp" + @property def cxx11_flag(self): if self.version < ver('11.1'): @@ -68,5 +72,3 @@ def default_version(cls, comp): """ return get_compiler_version( comp, '--version', r'\((?:IFORT|ICC)\) ([^ ]+)') - - diff --git a/lib/spack/spack/compilers/nag.py b/lib/spack/spack/compilers/nag.py index 1df6b1c591..61486f22bd 100644 --- a/lib/spack/spack/compilers/nag.py +++ b/lib/spack/spack/compilers/nag.py @@ -20,6 +20,10 @@ class Nag(Compiler): 'f77' : 'nag/nagfor', 'fc' : 'nag/nagfor' } + @property + def openmp_flag(self): + return "-openmp" + @property def cxx11_flag(self): tty.die("cxx11_flag() is not implemented for nag. Consider creating a pull-request.") diff --git a/lib/spack/spack/compilers/pgi.py b/lib/spack/spack/compilers/pgi.py index ebf644404b..299b9a7016 100644 --- a/lib/spack/spack/compilers/pgi.py +++ b/lib/spack/spack/compilers/pgi.py @@ -43,6 +43,10 @@ class Pgi(Compiler): 'f77' : 'pgi/pgfortran', 'fc' : 'pgi/pgfortran' } + @property + def openmp_flag(self): + return "-mp" + @property def cxx11_flag(self): tty.die("cxx11_flag() is not implemented for pgi. Consider creating a pull-request.") diff --git a/lib/spack/spack/compilers/xl.py b/lib/spack/spack/compilers/xl.py index c1d55109a3..657309fe06 100644 --- a/lib/spack/spack/compilers/xl.py +++ b/lib/spack/spack/compilers/xl.py @@ -44,6 +44,10 @@ class Xl(Compiler): 'f77' : 'xl/xlf', 'fc' : 'xl/xlf90' } + @property + def openmp_flag(self): + return "-qsmp=omp" + @property def cxx11_flag(self): if self.version < ver('13.1'):