Merge pull request #350 from adamjstewart/features/nag
Add NAG Fortran Compiler support
This commit is contained in:
commit
1c2a2dde8e
4
lib/spack/env/cc
vendored
4
lib/spack/env/cc
vendored
@ -94,11 +94,11 @@ case "$command" in
|
|||||||
command="$SPACK_CXX"
|
command="$SPACK_CXX"
|
||||||
language="C++"
|
language="C++"
|
||||||
;;
|
;;
|
||||||
f90|fc|f95|gfortran|ifort|pgf90|xlf90)
|
f90|fc|f95|gfortran|ifort|pgf90|xlf90|nagfor)
|
||||||
command="$SPACK_FC"
|
command="$SPACK_FC"
|
||||||
language="Fortran 90"
|
language="Fortran 90"
|
||||||
;;
|
;;
|
||||||
f77|gfortran|ifort|pgf77|xlf)
|
f77|gfortran|ifort|pgf77|xlf|nagfor)
|
||||||
command="$SPACK_F77"
|
command="$SPACK_F77"
|
||||||
language="Fortran 77"
|
language="Fortran 77"
|
||||||
;;
|
;;
|
||||||
|
1
lib/spack/env/nag/nagfor
vendored
Symbolic link
1
lib/spack/env/nag/nagfor
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../cc
|
@ -24,6 +24,7 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import subprocess
|
||||||
import itertools
|
import itertools
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ def _verify_executables(*paths):
|
|||||||
def get_compiler_version(compiler_path, version_arg, regex='(.*)'):
|
def get_compiler_version(compiler_path, version_arg, regex='(.*)'):
|
||||||
if not compiler_path in _version_cache:
|
if not compiler_path in _version_cache:
|
||||||
compiler = Executable(compiler_path)
|
compiler = Executable(compiler_path)
|
||||||
output = compiler(version_arg, return_output=True, error=os.devnull)
|
output = compiler(version_arg, return_output=True, error=subprocess.STDOUT)
|
||||||
|
|
||||||
match = re.search(regex, output)
|
match = re.search(regex, output)
|
||||||
_version_cache[compiler_path] = match.group(1) if match else 'unknown'
|
_version_cache[compiler_path] = match.group(1) if match else 'unknown'
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
if platform.system() == 'Darwin':
|
if platform.system() == 'Darwin':
|
||||||
_default_order = ['clang', 'gcc', 'intel']
|
_default_order = ['clang', 'gcc', 'intel']
|
||||||
else:
|
else:
|
||||||
_default_order = ['gcc', 'intel', 'pgi', 'clang', 'xlc']
|
_default_order = ['gcc', 'intel', 'pgi', 'clang', 'xlc', 'nag']
|
||||||
|
|
||||||
|
|
||||||
def _auto_compiler_spec(function):
|
def _auto_compiler_spec(function):
|
||||||
|
33
lib/spack/spack/compilers/nag.py
Normal file
33
lib/spack/spack/compilers/nag.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
from spack.compiler import *
|
||||||
|
|
||||||
|
class Nag(Compiler):
|
||||||
|
# Subclasses use possible names of C compiler
|
||||||
|
cc_names = []
|
||||||
|
|
||||||
|
# Subclasses use possible names of C++ compiler
|
||||||
|
cxx_names = []
|
||||||
|
|
||||||
|
# Subclasses use possible names of Fortran 77 compiler
|
||||||
|
f77_names = ['nagfor']
|
||||||
|
|
||||||
|
# Subclasses use possible names of Fortran 90 compiler
|
||||||
|
fc_names = ['nagfor']
|
||||||
|
|
||||||
|
# Named wrapper links within spack.build_env_path
|
||||||
|
link_paths = { # Use default wrappers for C and C++, in case provided in compilers.yaml
|
||||||
|
'cc' : 'cc',
|
||||||
|
'cxx' : 'cxx',
|
||||||
|
'f77' : 'nag/nagfor',
|
||||||
|
'fc' : 'nag/nagfor' }
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_version(self, comp):
|
||||||
|
"""The '-V' option works for nag compilers.
|
||||||
|
Output looks like this::
|
||||||
|
|
||||||
|
NAG Fortran Compiler Release 6.0(Hibiya) Build 1037
|
||||||
|
Product NPL6A60NA for x86-64 Linux
|
||||||
|
Copyright 1990-2015 The Numerical Algorithms Group Ltd., Oxford, U.K.
|
||||||
|
"""
|
||||||
|
return get_compiler_version(
|
||||||
|
comp, '-V', r'NAG Fortran Compiler Release ([0-9.]+)')
|
Loading…
Reference in New Issue
Block a user