You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The buffer API provides a typed container allocated from memory resources. It handles stream-ordered allocation, initialization, and deallocation of memory.
7
10
8
-
``cuda::buffer``
9
-
----------------
11
+
:cpp:class:`cuda::buffer`
12
+
---------------------------
10
13
.. _cccl-runtime-buffer-buffer:
11
14
12
-
``cuda::buffer`` is a container that manages typed storage allocated from a given :ref:`memory resource <libcudacxx-extended-api-memory-resources-resource>` in stream order using a provided :ref:`stream_ref <cccl-runtime-stream-stream-ref>`. The elements are initialized during construction, which may require a kernel launch. The stream provided during construction is stored and later used for deallocation of the buffer, either explicitly or when the buffer destructor is called.
15
+
:cpp:class:`cuda::buffer` is a container that manages typed storage allocated from a given
16
+
:ref:`memory resource <libcudacxx-extended-api-memory-resources-resource>` in stream order using a provided
17
+
:ref:`stream_ref <cccl-runtime-stream-stream-ref>`. The elements are initialized during construction, which may require
18
+
a kernel launch. The stream provided during construction is stored and later used for deallocation of the buffer,
19
+
either explicitly or when the buffer destructor is called.
13
20
14
21
Buffer owns a copy of the memory resource, which means it must be copy-constructible. If a resource is not copy-constructible, like memory pool objects, :ref:`shared_resource <libcudacxx-extended-api-memory-resources-shared-resource>` can be used to attach shared ownership to a resource type.
15
22
16
-
In addition to being typed, ``buffer`` also takes a set of :ref:`properties <libcudacxx-extended-api-memory-resources-properties>` to ensure that memory accessibility and other constraints are checked at compile time.
23
+
In addition to being typed, :cpp:class:`cuda::buffer` also takes a set of
24
+
:ref:`properties <libcudacxx-extended-api-memory-resources-properties>` to ensure that memory accessibility and other
25
+
constraints are checked at compile time.
17
26
18
27
While the buffer operates in stream order, it can also be constructed with a :ref:`synchronous_resource <libcudacxx-extended-api-memory-resources-synchronous-resource>`, in which case it will automatically use the :ref:`synchronous_resource_adapter <libcudacxx-extended-api-memory-resources-synchronous-adapter>` to wrap the provided resource.
19
28
@@ -49,8 +58,8 @@ Type Aliases
49
58
50
59
Convenience type aliases are provided for common buffer types:
51
60
52
-
- ``cuda::device_buffer<T>`` - Buffer with ``device_accessible`` property
53
-
- ``cuda::host_buffer<T>`` - Buffer with ``host_accessible`` property
61
+
- :cpp:any:`cuda::device_buffer` - Buffer with ``device_accessible`` property
62
+
- :cpp:any:`cuda::host_buffer` - Buffer with ``host_accessible`` property
54
63
55
64
Example:
56
65
@@ -150,13 +159,13 @@ Example:
150
159
// Alternative would be to call buf.destroy(stream2)
Copy file name to clipboardExpand all lines: docs/libcudacxx/runtime/device.rst
+18-15Lines changed: 18 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,27 +3,29 @@
3
3
Devices
4
4
=======
5
5
6
-
``cuda::device_ref``
7
-
---------------------
6
+
:cpp:class:`cuda::device_ref`
7
+
-------------------------------
8
8
.. _cccl-runtime-device-device-ref:
9
9
10
-
``cuda::device_ref`` is a lightweight, non-owning handle to a CUDA device ordinal. It allows to query information about a device and serves as an argument to other runtime APIs which are tied to a specific device.
10
+
:cpp:class:`cuda::device_ref` is a lightweight, non-owning handle to a CUDA device ordinal. It allows to query
11
+
information about a device and serves as an argument to other runtime APIs which are tied to a specific device.
11
12
It offers:
12
13
13
14
- ``get()``: native device ordinal
14
15
- ``name()``: device name
15
16
- ``init()``: initialize the device context
16
17
- ``peers()``: list peers for which peer access can be enabled
17
-
- ``has_peer_access_to(device_ref)``: query if peer access can be enabled to the given device
18
+
- ``has_peer_access_to(cuda::device_ref)``: query if peer access can be enabled to the given device
Per-architecture trait accessors providing limits and capabilities common to all devices of an architecture.
75
-
Compared to ``device_attributes``, ``cuda::arch_traits`` provide a compile-time accessible structure that describes common characteristics of all devices of an architecture, while attributes are run-time queries of a single characteristic of a specific device.
77
+
Compared to ``cuda::device_attributes``, :cpp:any:`cuda::arch_traits` provide a compile-time accessible
78
+
structure that describes common characteristics of all devices of an architecture, while attributes are run-time
79
+
queries of a single characteristic of a specific device.
76
80
77
-
- ``cuda::arch_traits<cuda::arch_id::sm_80>()`` (compile-time) or
Copy file name to clipboardExpand all lines: docs/libcudacxx/runtime/event.rst
+13-10Lines changed: 13 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,17 +5,17 @@ Events
5
5
6
6
Event is a snapshot of execution state of a stream. It can be used to synchronize work submitted to a stream up to a certain point, establish dependency between streams or measure time passed between two events.
``cuda::event_ref`` is a non-owning wrapper around a ``cudaEvent_t``. It prevents unsafe implicit constructions from
12
+
:cpp:class:`cuda::event_ref` is a non-owning wrapper around a ``cudaEvent_t``. It prevents unsafe implicit constructions from
13
13
``nullptr`` or integer literals and provides convenient helpers:
14
14
15
15
- ``record(cuda::stream_ref)``: record the event on a stream
16
16
- ``sync()``: wait for the recorded work to complete
17
17
- ``is_done()``: non-blocking completion query
18
-
- comparison operators against other ``event_ref`` or ``cudaEvent_t``
18
+
- comparison operators against other :cpp:class:`cuda::event_ref` or ``cudaEvent_t``
19
19
20
20
Availability: CCCL 3.1.0 / CUDA 13.1
21
21
@@ -30,13 +30,14 @@ Example:
30
30
e.record(stream);
31
31
}
32
32
33
-
``cuda::event``
33
+
:cpp:class:`cuda::event`
34
34
--------------------------------------------
35
35
.. _cccl-runtime-event-event:
36
36
37
-
``cuda::event`` is an owning wrapper around a ``cudaEvent_t`` (with timing disabled). It inherits from ``event_ref`` and provides all of its functionality.
38
-
It also creates and destroys the native event, can be moved (but not copied), and can release ownership via ``release()``. Construction can target a specific
39
-
``cuda::device_ref`` or record immediately on a ``cuda::stream_ref``.
37
+
:cpp:class:`cuda::event` is an owning wrapper around a ``cudaEvent_t`` (with timing disabled). It inherits from
38
+
:cpp:class:`cuda::event_ref` and provides all of its functionality. It also creates and destroys the native event, can be moved (but
39
+
not copied), and can release ownership via ``release()``. Construction can target a specific :cpp:class:`cuda::device_ref`
40
+
or record immediately on a :cpp:class:`cuda::stream_ref`.
40
41
41
42
Availability: CCCL 3.1.0 / CUDA 13.1
42
43
@@ -56,11 +57,13 @@ Availability: CCCL 3.1.0 / CUDA 13.1
0 commit comments