Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Add a profile for ICC-2022. (#403)
Browse files Browse the repository at this point in the history
* Add a profile for ICC-2022.

* Drop the subversion specifics

* Use the right compiler

* Work around strange ICC compiler quircks

* Disable `-ffast-math` for IntelLLVM compilers

This breaks essentially all floating point tests. With this I can run the whole test suite fine with ICC-2023.0.0

* Update environments/linux/docker/icc.base.Dockerfile

Co-authored-by: Georgy Evtushenko <[email protected]>

* icc-2023->2022

Co-authored-by: Georgy Evtushenko <[email protected]>

---------

Co-authored-by: Michael Schellenberger Costa <[email protected]>
Co-authored-by: Georgy Evtushenko <[email protected]>
  • Loading branch information
3 people authored Mar 23, 2023
1 parent 0178dc7 commit 97d2daa
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .upstream-tests/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ if (NOT MSVC)
--compiler-options=-Wextra")
endif()

# Intel OneAPI compiler has fast math enabled by default which breaks almost all floating point tests
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "IntelLLVM")
set(LIBCUDACXX_TEST_COMPILER_FLAGS
"${LIBCUDACXX_TEST_COMPILER_FLAGS} \
--compiler-options=-fno-fast-math")
endif()

if (${CMAKE_CUDA_COMPILER_ID} STREQUAL "NVIDIA")
set(LIBCUDACXX_TEST_COMPILER_FLAGS
"${LIBCUDACXX_TEST_COMPILER_FLAGS} \
Expand Down
14 changes: 14 additions & 0 deletions environments/linux/docker/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ services:

## Configured images ##
### Ubuntu 22.04 images:
icc-2022:
image: "libcudacxx/icc-2022"
profiles: ["icc-2022", "all", "base"]
tty: true
build:
context: ../../../
dockerfile: environments/linux/docker/icc.base.Dockerfile
target: libcudacxx-configured
args:
ICC_TOOLKIT_VER: "2022.2.1"
HOST_CXX: "icpx"
BUILDKIT_INLINE_CACHE: "1"
ROOT_IMAGE: "nvcr.io/nvidia/cuda:12.1.0-devel-ubuntu22.04"
deploy: *deploy-template

gcc-11:
extends:
Expand Down
95 changes: 95 additions & 0 deletions environments/linux/docker/icc.base.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Copyright (c) 2018-2023 NVIDIA Corporation
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Released under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.

ARG ROOT_IMAGE

FROM ${ROOT_IMAGE} AS devenv

ARG COMPILERS="gcc clang"
ARG ICC_TOOLKIT_VER="latest"
ARG CMAKE_VER=3.23.1
ARG CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Linux-x86_64.sh

# `-y` answers yes to any interactive prompts.
# `-qq` because apt is noisy
ARG APT_GET="apt-get -y -qq"

ENV TZ=US/Pacific
ENV DEBIAN_FRONTEND=noninteractive
# apt-key complains about non-interactive usage.
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1

SHELL ["/usr/bin/env", "bash", "-c"]

ADD ${CMAKE_URL} /tmp/cmake.sh

# Install baseline development tools
RUN function comment() { :; }; \
comment "Sources for gcc"; \
source /etc/os-release; \
${APT_GET} update; \
comment "Install basic build tools"; \
${APT_GET} --no-install-recommends install apt-utils curl wget git zip unzip tar \
sudo make software-properties-common ninja-build ccache pkg-config \
python3 python3-wheel python3-pip; \
comment "Install GCC and Clang"; \
# Unattended installation hack
${APT_GET} install gcc g++ ${COMPILERS}; \
comment "Install CMake"; \
sh /tmp/cmake.sh --skip-license --prefix=/usr; \
comment "Install Python utils"; \
update-alternatives --quiet --install /usr/bin/python python $(which python3) 3; \
update-alternatives --quiet --set python $(which python3); \
python3 -m pip install setuptools wheel; \
python3 -m pip install lit; \
rm -rf /var/lib/apt/lists/*

# Snag Intel stuff
RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | \
gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null; \
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | \
sudo tee /etc/apt/sources.list.d/oneAPI.list; \
${APT_GET} update; ${APT_GET} install intel-dpcpp-cpp-compiler-${ICC_TOOLKIT_VER};

ENV PATH="$PATH:/opt/intel/oneapi/compiler/${ICC_TOOLKIT_VER}/linux/bin"

# Assemble libcudacxx specific bits

FROM devenv AS libcudacxx-configured

# Default path according to CUDA Docker image, overridable if the image requires it
ARG CUDACXX_PATH=/usr/local/cuda/bin/nvcc

ARG HOST_CXX=gcc
ARG CXX_DIALECT=11

# Attempt to load env from cccl/cuda
ARG TEST_WITH_NVRTC=OFF

# Docker on Windows can't follow symlinks???
ADD . /libcudacxx
ADD ./include/cuda/std/detail/libcxx/include /libcudacxx/libcxx/include
ADD ./.upstream-tests/test /libcudacxx/test
ADD ./.upstream-tests/utils /libcudacxx/utils

ENV CUDAFLAGS="-allow-unsupported-compiler"

RUN cmake -S /libcudacxx -B /build \
-G Ninja \
-DLIBCUDACXX_ENABLE_STATIC_LIBRARY=OFF \
-DLIBCUDACXX_ENABLE_LIBCUDACXX_TESTS=ON \
-DLIBCUDACXX_ENABLE_LIBCXX_TESTS=OFF \
-DLIBCUDACXX_TEST_COMPILER_FLAGS="-allow-unsupported-compiler" \
-DLIBCUDACXX_TEST_WITH_NVRTC=${TEST_WITH_NVRTC} \
-DLIBCUDACXX_TEST_STANDARD_VER=c++${CXX_DIALECT} \
-DLIBCXX_ENABLE_FILESYSTEM=OFF \
-DCMAKE_CXX_COMPILER=${HOST_CXX} \
-DCMAKE_CUDA_COMPILER=${CUDACXX_PATH} \
-DCMAKE_CUDA_FLAGS="-allow-unsupported-compiler"

RUN ninja -C /build libcudacxx_tu_tests && ninja -C /build clean
# RUN ninja -C /build cxx

ENV LIBCUDACXX_SITE_CONFIG=/build/test/lit.site.cfg
22 changes: 20 additions & 2 deletions include/cuda/std/detail/libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,8 @@ typedef __char32_t char32_t;
#define _LIBCUDACXX_HAS_VIRTUAL_DESTRUCTOR(...) __has_virtual_destructor(__VA_ARGS__)
#endif

#if __check_builtin(is_literal)
#define _LIBCUDACXX_IS_LITERAL(...) __is_literal(__VA_ARGS__)
#if __check_builtin(is_literal_type)
#define _LIBCUDACXX_IS_LITERAL(...) __is_literal_type(__VA_ARGS__)
#endif

#if !defined(_LIBCUDACXX_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
Expand Down Expand Up @@ -682,6 +682,10 @@ typedef __char32_t char32_t;
#define _LIBCUDACXX_ADDRESSOF(...) __builtin_addressof(__VA_ARGS__)
#endif

#if __check_builtin(decay)
#define _LIBCUDACXX_DECAY(...) __decay(__VA_ARGS__)
#endif

#if __check_builtin(is_array)
#define _LIBCUDACXX_IS_ARRAY(...) __is_array(__VA_ARGS__)
#endif
Expand Down Expand Up @@ -2034,6 +2038,20 @@ extern "C" _LIBCUDACXX_FUNC_VIS void __sanitizer_annotate_contiguous_container(
# define _LIBCUDACXX_CPO_ACCESSIBILITY _LIBCUDACXX_INLINE_VAR
#endif

#if defined(__INTEL_LLVM_COMPILER)
# define _LIBCUDACXX_USE_DECAY_FALLBACK
# define _LIBCUDACXX_USE_MAKE_SIGNED_FALLBACK
# define _LIBCUDACXX_USE_MAKE_UNSIGNED_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_ALL_EXTENTS_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_CONST_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_CV_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_CVREF_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_EXTENT_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_POINTER_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_VOLATILE_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_REFERENCE_T_FALLBACK
#endif // __INTEL_LLVM_COMPILER

#endif // __cplusplus

#endif // _LIBCUDACXX_CONFIG
6 changes: 3 additions & 3 deletions include/cuda/std/detail/libcxx/include/__type_traits/decay.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ struct decay {
#else

template <class _Up, bool>
struct __decay {
struct __decay_impl {
typedef _LIBCUDACXX_NODEBUG_TYPE __remove_cv_t<_Up> type;
};

template <class _Up>
struct __decay<_Up, true> {
struct __decay_impl<_Up, true> {
public:
typedef _LIBCUDACXX_NODEBUG_TYPE __conditional_t
<
Expand All @@ -64,7 +64,7 @@ struct _LIBCUDACXX_TEMPLATE_VIS decay
private:
typedef _LIBCUDACXX_NODEBUG_TYPE __libcpp_remove_reference_t<_Tp> _Up;
public:
typedef _LIBCUDACXX_NODEBUG_TYPE typename __decay<_Up, __libcpp_is_referenceable<_Up>::value>::type type;
typedef _LIBCUDACXX_NODEBUG_TYPE typename __decay_impl<_Up, __libcpp_is_referenceable<_Up>::value>::type type;
};
#endif // defined(_LIBCUDACXX_DECAY) && !defined(_LIBCUDACXX_USE_DECAY_FALLBACK)

Expand Down
3 changes: 3 additions & 0 deletions libcxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,9 @@ function(cxx_add_warning_flags target)
-Wno-literal-suffix
-Wno-c++14-compat
-Wno-noexcept-type)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "IntelLLVM")
target_add_compile_flags_if_supported(${target} PRIVATE
-fno-fast-math)
endif()
if (LIBCXX_ENABLE_WERROR)
target_add_compile_flags_if_supported(${target} PRIVATE -Werror)
Expand Down

0 comments on commit 97d2daa

Please sign in to comment.