Skip to content

Commit

Permalink
Add the library version header, and update oneDPL version to 2022.7.0 (
Browse files Browse the repository at this point in the history
  • Loading branch information
akukanov authored Sep 6, 2024
1 parent 07fe7e6 commit 0bfd477
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 31 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ option(ONEDPL_USE_AOT_COMPILATION "Enable the ahead of time compilation" OFF)
option(ONEDPL_ENABLE_SIMD "Enable SIMD vectorization by passing an OpenMP SIMD flag to the compiler if supported" ON)
cmake_dependent_option(ONEDPL_TEST_WIN_ICX_FIXES "Enable icx workarounds for Windows" ON "CMAKE_HOST_WIN32;NOT _onedpl_is_subproject" OFF)

file(READ ${CMAKE_CURRENT_SOURCE_DIR}/include/oneapi/dpl/pstl/onedpl_config.h
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/include/oneapi/dpl/internal/version_impl.h
_onedpl_version_info
LIMIT 1024)
string(REGEX REPLACE ".*#define ONEDPL_VERSION_MAJOR ([0-9]+).*" "\\1" _onedpl_ver_major "${_onedpl_version_info}")
Expand Down
2 changes: 1 addition & 1 deletion cmake/scripts/generate_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ endif()

set(ONEDPL_ROOT "${CMAKE_CURRENT_LIST_DIR}/../..")

file(READ ${ONEDPL_ROOT}/include/oneapi/dpl/pstl/onedpl_config.h _onedpl_version_info LIMIT 1024)
file(READ ${ONEDPL_ROOT}/include/oneapi/dpl/internal/version_impl.h _onedpl_version_info LIMIT 1024)
string(REGEX REPLACE ".*#define ONEDPL_VERSION_MAJOR ([0-9]+).*" "\\1" _onedpl_ver_major "${_onedpl_version_info}")
string(REGEX REPLACE ".*#define ONEDPL_VERSION_MINOR ([0-9]+).*" "\\1" _onedpl_ver_minor "${_onedpl_version_info}")
string(REGEX REPLACE ".*#define ONEDPL_VERSION_PATCH ([0-9]+).*" "\\1" _onedpl_ver_patch "${_onedpl_version_info}")
Expand Down
2 changes: 1 addition & 1 deletion documentation/library_guide/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
author = 'Intel'

# The full version, including alpha/beta/rc tags
release = '2022.6.0'
release = '2022.7.0'

rst_epilog = """
.. include:: /variables.txt
Expand Down
17 changes: 17 additions & 0 deletions documentation/library_guide/macros.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ Macro Description
``_PSTL_VERSION_PATCH`` ``_PSTL_VERSION % 10``: The patch number.
================================= ==============================

Feature Macros
==============
Use these macros to test presence of specific |onedpl_short| functionality.

================================== ===============================================
Macro Macro values and the functionality
================================== ===============================================
``ONEDPL_HAS_RANDOM_NUMBERS`` Pseudo-random number generators and distributions.

* ``202409L`` - added support of comparison and I/O stream operators and an experimental Philox engine
---------------------------------- -----------------------------------------------
``ONEDPL_HAS_RANGE_ALGORITHMS`` Parallel range algorithms.

* ``202409L`` - for_each, transform, find, find_if, find_if_not, any_of, all_of, none_of, adjacent_find, search, search_n,
count, count_if, equal, is_sorted, sort, stable_sort, min_element, max_element, copy, copy_if, merge
================================== ===============================================

Additional Macros
==================
Use these macros to control aspects of |onedpl_short| usage. You can set them in your program code
Expand Down
41 changes: 41 additions & 0 deletions include/oneapi/dpl/internal/version_impl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Copyright (C) Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef _ONEDPL_VERSION_IMPL_H
#define _ONEDPL_VERSION_IMPL_H

// The library version
#define ONEDPL_VERSION_MAJOR 2022
#define ONEDPL_VERSION_MINOR 7
#define ONEDPL_VERSION_PATCH 0

#if _ONEDPL___cplusplus >= 202002L && __has_include(<version>)
# include <version> // The standard C++20 header
# define _ONEDPL_STD_FEATURE_MACROS_PRESENT 1
// Clang 15 and older do not support range adaptors, see https://bugs.llvm.org/show_bug.cgi?id=44833
# define _ONEDPL_CPP20_RANGES_PRESENT ((__cpp_lib_ranges >= 201911L) && !(__clang__ && __clang_major__ < 16))
#else
# define _ONEDPL_STD_FEATURE_MACROS_PRESENT 0
# define _ONEDPL_CPP20_RANGES_PRESENT 0
#endif

#ifndef _PSTL_VERSION
# define _PSTL_VERSION 14000
# define _PSTL_VERSION_MAJOR (_PSTL_VERSION / 1000)
# define _PSTL_VERSION_MINOR ((_PSTL_VERSION % 1000) / 10)
# define _PSTL_VERSION_PATCH (_PSTL_VERSION % 10)
#endif

// Feature macros
#define ONEDPL_HAS_RANDOM_NUMBERS 202409L
#if _ONEDPL_CPP20_RANGES_PRESENT
# define ONEDPL_HAS_RANGE_ALGORITHMS 202409L
#endif

#endif // _ONEDPL_VERSION_IMPL_H
20 changes: 2 additions & 18 deletions include/oneapi/dpl/pstl/onedpl_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,8 @@
#ifndef _ONEDPL_CONFIG_H
#define _ONEDPL_CONFIG_H

#ifndef _PSTL_VERSION
# define _PSTL_VERSION 11000
# define _PSTL_VERSION_MAJOR (_PSTL_VERSION / 1000)
# define _PSTL_VERSION_MINOR ((_PSTL_VERSION % 1000) / 10)
# define _PSTL_VERSION_PATCH (_PSTL_VERSION % 10)
#endif

#define ONEDPL_VERSION_MAJOR 2022
#define ONEDPL_VERSION_MINOR 6
#define ONEDPL_VERSION_PATCH 0

#if _ONEDPL___cplusplus >= 202002L && __has_include(<version>)
# include <version>
# define _ONEDPL_STD_FEATURE_MACROS_PRESENT 1
#endif
#include "../internal/version_impl.h"
// The version header also defines a few configuration macros used in this file

#if defined(ONEDPL_FPGA_DEVICE)
# undef _ONEDPL_FPGA_DEVICE
Expand Down Expand Up @@ -304,15 +291,12 @@
#if _ONEDPL_STD_FEATURE_MACROS_PRESENT
# define _ONEDPL_CPP20_SPAN_PRESENT (__cpp_lib_span >= 202002L)
# define _ONEDPL_CPP20_CONCEPTS_PRESENT (__cpp_concepts >= 201907L && __cpp_lib_concepts >= 202002L)
// Clang 15 and older do not support range adaptors, see https://bugs.llvm.org/show_bug.cgi?id=44833
# define _ONEDPL_CPP20_RANGES_PRESENT ((__cpp_lib_ranges >= 201911L) && !(__clang__ && __clang_major__ < 16))
# define _ONEDPL_CPP23_TUPLE_LIKE_COMMON_REFERENCE_PRESENT \
(_ONEDPL___cplusplus >= 202302L && __cpp_lib_tuple_like >= 202207L)
# define _ONEDPL_CPP23_RANGES_ZIP_PRESENT (_ONEDPL___cplusplus >= 202302L && __cpp_lib_ranges_zip >= 202110L)
#else
# define _ONEDPL_CPP20_SPAN_PRESENT 0
# define _ONEDPL_CPP20_CONCEPTS_PRESENT 0
# define _ONEDPL_CPP20_RANGES_PRESENT 0
# define _ONEDPL_CPP23_TUPLE_LIKE_COMMON_REFERENCE_PRESENT 0
# define _ONEDPL_CPP23_RANGES_ZIP_PRESENT 0
#endif
Expand Down
1 change: 1 addition & 0 deletions include/oneapi/dpl/random
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define _ONEDPL_RANDOM

#include "oneapi/dpl/internal/common_config.h"
#include "oneapi/dpl/pstl/onedpl_config.h"
#include "oneapi/dpl/pstl/hetero/dpcpp/sycl_defs.h"
#include <utility>
#include <cstdint>
Expand Down
16 changes: 16 additions & 0 deletions include/oneapi/dpl/version
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Copyright (C) Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef _ONEDPL_VERSION
#define _ONEDPL_VERSION

#include "internal/common_config.h"
#include "internal/version_impl.h"

#endif // _ONEDPL_VERSION
14 changes: 6 additions & 8 deletions test/general/version.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,21 @@

#include "support/test_config.h"

#include _PSTL_TEST_HEADER(execution)

#include <oneapi/dpl/pstl/onedpl_config.h>

#include "support/utils.h"
#include _PSTL_TEST_HEADER(version)

#if !__has_include(<execution>)
static_assert(_PSTL_VERSION == 11000);
static_assert(_PSTL_VERSION_MAJOR == 11);
static_assert(_PSTL_VERSION == 14000);
static_assert(_PSTL_VERSION_MAJOR == 14);
static_assert(_PSTL_VERSION_MINOR == 00);
static_assert(_PSTL_VERSION_PATCH == 0);
#endif

static_assert(ONEDPL_VERSION_MAJOR == 2022);
static_assert(ONEDPL_VERSION_MINOR == 6);
static_assert(ONEDPL_VERSION_MINOR == 7);
static_assert(ONEDPL_VERSION_PATCH == 0);

#include "support/utils.h"

int main() {

return TestUtils::done();
Expand Down
2 changes: 2 additions & 0 deletions test/parallel_api/ranges/std_ranges_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#if _ENABLE_STD_RANGES_TESTING

static_assert(ONEDPL_HAS_RANGE_ALGORITHMS >= 202409L);

#if TEST_CPP20_SPAN_PRESENT
#include <span>
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
#include "support/utils.h"

#if TEST_UNNAMED_LAMBDAS
#include <oneapi/dpl/random>
static_assert(ONEDPL_HAS_RANDOM_NUMBERS >= 202409L);

#include <iostream>
#include <cmath>
#include <vector>
#include <oneapi/dpl/random>

constexpr auto SEED = 777;
constexpr auto N_GEN = 960;
Expand Down
4 changes: 3 additions & 1 deletion test/xpu_api/random/interface_tests/engines_methods.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
#include "support/utils.h"

#if TEST_UNNAMED_LAMBDAS
# include <oneapi/dpl/random>
static_assert(ONEDPL_HAS_RANDOM_NUMBERS >= 202409L);

# include <iostream>
# include <vector>
# include <oneapi/dpl/random>

namespace ex = oneapi::dpl::experimental;

Expand Down

0 comments on commit 0bfd477

Please sign in to comment.