def fc_version(cls, fc): """Older versions of gfortran use the ``-dumpversion`` option. Output looks like this:: GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) Copyright (C) 2010 Free Software Foundation, Inc. or:: 4.8.5 In GCC 7, this option was changed to only return the major version of the compiler:: 7 A new ``-dumpfullversion`` option was added that gives us what we want:: 7.2.0 """ version = get_compiler_version( fc, '-dumpversion', r'(?:GNU Fortran \(GCC\) )?([\d.]+)') if version in ['7']: version = get_compiler_version(fc, '-dumpfullversion') return version
def fc_version(cls, fc): """Older versions of gfortran use the ``-dumpversion`` option. Output looks like this:: GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) Copyright (C) 2010 Free Software Foundation, Inc. or:: 4.8.5 In GCC 7, this option was changed to only return the major version of the compiler:: 7 A new ``-dumpfullversion`` option was added that gives us what we want:: 7.2.0 """ version = get_compiler_version( fc, '-dumpversion', r'(?:GNU Fortran \(GCC\) )?([\d.]+)') if ver(version) >= ver('7'): version = get_compiler_version(fc, '-dumpfullversion') return version
def default_version(cls, cc): """Older versions of gcc use the ``-dumpversion`` option. Output looks like this:: 4.4.7 In GCC 7, this option was changed to only return the major version of the compiler:: 7 A new ``-dumpfullversion`` option was added that gives us what we want:: 7.2.0 """ # Skip any gcc versions that are actually clang, like Apple's gcc. # Returning "unknown" makes them not detected by default. # Users can add these manually to compilers.yaml at their own risk. if spack.compilers.clang.Clang.default_version(cc) != 'unknown': return 'unknown' version = super(Gcc, cls).default_version(cc) if ver(version) >= ver('7'): version = get_compiler_version(cc, '-dumpfullversion') return version
def default_version(cls, cc): """Older versions of gcc use the ``-dumpversion`` option. Output looks like this:: 4.4.7 In GCC 7, this option was changed to only return the major version of the compiler:: 7 A new ``-dumpfullversion`` option was added that gives us what we want:: 7.2.0 """ # Skip any gcc versions that are actually clang, like Apple's gcc. # Returning "unknown" makes them not detected by default. # Users can add these manually to compilers.yaml at their own risk. if spack.compilers.clang.Clang.default_version(cc) != 'unknown': return 'unknown' version = super(Gcc, cls).default_version(cc) if version in ['7']: version = get_compiler_version(cc, '-dumpfullversion') return version
def default_version(cls, comp): """The '-qversion' is the standard option fo XL compilers. Output looks like this:: IBM XL C/C++ for Linux, V11.1 (5724-X14) Version: 11.01.0000.0000 or:: IBM XL Fortran for Linux, V13.1 (5724-X16) Version: 13.01.0000.0000 or:: IBM XL C/C++ for AIX, V11.1 (5724-X13) Version: 11.01.0000.0009 or:: IBM XL C/C++ Advanced Edition for Blue Gene/P, V9.0 Version: 09.00.0000.0017 """ return get_compiler_version( comp, '-qversion', r'([0-9]?[0-9]\.[0-9])')
def default_version(cls, 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 """ return get_compiler_version( comp, '-V', r'NAG Fortran Compiler Release ([0-9.]+)')
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 """ return get_compiler_version(comp, '-V', r'NAG Fortran Compiler Release ([0-9.]+)')
def default_version(cls, cc): # Skip any gcc versions that are actually clang, like Apple's gcc. # Returning "unknown" makes them not detected by default. # Users can add these manually to compilers.yaml at their own risk. if spack.compilers.clang.Clang.default_version(cc) != 'unknown': return 'unknown' version = super(Gcc, cls).default_version(cc) if version in ['7']: version = get_compiler_version(cc, '-dumpfullversion') return version
def default_version(cls, comp): """The ``--version`` option seems to be the most consistent one for intel compilers. Output looks like this:: icpc (ICC) 12.1.5 20120612 Copyright (C) 1985-2012 Intel Corporation. All rights reserved. or:: ifort (IFORT) 12.1.5 20120612 Copyright (C) 1985-2012 Intel Corporation. All rights reserved. """ return get_compiler_version(comp, '--version', r'\((?:IFORT|ICC)\) ([^ ]+)')
def default_version(cls, comp): """The ``--version`` option seems to be the most consistent one for intel compilers. Output looks like this:: icpc (ICC) 12.1.5 20120612 Copyright (C) 1985-2012 Intel Corporation. All rights reserved. or:: ifort (IFORT) 12.1.5 20120612 Copyright (C) 1985-2012 Intel Corporation. All rights reserved. """ return get_compiler_version( comp, '--version', r'\((?:IFORT|ICC)\) ([^ ]+)')
def default_version(cls, comp): """The ``--version`` option seems to be the most consistent one for arm compilers. Output looks like this:: $ arm<c/f>lang --version Arm C/C++/Fortran Compiler version 19.0 (build number 73) (based on LLVM 7.0.2) # NOQA Target: aarch64--linux-gnu Thread model: posix InstalledDir: /opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin # NOQA """ return get_compiler_version( comp, '--version', r'Arm C\/C\+\+\/Fortran Compiler version ([^ )]+)')
def fc_version(cls, fc): """The fortran and C/C++ versions of the XL compiler are always two units apart. By this we mean that the fortran release that goes with XL C/C++ 11.1 is 13.1. Having such a difference in version number is confusing spack quite a lot. Most notably if you keep the versions as is the default xl compiler will only have fortran and no C/C++. So we associate the Fortran compiler with the version associated to the C/C++ compiler. One last stumble. Version numbers over 10 have at least a .1 those under 10 a .0. There is no xlf 9.x or under currently available. BG/P and BG/L can such a compiler mix and possibly older version of AIX and linux on power. """ fver = get_compiler_version(fc, '-qversion', r'([0-9]?[0-9]\.[0-9])') cver = float(fver) - 2 if cver < 10: cver = cver - 0.1 return str(cver)
def default_version(cls, comp): """The ``-V`` option works for all the PGI compilers. Output looks like this:: pgcc 15.10-0 64-bit target on x86-64 Linux -tp sandybridge The Portland Group - PGI Compilers and Tools Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. on x86-64, and:: pgcc 17.4-0 linuxpower target on Linuxpower PGI Compilers and Tools Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. on PowerPC. """ return get_compiler_version( comp, '-V', r'pg[^ ]* ([0-9.]+)-[0-9]+ [^ ]+ target on ')
def fc_version(cls, fc): """The fortran and C/C++ versions of the XL compiler are always two units apart. By this we mean that the fortran release that goes with XL C/C++ 11.1 is 13.1. Having such a difference in version number is confusing spack quite a lot. Most notably if you keep the versions as is the default xl compiler will only have fortran and no C/C++. So we associate the Fortran compiler with the version associated to the C/C++ compiler. One last stumble. Version numbers over 10 have at least a .1 those under 10 a .0. There is no xlf 9.x or under currently available. BG/P and BG/L can such a compiler mix and possibly older version of AIX and linux on power. """ fver = get_compiler_version(fc, '-qversion', r'([0-9]?[0-9]\.[0-9])') if fver >= 16: """Starting with version 16.1, the XL C and Fortran compilers have the same version. So no need to downgrade the Fortran compiler version to match that of the C compiler version. """ return str(fver) cver = float(fver) - 2 if cver < 10: cver = cver - 0.1 return str(cver)
def fc_version(cls, fc): return get_compiler_version( fc, '-dumpversion', # older gfortran versions don't have simple dumpversion output. r'(?:GNU Fortran \(GCC\))?(\d+\.\d+(?:\.\d+)?)')
def default_version(cls, comp): return get_compiler_version(comp, '-V', r'[Vv]ersion.*?(\d+(\.\d+)+)')