summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Scheibel <scheibel1@llnl.gov>2021-12-02 15:49:20 -0800
committerGitHub <noreply@github.com>2021-12-02 15:49:20 -0800
commitedb971a10e360b673e9fb9a4a7ef09e597b7df5a (patch)
tree255fe1452019f960dc1e42a40ac0025a6d3b417a
parent693a15ea0012a8c44e316b7a2c3ffebf21bc0395 (diff)
downloadspack-edb971a10e360b673e9fb9a4a7ef09e597b7df5a.tar.gz
spack-edb971a10e360b673e9fb9a4a7ef09e597b7df5a.tar.bz2
spack-edb971a10e360b673e9fb9a4a7ef09e597b7df5a.tar.xz
spack-edb971a10e360b673e9fb9a4a7ef09e597b7df5a.zip
Support packages which need to explicitly refer to dpcpp by name (#27168)
* Hack to support packages which need to explicitly refer to dpcpp by name * cc script needs to know about dpcpp
-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'}