Fix detection of LLVM-enabled PGI compilers (#10704)

* Fix detection of LLVM-enabled PGI compilers

* Add unit tests for LLVM-enabled PGI compiler version detection
This commit is contained in:
Adam J. Stewart 2019-04-20 17:52:55 -05:00 committed by GitHub
parent a40492172f
commit 7255d5ee3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -19,6 +19,10 @@ class Pgi(spack.compiler.Compiler):
# Subclasses use possible names of Fortran 90 compiler
fc_names = ['pgfortran', 'pgf95', 'pgf90']
# LLVM-enabled PGI compilers add a '-llvm' suffix:
# pgcc-llvm, pgc++llvm, pgfortran-llvm
suffixes = ['-?llvm']
# Named wrapper links within build_env_path
link_paths = {'cc': 'pgi/pgcc',
'cxx': 'pgi/pgc++',
@ -29,7 +33,7 @@ class Pgi(spack.compiler.Compiler):
PrgEnv_compiler = 'pgi'
version_argument = '-V'
version_regex = r'pg[^ ]* ([0-9.]+)-[0-9]+ [^ ]+ target on '
version_regex = r'pg[^ ]* ([0-9.]+)-[0-9]+ (LLVM )?[^ ]+ target on '
@property
def openmp_flag(self):

View File

@ -317,7 +317,13 @@ def test_nag_version_detection(version_str, expected_version):
# Output on PowerPC
('pgcc 17.4-0 linuxpower target on Linuxpower\n'
'PGI Compilers and Tools\n'
'Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.\n', '17.4')
'Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.\n',
'17.4'),
# Output when LLVM-enabled
('pgcc-llvm 18.4-0 LLVM 64-bit target on x86-64 Linux -tp haswell\n'
'PGI Compilers and Tools\n'
'Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.\n',
'18.4')
])
def test_pgi_version_detection(version_str, expected_version):
version = spack.compilers.pgi.Pgi.extract_version_from_output(version_str)