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
This commit is contained in:
Peter Scheibel 2021-12-02 15:49:20 -08:00 committed by GitHub
parent 693a15ea00
commit edb971a10e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 1 deletions

2
lib/spack/env/cc vendored
View file

@ -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"

1
lib/spack/env/oneapi/dpcpp vendored Symbolic link
View file

@ -0,0 +1 @@
../cc

View file

@ -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'}