compilers: add openmp_flag() method

This commit is contained in:
Denis Davydov 2016-05-03 10:49:04 +02:00
parent 2cdfe14e5a
commit 9776dc0433
6 changed files with 28 additions and 2 deletions

View file

@ -47,6 +47,14 @@ class Clang(Compiler):
'f77' : 'f77', 'f77' : 'f77',
'fc' : 'f90' } '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 @property
def cxx11_flag(self): def cxx11_flag(self):
if ver.endswith('-apple'): if ver.endswith('-apple'):

View file

@ -49,6 +49,10 @@ class Gcc(Compiler):
'f77' : 'gcc/gfortran', 'f77' : 'gcc/gfortran',
'fc' : 'gcc/gfortran' } 'fc' : 'gcc/gfortran' }
@property
def openmp_flag(self):
return "-fopenmp"
@property @property
def cxx11_flag(self): def cxx11_flag(self):
if self.version < ver('4.3'): if self.version < ver('4.3'):

View file

@ -43,6 +43,10 @@ class Intel(Compiler):
'f77' : 'intel/ifort', 'f77' : 'intel/ifort',
'fc' : 'intel/ifort' } 'fc' : 'intel/ifort' }
@property
def openmp_flag(self):
return "-openmp"
@property @property
def cxx11_flag(self): def cxx11_flag(self):
if self.version < ver('11.1'): if self.version < ver('11.1'):
@ -68,5 +72,3 @@ def default_version(cls, comp):
""" """
return get_compiler_version( return get_compiler_version(
comp, '--version', r'\((?:IFORT|ICC)\) ([^ ]+)') comp, '--version', r'\((?:IFORT|ICC)\) ([^ ]+)')

View file

@ -20,6 +20,10 @@ class Nag(Compiler):
'f77' : 'nag/nagfor', 'f77' : 'nag/nagfor',
'fc' : 'nag/nagfor' } 'fc' : 'nag/nagfor' }
@property
def openmp_flag(self):
return "-openmp"
@property @property
def cxx11_flag(self): def cxx11_flag(self):
tty.die("cxx11_flag() is not implemented for nag. Consider creating a pull-request.") tty.die("cxx11_flag() is not implemented for nag. Consider creating a pull-request.")

View file

@ -43,6 +43,10 @@ class Pgi(Compiler):
'f77' : 'pgi/pgfortran', 'f77' : 'pgi/pgfortran',
'fc' : 'pgi/pgfortran' } 'fc' : 'pgi/pgfortran' }
@property
def openmp_flag(self):
return "-mp"
@property @property
def cxx11_flag(self): def cxx11_flag(self):
tty.die("cxx11_flag() is not implemented for pgi. Consider creating a pull-request.") tty.die("cxx11_flag() is not implemented for pgi. Consider creating a pull-request.")

View file

@ -44,6 +44,10 @@ class Xl(Compiler):
'f77' : 'xl/xlf', 'f77' : 'xl/xlf',
'fc' : 'xl/xlf90' } 'fc' : 'xl/xlf90' }
@property
def openmp_flag(self):
return "-qsmp=omp"
@property @property
def cxx11_flag(self): def cxx11_flag(self):
if self.version < ver('13.1'): if self.version < ver('13.1'):