Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BREAKING CHANGE] Move to C++20 - Improve compile times #51

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,33 +144,33 @@ jobs:
- name: Running Unit Tests
run: cd build && ctest --verbose --output-on-failure -j 2

##################################################################################################
## NVCC targets
##################################################################################################
nvcc:
runs-on: ubuntu-latest
container:
image: nvidia/cuda:12.3.2-devel-ubi8
steps:
- name: Fetch current branch
uses: actions/[email protected]
- name: Compiling Unit Tests
run: |
mkdir build && cd build
nvcc ../test/unit/accelerator.cu -std=c++17 -I../include -o accelerator.device.exe
nvcc ../test/unit/accelerator.cpp -std=c++17 -I../include -o accelerator.host.exe
nvcc ../test/unit/arch.cpp -std=c++17 -I../include -o arch.exe
nvcc ../test/unit/compiler.cpp -std=c++17 -I../include -o compiler.exe
nvcc ../test/unit/data_model.cpp -std=c++17 -I../include -o data_model.exe
nvcc ../test/unit/libc.cpp -std=c++17 -I../include -o libc.exe
nvcc ../test/unit/os.cpp -std=c++17 -I../include -o os.exe
nvcc ../test/unit/simd.cpp -std=c++17 -I../include -o simd.exe
nvcc ../test/unit/stdlib.cpp -std=c++17 -I../include -o stdlib.exe
- name: Running Unit Tests
run: |
cd build
./accelerator.device.exe && ./accelerator.host.exe && ./arch.exe && ./compiler.exe && ./data_model.exe && \
./libc.exe && ./os.exe && ./simd.exe && ./stdlib.exe
# ##################################################################################################
# ## NVCC targets
# ##################################################################################################
# nvcc:
# runs-on: ubuntu-latest
# container:
# image: nvcr.io/nvidia/nvhpc:24.11-devel-cuda_multi-ubuntu22.04
# steps:
# - name: Fetch current branch
# uses: actions/[email protected]
# - name: Compiling Unit Tests
# run: |
# mkdir build && cd build
# nvc++ ../test/unit/accelerator.cu -std=c++20 -I../include -o accelerator.device.exe
# nvc++ ../test/unit/accelerator.cpp -std=c++20 -I../include -o accelerator.host.exe
# nvc++ ../test/unit/arch.cpp -std=c++20 -I../include -o arch.exe
# nvc++ ../test/unit/compiler.cpp -std=c++20 -I../include -o compiler.exe
# nvc++ ../test/unit/data_model.cpp -std=c++20 -I../include -o data_model.exe
# nvc++ ../test/unit/libc.cpp -std=c++20 -I../include -o libc.exe
# nvc++ ../test/unit/os.cpp -std=c++20 -I../include -o os.exe
# nvc++ ../test/unit/simd.cpp -std=c++20 -I../include -o simd.exe
# nvc++ ../test/unit/stdlib.cpp -std=c++20 -I../include -o stdlib.exe
# - name: Running Unit Tests
# run: |
# cd build
# ./accelerator.device.exe && ./accelerator.host.exe && ./arch.exe && ./compiler.exe && ./data_model.exe && \
# ./libc.exe && ./os.exe && ./simd.exe && ./stdlib.exe

##################################################################################################
## DPC++ Target
Expand Down
2 changes: 1 addition & 1 deletion cmake/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
##======================================================================================================================
add_library(spy_tests INTERFACE)

