summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/spack/env/cc2
l---------lib/spack/env/oneapi/dpcpp1
-rw-r--r--lib/spack/spack/compilers/dpcpp.py29
3 files changed, 31 insertions, 1 deletions
diff --git a/lib/spack/env/cc b/lib/spack/env/cc
index c498db0583..59ff0001e1 100755
--- a/lib/spack/env/cc
+++ b/lib/spack/env/cc
@@ -248,7 +248,7 @@ case "$command" in
lang_flags=C
debug_flags="-g"
;;
- c++|CC|g++|clang++|armclang++|icpc|icpx|pgc++|nvc++|xlc++|xlc++_r|FCC)
+ c++|CC|g++|clang++|armclang++|icpc|icpx|dpcpp|pgc++|nvc++|xlc++|xlc++_r|FCC)
command="$SPACK_CXX"
language="C++"
comp="CXX"
diff --git a/lib/spack/env/oneapi/dpcpp b/lib/spack/env/oneapi/dpcpp
new file mode 120000
index 0000000000..82c2b8e90a
--- /dev/null
+++ b/lib/spack/env/oneapi/dpcpp
@@ -0,0 +1 @@
+../cc \ No newline at end of file
diff --git a/lib/spack/spack/compilers/dpcpp.py b/lib/spack/spack/compilers/dpcpp.py
new file mode 100644
index 0000000000..664b1d86c5
--- /dev/null
+++ b/lib/spack/spack/compilers/dpcpp.py
@@ -0,0 +1,29 @@
+# Copyright 2013-2021 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 spack.compilers.oneapi
+
+
+class Dpcpp(spack.compilers.oneapi.Oneapi):
+ """This is the same as the oneAPI compiler but uses dpcpp instead of
+ icpx (for DPC++ source files). It explicitly refers to dpcpp, so that
+ CMake test files which check the compiler name (e.g. CMAKE_CXX_COMPILER)
+ detect it as dpcpp.
+
+ Ideally we could switch out icpx for dpcpp where needed in the oneAPI
+ compiler definition, but two things are needed for that: (a) a way to
+ tell the compiler that it should be using dpcpp and (b) a way to
+ customize the link_paths
+
+ See also: https://www.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top/compiler-setup/using-the-command-line/invoking-the-compiler.html
+ """
+ # Subclasses use possible names of C++ compiler
+ cxx_names = ['dpcpp']
+
+ # Named wrapper links within build_env_path
+ link_paths = {'cc': 'oneapi/icx',
+ 'cxx': 'oneapi/dpcpp',
+ 'f77': 'oneapi/ifx',
+ 'fc': 'oneapi/ifx'}