Skip to content

Commit 1e95837

Browse files
committed
Update documentation to add CUDA
1 parent af47854 commit 1e95837

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

doc/charconv/api_reference.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ https://www.boost.org/LICENSE_1_0.txt
3232

3333
- <<integral_usage_notes_, `BOOST_CHARCONV_CONSTEXPR`>>
3434
- <<run_benchmarks_, `BOOST_CHARCONV_RUN_BENCHMARKS`>>
35+
- <<host_device_, `BOOST_CHARCONV_HOST_DEVICE`>>

doc/charconv/from_chars.adoc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ struct from_chars_result
2525
const char* ptr;
2626
std::errc ec;
2727
28-
friend constexpr bool operator==(const from_chars_result& lhs, const from_chars_result& rhs) noexcept = default;
29-
constexpr explicit operator bool() const noexcept { return ec == std::errc{}; }
28+
BOOST_CHARCONV_HOST_DEVICE friend constexpr bool operator==(const from_chars_result& lhs, const from_chars_result& rhs) noexcept = default;
29+
BOOST_CHARCONV_HOST_DEVICE constexpr explicit operator bool() const noexcept { return ec == std::errc{}; }
3030
}
3131
3232
template <typename Integral>
33-
BOOST_CXX14_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, Integral& value, int base = 10) noexcept;
33+
BOOST_CHARCONV_HOST_DEVICE BOOST_CXX14_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, Integral& value, int base = 10) noexcept;
3434
3535
template <typename Integral>
3636
BOOST_CXX14_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, Integral& value, int base = 10) noexcept;
@@ -54,6 +54,12 @@ from_chars_result from_chars_erange(boost::core::string_view sv, Real& value, ch
5454
}} // Namespace boost::charconv
5555
----
5656

57+
[#host_device_]
58+
== `BOOST_CHARCONV_HOST_DEVICE`
59+
60+
When compiling the library with NVCC, functions marked `BOOST_CHARCONV_HOST_DEVICE` expands to `pass:[__host__ __device__]` for use on both CPU and GPU.
61+
Otherwise `BOOST_CHARCONV_HOST_DEVICE` expands to the empty string.
62+
5763
== from_chars parameters
5864
* `first`, `last` - pointers to a valid range to parse
5965
* `sv` - string view of a valid range to parse.

doc/charconv/overview.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ Boost.Charconv converts character buffers to numbers, and numbers to character b
1515
It is a small library of two overloaded functions to do the heavy lifting, plus several supporting enums, structures, templates, and constants, with a particular focus on performance and consistency
1616
across the supported development environments.
1717

18-
Why should I be interested in this Library? Charconv is locale-independent, non-allocating^1^, non-throwing and only requires a minimum of C++ 11.
18+
Why should I be interested in this Library? Charconv is locale-independent, non-allocating^1^, non-throwing and only requires a minimum of pass:[C++11].
1919
It provides functionality similar to that found in `std::printf` or `std::strtod` with <<benchmark_results_, substantial performance increases>>.
2020
This library can also be used in place of the standard library `<charconv>` if unavailable with your toolchain.
21+
The integer portion of the library can also be used on GPU with NVCC.
2122
Currently only https://en.cppreference.com/w/cpp/compiler_support/17.html[GCC 11+ and MSVC 19.24+] support both integer and floating-point conversions in their implementation of `<charconv>`. +
2223
If you are using either of those compilers, Boost.Charconv is at least as performant as `<charconv>`, and can be up to several times faster.
2324
See: <<Benchmarks>>
@@ -31,5 +32,6 @@ Boost.Charconv is tested on Ubuntu, macOS, and Windows with the following compil
3132
* GCC 5 or later
3233
* Clang 3.8 or later
3334
* Visual Studio 2015 (14.0) or later
35+
* NVCC 12.8 or later
3436

3537
Tested on https://github.com/boostorg/charconv/actions[GitHub Actions] and https://drone.cpp.al/boostorg/charconv[Drone].

doc/charconv/to_chars.adoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ struct to_chars_result
2525
char* ptr;
2626
std::errc ec;
2727
28-
friend constexpr bool operator==(const to_chars_result& lhs, const to_chars_result& rhs) noexcept; = default;
29-
constexpr explicit operator bool() const noexcept { return ec == std::errc{}; }
28+
BOOST_CHARCONV_HOST_DEVICE friend constexpr bool operator==(const to_chars_result& lhs, const to_chars_result& rhs) noexcept; = default;
29+
BOOST_CHARCONV_HOST_DEVICE constexpr explicit operator bool() const noexcept { return ec == std::errc{}; }
3030
};
3131
3232
template <typename Integral>
33-
BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, Integral value, int base = 10) noexcept;
33+
BOOST_CHARCONV_HOST_DEVICE BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, Integral value, int base = 10) noexcept;
3434
3535
template <typename Integral>
3636
BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars<bool>(char* first, char* last, Integral value, int base) noexcept = delete;
@@ -71,6 +71,7 @@ See <<chars_format overview>> for description.
7171
** compiled using `-std=c++14` or newer
7272
** using a compiler with `\__builtin_ is_constant_evaluated`
7373
* These functions have been tested to support `\__int128` and `unsigned __int128`
74+
* When compiling with NVCC, (e.g., `BOOST_CHARCONV_HOST_DEVICE` defined as `pass:[__host__ __device__]`), these functions are available for use on CPU and GPU.
7475

7576
=== Usage notes for to_chars for floating point types
7677
* The following will be returned when handling different values of `NaN`

0 commit comments

Comments
 (0)