Ginkgo: ginkgo/core/base/stream.hpp Source File

| Ginkgo Generated from branch based on main. Ginkgo version 1.11.0 A numerical linear algebra library targeting many-core architectures

Loading...
Searching...
No Matches
stream.hpp
1// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef GKO_PUBLIC_CORE_BASE_STREAM_HPP_
6#define GKO_PUBLIC_CORE_BASE_STREAM_HPP_
7
8
9#include <ginkgo/core/base/executor.hpp>
10
11
12namespace gko {
13
14
20 class cuda_stream {
21public:
23 cuda_stream();
24
30 cuda_stream(int device_id);
31
33 ~cuda_stream();
34
35 cuda_stream(const cuda_stream&) = delete;
36
38 cuda_stream(cuda_stream&&);
39
40 cuda_stream& operator=(const cuda_stream&) = delete;
41
43 cuda_stream& operator=(cuda_stream&&) = delete;
44
49 CUstream_st* get() const;
50
51private:
52 CUstream_st* stream_;
53
54 int device_id_;
55};
56
57
63 class hip_stream {
64public:
66 hip_stream();
67
73 hip_stream(int device_id);
74
76 ~hip_stream();
77
78 hip_stream(const hip_stream&) = delete;
79
81 hip_stream(hip_stream&&);
82
83 hip_stream& operator=(const hip_stream&) = delete;
84
86 hip_stream& operator=(hip_stream&&) = delete;
87
92 GKO_HIP_STREAM_STRUCT* get() const;
93
94private:
95 GKO_HIP_STREAM_STRUCT* stream_;
96
97 int device_id_;
98};
99
100
101} // namespace gko
102
103
104#endif // GKO_PUBLIC_CORE_BASE_STREAM_HPP_
gko::cuda_stream::~cuda_stream
~cuda_stream()
Destroys the custom CUDA stream, if it isn't empty.
gko::cuda_stream::cuda_stream
cuda_stream(cuda_stream &&)
Move-constructs from an existing stream, which will be emptied.
gko::cuda_stream::operator=
cuda_stream & operator=(cuda_stream &&)=delete
Move-assigns from an existing stream, which will be emptied.
gko::cuda_stream::get
CUstream_st * get() const
Returns the native CUDA stream handle.
gko::cuda_stream::cuda_stream
cuda_stream()
Creates an empty stream wrapper, representing the default stream.
gko::cuda_stream::cuda_stream
cuda_stream(int device_id)
Creates a new custom CUDA stream on the given device.
gko::hip_stream::hip_stream
hip_stream(hip_stream &&)
Move-constructs from an existing stream, which will be emptied.
gko::hip_stream::operator=
hip_stream & operator=(hip_stream &&)=delete
Move-assigns from an existing stream, which will be emptied.
gko::hip_stream::hip_stream
hip_stream(int device_id)
Creates a new custom HIP stream on the given device.
gko::hip_stream::get
CUstream_st * get() const
Returns the native HIP stream handle.
gko::hip_stream::hip_stream
hip_stream()
Creates an empty stream wrapper, representing the default stream.
gko::hip_stream::~hip_stream
~hip_stream()
Destroys the custom HIP stream, if it isn't empty.
gko
The Ginkgo namespace.
Definition abstract_factory.hpp:20