target_compile_features ( spy_tests INTERFACE cxx_std_17 )
target_compile_features ( spy_tests INTERFACE cxx_std_20 )

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
Expand Down
2 changes: 1 addition & 1 deletion doc/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<script type="text/javascript">
DoxygenAwesomeParagraphLink.init()
DoxygenAwesomeFragmentCopyButton.init()
SendToGodbolt.init("spy","clang1600","-O3 -std=c++17 -DNEDBUG")
SendToGodbolt.init("spy","clang1600","-O3 -std=c++20 -DNEDBUG")
</script>
$treeview
$search
Expand Down
2 changes: 1 addition & 1 deletion doc/index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//! [Boost.Predef](https://www.boost.org/doc/libs/release/doc/html/predef.html) provides a sanitized
//! interface on top of those but still live in a world where the preprocessor is king.
//!
//! SPY is a C++17 (and onward) library that gathers similar information and provides a `constexpr`
//! SPY is a C++20 (and onward) library that gathers similar information and provides a `constexpr`
//! compatible interface to access those information, thus making their exploitation within `constexpr`
//! context possible.
//!
Expand Down
268 changes: 268 additions & 0 deletions doc/spy.tag
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<tagfile doxygen_version="1.9.8" doxygen_gitid="c2fe5c3e4986974eb2a97608b24086683502f07f">
<compound kind="namespace">
<name>literal</name>
<filename>namespaceliteral.html</filename>
</compound>
<compound kind="namespace">
<name>spy</name>
<filename>namespacespy.html</filename>
<member kind="variable">
<type>constexpr arch_type</type>
<name>architecture</name>
<anchorfile>group__api_gaad5f2aa34188a02b894a0d8c7e402d6e.html</anchorfile>
<anchor>gaad5f2aa34188a02b894a0d8c7e402d6e</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr compiler_type</type>
<name>compiler</name>
<anchorfile>group__api_ga2d96c18fea5b9a06ac37487ab570599d.html</anchorfile>
<anchor>ga2d96c18fea5b9a06ac37487ab570599d</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr auto</type>
<name>data_model</name>
<anchorfile>group__api_gaa091fe192a7f9d0d164cf7546083200d.html</anchorfile>
<anchor>gaa091fe192a7f9d0d164cf7546083200d</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr auto</type>
<name>libc</name>
<anchorfile>group__api_ga03dc3f2a9b02b025902f9df3b2db53ab.html</anchorfile>
<anchor>ga03dc3f2a9b02b025902f9df3b2db53ab</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr os_type</type>
<name>operating_system</name>
<anchorfile>group__api_gadb7c5be967e00cff21ae5b98cc12a7dc.html</anchorfile>
<anchor>gadb7c5be967e00cff21ae5b98cc12a7dc</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr auto</type>
<name>simd_instruction_set</name>
<anchorfile>group__api_ga45f64b82d4939d55865b0e6a311b2dde.html</anchorfile>
<anchor>ga45f64b82d4939d55865b0e6a311b2dde</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr auto</type>
<name>stdlib</name>
<anchorfile>group__api_gafe99b815db524eacf659ba8348ca2e0d.html</anchorfile>
<anchor>gafe99b815db524eacf659ba8348ca2e0d</anchor>
<arglist></arglist>
</member>
</compound>
<compound kind="namespace">
<name>supports</name>
<filename>namespacesupports.html</filename>
</compound>
<compound kind="group">
<name>api</name>
<title>Main API</title>
<filename>group__api.html</filename>
<member kind="variable">
<type>constexpr bool</type>
<name>spy::supports::address_sanitizers_status</name>
<anchorfile>group__api_ga37e2c07363dadf1eb40e89a9a91f8121.html</anchorfile>
<anchor>ga37e2c07363dadf1eb40e89a9a91f8121</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr arch_type</type>
<name>spy::architecture</name>
<anchorfile>group__api_gaad5f2aa34188a02b894a0d8c7e402d6e.html</anchorfile>
<anchor>gaad5f2aa34188a02b894a0d8c7e402d6e</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr compiler_type</type>
<name>spy::compiler</name>
<anchorfile>group__api_ga2d96c18fea5b9a06ac37487ab570599d.html</anchorfile>
<anchor>ga2d96c18fea5b9a06ac37487ab570599d</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr auto</type>
<name>spy::supports::cuda</name>
<anchorfile>group__api_gaad706954aedb6aaf6ff1a9858a971e00.html</anchorfile>
<anchor>gaad706954aedb6aaf6ff1a9858a971e00</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr auto</type>
<name>spy::data_model</name>
<anchorfile>group__api_gaa091fe192a7f9d0d164cf7546083200d.html</anchorfile>
<anchor>gaa091fe192a7f9d0d164cf7546083200d</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr auto</type>
<name>spy::libc</name>
<anchorfile>group__api_ga03dc3f2a9b02b025902f9df3b2db53ab.html</anchorfile>
<anchor>ga03dc3f2a9b02b025902f9df3b2db53ab</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr os_type</type>
<name>spy::operating_system</name>
<anchorfile>group__api_gadb7c5be967e00cff21ae5b98cc12a7dc.html</anchorfile>
<anchor>gadb7c5be967e00cff21ae5b98cc12a7dc</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr auto</type>
<name>spy::supports::posix_</name>
<anchorfile>group__api_ga63eef44bc05ea6f77f278ba5b394ada8.html</anchorfile>
<anchor>ga63eef44bc05ea6f77f278ba5b394ada8</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr bool</type>
<name>spy::supports::sanitizers_status</name>
<anchorfile>group__api_ga28313e4f9673ea0f5d0ca44ffd1a967a.html</anchorfile>
<anchor>ga28313e4f9673ea0f5d0ca44ffd1a967a</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr auto</type>
<name>spy::simd_instruction_set</name>
<anchorfile>group__api_ga45f64b82d4939d55865b0e6a311b2dde.html</anchorfile>
<anchor>ga45f64b82d4939d55865b0e6a311b2dde</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr auto</type>
<name>spy::stdlib</name>
<anchorfile>group__api_gafe99b815db524eacf659ba8348ca2e0d.html</anchorfile>
<anchor>gafe99b815db524eacf659ba8348ca2e0d</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr auto</type>
<name>spy::supports::sycl</name>
<anchorfile>group__api_ga03e4a3ae6533a43cdf9bcbf1317707cd.html</anchorfile>
<anchor>ga03e4a3ae6533a43cdf9bcbf1317707cd</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>constexpr bool</type>
<name>spy::supports::thread_sanitizers_status</name>
<anchorfile>group__api_ga16591d3ea9aaa049682bfbedd519dc43.html</anchorfile>
<anchor>ga16591d3ea9aaa049682bfbedd519dc43</anchor>
<arglist></arglist>
</member>
<member kind="function">
<type>constexpr auto</type>
<name>spy::literal::operator&quot;&quot;_clang</name>
<anchorfile>group__api.html</anchorfile>
<anchor>gab3e0f11a5ec1b2963564755b84630970</anchor>
<arglist>()</arglist>
</member>
<member kind="function">
<type>constexpr auto</type>
<name>spy::literal::operator&quot;&quot;_cloud</name>
<anchorfile>group__api.html</anchorfile>
<anchor>ga1dc236e3cae2ef3c7ec23d45659b7b30</anchor>
<arglist>()</arglist>
</member>
<member kind="function">
<type>constexpr auto</type>
<name>spy::literal::operator&quot;&quot;_dpcpp</name>
<anchorfile>group__api.html</anchorfile>
<anchor>gab38166c11c2a99b2257e00630db206ec</anchor>
<arglist>()</arglist>
</member>
<member kind="function">
<type>constexpr auto</type>
<name>spy::literal::operator&quot;&quot;_em</name>
<anchorfile>group__api.html</anchorfile>
<anchor>ga8b0155c33f6f54c0d1d2dd498417c536</anchor>
<arglist>()</arglist>
</member>
<member kind="function">
<type>constexpr auto</type>
<name>spy::literal::operator&quot;&quot;_gcc</name>
<anchorfile>group__api.html</anchorfile>
<anchor>ga542b6a98ac5e95f906da14325a2064be</anchor>
<arglist>()</arglist>
</member>
<member kind="function">
<type>constexpr auto</type>
<name>spy::literal::operator&quot;&quot;_gnu</name>
<anchorfile>group__api.html</anchorfile>
<anchor>ga01fac6d9d1025344d16c3ab4fee137c8</anchor>
<arglist>()</arglist>
</member>
<member kind="function">
<type>constexpr auto</type>
<name>spy::literal::operator&quot;&quot;_intel</name>
<anchorfile>group__api.html</anchorfile>
<anchor>ga17b7828b022e763e749aebf056d24195</anchor>
<arglist>()</arglist>
</member>
<member kind="function">
<type>constexpr auto</type>
<name>spy::literal::operator&quot;&quot;_msvc</name>
<anchorfile>group__api.html</anchorfile>
<anchor>gaafdbca6599d9792e579da8041b5addcd</anchor>
<arglist>()</arglist>
</member>
<member kind="function">
<type>constexpr auto</type>
<name>spy::literal::operator&quot;&quot;_nvcc</name>
<anchorfile>group__api.html</anchorfile>
<anchor>ga39f9d138ef1adb4b5c12f4279878f1fc</anchor>
<arglist>()</arglist>
</member>
<member kind="function">
<type>constexpr auto</type>
<name>spy::literal::operator&quot;&quot;_uc</name>
<anchorfile>group__api.html</anchorfile>
<anchor>ga0c3666ca0bb5f551cc0103e355a28569</anchor>
<arglist>()</arglist>
</member>
<member kind="function">
<type>constexpr auto</type>
<name>spy::literal::operator&quot;&quot;_vms</name>
<anchorfile>group__api.html</anchorfile>
<anchor>ga772746f665f6dd13b9a6c8bd19564dab</anchor>
<arglist>()</arglist>
</member>
<member kind="function">
<type>constexpr auto</type>
<name>spy::literal::operator&quot;&quot;_zos</name>
<anchorfile>group__api.html</anchorfile>
<anchor>ga3c0e24636d16a543f4bf2ed64875eaeb</anchor>
<arglist>()</arglist>
</member>
</compound>
<compound kind="page">
<name>changelog</name>
<title>Change Log</title>
<filename>changelog.html</filename>
</compound>
<compound kind="page">
<name>licence</name>
<title>Licence</title>
<filename>licence.html</filename>
</compound>
<compound kind="page">
<name>setup</name>
<title>Setup</title>
<filename>setup.html</filename>
<docanchor file="setup.html" title="Install from the source">setup-source</docanchor>
<docanchor file="setup.html" title="Standalone setup">setup-standalone</docanchor>
<docanchor file="setup.html" title="CMake FetchContent">setup-fetchcontent</docanchor>
<docanchor file="setup.html" title="Setup with CPM">setup-cpm</docanchor>
</compound>
<compound kind="page">
<name>index</name>
<title>The C++ Information Broker</title>
<filename>index.html</filename>
</compound>
</tagfile>
7 changes: 4 additions & 3 deletions include/spy/accelerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
*/
//==================================================================================================
#pragma once
#include <ostream>

namespace spy::supports
{
template<int M, int N, int P> struct sycl_t
{
explicit constexpr operator bool() const noexcept { return M>0 && N>0; }

friend std::ostream& operator<<(std::ostream& os, sycl_t)
template<_::stream OS>
friend OS& operator<<(OS& os, sycl_t)
{
os << "SYCL v" << M << '.' << N;
if(P>0) os << '.' << P;
Expand All @@ -38,7 +38,8 @@ namespace spy::supports
{
explicit constexpr operator bool() const noexcept { return M>0 && N>0; }

friend std::ostream& operator<<(std::ostream& os, cuda_t)
template<_::stream OS>
friend OS& operator<<(OS& os, cuda_t)
{
os << "NVCC CUDA v" << M << '.' << N;
if(P>0) os << '.' << P;
Expand Down
Loading