summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/spack/defaults/packages.yaml2
l---------lib/spack/env/aocc/clang1
l---------lib/spack/env/aocc/clang++1
l---------lib/spack/env/aocc/flang1
-rwxr-xr-xlib/spack/env/cc2
-rw-r--r--lib/spack/spack/compilers/__init__.py2
-rw-r--r--lib/spack/spack/compilers/aocc.py116
-rw-r--r--lib/spack/spack/compilers/clang.py2
-rw-r--r--lib/spack/spack/test/compilers/basics.py24
-rw-r--r--lib/spack/spack/test/compilers/detection.py16
-rwxr-xr-xvar/spack/repos/builtin/packages/aocc/package.py66
11 files changed, 229 insertions, 4 deletions
diff --git a/etc/spack/defaults/packages.yaml b/etc/spack/defaults/packages.yaml
index 6a2550552b..2e2f263f60 100644
--- a/etc/spack/defaults/packages.yaml
+++ b/etc/spack/defaults/packages.yaml
@@ -15,7 +15,7 @@
# -------------------------------------------------------------------------
packages:
all:
- compiler: [gcc, intel, pgi, clang, xl, nag, fj]
+ compiler: [gcc, intel, pgi, clang, xl, nag, fj, aocc]
providers:
D: [ldc]
awk: [gawk]
diff --git a/lib/spack/env/aocc/clang b/lib/spack/env/aocc/clang
new file mode 120000
index 0000000000..82c2b8e90a
--- /dev/null
+++ b/lib/spack/env/aocc/clang
@@ -0,0 +1 @@
+../cc \ No newline at end of file
diff --git a/lib/spack/env/aocc/clang++ b/lib/spack/env/aocc/clang++
new file mode 120000
index 0000000000..abf4cd45c7
--- /dev/null
+++ b/lib/spack/env/aocc/clang++
@@ -0,0 +1 @@
+../cpp \ No newline at end of file
diff --git a/lib/spack/env/aocc/flang b/lib/spack/env/aocc/flang
new file mode 120000
index 0000000000..b6c64233b0
--- /dev/null
+++ b/lib/spack/env/aocc/flang
@@ -0,0 +1 @@
+../fc \ No newline at end of file
diff --git a/lib/spack/env/cc b/lib/spack/env/cc
index 6de7df3576..e826cabca4 100755
--- a/lib/spack/env/cc
+++ b/lib/spack/env/cc
@@ -125,7 +125,7 @@ case "$command" in
comp="FC"
lang_flags=F
;;
- f77|xlf|xlf_r|pgf77|frt)
+ f77|xlf|xlf_r|pgf77|frt|flang)
command="$SPACK_F77"
language="Fortran 77"
comp="F77"
diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py
index c11bafe47d..452dc384a5 100644
--- a/lib/spack/spack/compilers/__init__.py
+++ b/lib/spack/spack/compilers/__init__.py
@@ -739,7 +739,7 @@ def is_mixed_toolchain(compiler):
toolchains.add(compiler_cls.__name__)
if len(toolchains) > 1:
- if toolchains == set(['Clang', 'AppleClang']):
+ if toolchains == set(['Clang', 'AppleClang', 'Aocc']):
return False
tty.debug("[TOOLCHAINS] {0}".format(toolchains))
return True
diff --git a/lib/spack/spack/compilers/aocc.py b/lib/spack/spack/compilers/aocc.py
new file mode 100644
index 0000000000..5c9e885490
--- /dev/null
+++ b/lib/spack/spack/compilers/aocc.py
@@ -0,0 +1,116 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+import re
+import sys
+
+import llnl.util.lang
+
+from spack.compiler import Compiler
+
+
+class Aocc(Compiler):
+ # Subclasses use possible names of C compiler
+ cc_names = ['clang']
+
+ # Subclasses use possible names of C++ compiler
+ cxx_names = ['clang++']
+
+ # Subclasses use possible names of Fortran 77 compiler
+ f77_names = ['flang']
+
+ # Subclasses use possible names of Fortran 90 compiler
+ fc_names = ['flang']
+
+ version_argument = '--version'
+
+ @property
+ def debug_flags(self):
+ return ['-gcodeview', '-gdwarf-2', '-gdwarf-3', '-gdwarf-4',
+ '-gdwarf-5', '-gline-tables-only', '-gmodules', '-gz', '-g']
+
+ @property
+ def opt_flags(self):
+ return ['-O0', '-O1', '-O2', '-O3', '-Ofast', '-Os', '-Oz', '-Og',
+ '-O', '-O4']
+
+ @property
+ def link_paths(self):
+ link_paths = {'cc': 'aocc/clang',
+ 'cxx': 'aocc/clang++',
+ 'f77': 'aocc/flang',
+ 'fc': 'aocc/flang'}
+
+ return link_paths
+
+ @property
+ def verbose_flag(self):
+ return "-v"
+
+ @property
+ def openmp_flag(self):
+ return "-fopenmp"
+
+ @property
+ def cxx11_flag(self):
+ return "-std=c++11"
+
+ @property
+ def cxx14_flag(self):
+ return "-std=c++14"
+
+ @property
+ def cxx17_flag(self):
+ return "-std=c++17"
+
+ @property
+ def c99_flag(self):
+ return '-std=c99'
+
+ @property
+ def c11_flag(self):
+ return "-std=c11"
+
+ @property
+ def cc_pic_flag(self):
+ return "-fPIC"
+
+ @property
+ def cxx_pic_flag(self):
+ return "-fPIC"
+
+ @property
+ def f77_pic_flag(self):
+ return "-fPIC"
+
+ @property
+ def fc_pic_flag(self):
+ return "-fPIC"
+
+ required_libs = ['libclang']
+
+ @classmethod
+ @llnl.util.lang.memoized
+ def extract_version_from_output(cls, output):
+ loc_ver = 'unknown'
+
+ match = re.search(
+ r'AMD clang version ([^ )]+)',
+ output
+ )
+ if match:
+ loc_ver = output.split('AOCC_')[1].split('-')[0]
+ return loc_ver
+
+ @classmethod
+ def fc_version(cls, fortran_compiler):
+ if sys.platform == 'darwin':
+ return cls.default_version('clang')
+
+ return cls.default_version(fortran_compiler)
+
+ @classmethod
+ def f77_version(cls, f77):
+ return cls.fc_version(f77)
diff --git a/lib/spack/spack/compilers/clang.py b/lib/spack/spack/compilers/clang.py
index 2f8c7d43e3..5eb08cbf0a 100644
--- a/lib/spack/spack/compilers/clang.py
+++ b/lib/spack/spack/compilers/clang.py
@@ -154,7 +154,7 @@ class Clang(Compiler):
@llnl.util.lang.memoized
def extract_version_from_output(cls, output):
ver = 'unknown'
- if 'Apple' in output:
+ if ('Apple' in output) or ('AMD' in output):
return ver
match = re.search(
diff --git a/lib/spack/spack/test/compilers/basics.py b/lib/spack/spack/test/compilers/basics.py
index 9af416dd7b..22099bdb63 100644
--- a/lib/spack/spack/test/compilers/basics.py
+++ b/lib/spack/spack/test/compilers/basics.py
@@ -442,6 +442,30 @@ def test_clang_flags():
'clang@3.3')
+def test_aocc_flags():
+ supported_flag_test("debug_flags",
+ ['-gcodeview', '-gdwarf-2', '-gdwarf-3',
+ '-gdwarf-4', '-gdwarf-5', '-gline-tables-only',
+ '-gmodules', '-gz', '-g'],
+ 'aocc@2.2.0')
+ supported_flag_test("opt_flags",
+ ['-O0', '-O1', '-O2', '-O3', '-Ofast',
+ '-Os', '-Oz', '-Og',
+ '-O', '-O4'],
+ 'aocc@2.2.0')
+ supported_flag_test("openmp_flag", "-fopenmp", "aocc@2.2.0")
+ supported_flag_test("cxx11_flag", "-std=c++11", "aocc@2.2.0")
+ supported_flag_test("cxx14_flag", "-std=c++14", "aocc@2.2.0")
+ supported_flag_test("cxx17_flag", "-std=c++17", "aocc@2.2.0")
+ supported_flag_test("c99_flag", "-std=c99", "aocc@2.2.0")
+ supported_flag_test("c11_flag", "-std=c11", "aocc@2.2.0")
+ supported_flag_test("cc_pic_flag", "-fPIC", "aocc@2.2.0")
+ supported_flag_test("cxx_pic_flag", "-fPIC", "aocc@2.2.0")
+ supported_flag_test("f77_pic_flag", "-fPIC", "aocc@2.2.0")
+ supported_flag_test("fc_pic_flag", "-fPIC", "aocc@2.2.0")
+ supported_flag_test("version_argument", "--version", "aocc@2.2.0")
+
+
def test_fj_flags():
supported_flag_test("openmp_flag", "-Kopenmp", "fj@4.0.0")
supported_flag_test("cxx98_flag", "-std=c++98", "fj@4.0.0")
diff --git a/lib/spack/spack/test/compilers/detection.py b/lib/spack/spack/test/compilers/detection.py
index 4cb80090b5..cf2f7a057a 100644
--- a/lib/spack/spack/test/compilers/detection.py
+++ b/lib/spack/spack/test/compilers/detection.py
@@ -19,6 +19,7 @@ import spack.compilers.nvhpc
import spack.compilers.pgi
import spack.compilers.xl
import spack.compilers.xl_r
+import spack.compilers.aocc
from spack.operating_systems.cray_frontend import CrayFrontend
import spack.util.module_cmd
@@ -288,3 +289,18 @@ def test_cray_frontend_compiler_detection(
paths = cray_fe_os.compiler_search_paths
assert paths == [str(compiler_dir)]
+
+
+@pytest.mark.parametrize('version_str,expected_version', [
+ # This applies to C,C++ and FORTRAN compiler
+ ('AMD clang version 10.0.0 (CLANG: AOCC_2.2.0-Build#93 2020_06_25)'
+ '(based on LLVM Mirror.Version.10.0.0)\n'
+ 'Target: x86_64-unknown-linux-gnu\n'
+ 'Thread model: posix\n', '2.2.0'
+ )
+])
+def test_aocc_version_detection(version_str, expected_version):
+ version = spack.compilers.aocc.Aocc.extract_version_from_output(
+ version_str
+ )
+ assert version == expected_version
diff --git a/var/spack/repos/builtin/packages/aocc/package.py b/var/spack/repos/builtin/packages/aocc/package.py
new file mode 100755
index 0000000000..74649db620
--- /dev/null
+++ b/var/spack/repos/builtin/packages/aocc/package.py
@@ -0,0 +1,66 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+
+from spack import *
+
+
+class Aocc(Package):
+ '''
+ The AOCC compiler system is a high performance,
+ production quality code generation tool.
+ The AOCC environment provides various options to developers when
+ building and optimizing C, C++, and Fortran applications
+ targeting 32-bit and 64-bit Linux platforms.
+ The AOCC compiler system offers a high level of advanced optimizations,
+ multi-threading and processor support that includes global optimization,
+ vectorization, inter-procedural analyses, loop transformations,
+ and code generation.
+ AMD also provides highly optimized libraries,
+ which extract the optimal performance from
+ each x86 processor core when utilized.
+ The AOCC Compiler Suite simplifies and accelerates development and
+ tuning for x86 applications.
+ Please install only if you agree to terms and conditions depicted
+ under : http://developer.amd.com/wordpress/media/files/AOCC_EULA.pdf
+ Example for installation: \'spack install aocc +license-agreed\'
+ '''
+ family = 'compiler'
+ homepage = "https://developer.amd.com/amd-aocc/"
+ version(ver="2.2.0", sha256='500940ce36c19297dfba3aa56dcef33b6145867a1f34890945172ac2be83b286',
+ url='http://developer.amd.com/wordpress/media/files/aocc-compiler-2.2.0.tar')
+
+ # Licensing
+ license_required = True
+ license_comment = '#'
+ license_files = ['AOCC_EULA.pdf']
+ license_url = 'http://developer.amd.com/wordpress/media/files/AOCC_EULA.pdf'
+ install_example = "spack install aocc +license-agreed"
+
+ depends_on('libxml2')
+ depends_on('zlib')
+ depends_on('ncurses')
+ depends_on('libtool')
+ depends_on('texinfo')
+
+ variant('license-agreed', default=False,
+ description='Agree to terms and conditions depicted under : {0}'
+ .format(license_url))
+
+ @run_before('install')
+ def abort_without_license_agreed(self):
+ license_url = 'http://developer.amd.com/wordpress/media/files/AOCC_EULA.pdf'
+ install_example = "spack install aocc +license-agreed"
+ if not self.spec.variants['license-agreed'].value:
+ raise InstallError("\n\n\nNOTE:\nUse +license-agreed " +
+ "during installation " +
+ "to accept terms and conditions " +
+ "depicted under following link \n" +
+ " {0}\n".format(license_url) +
+ "Example: \'{0}\' \n".format(install_example))
+
+ def install(self, spec, prefix):
+ print("Installing AOCC Compiler ... ")
+ install_tree('.', prefix)