Ginkgo Generated from branch based on master. Ginkgo version 1.8.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
21public:
24
30 cuda_stream(int device_id);
31
34
35 cuda_stream(const cuda_stream&) = delete;
36
39
40 cuda_stream& operator=(const cuda_stream&) = delete;
41
44
49 CUstream_st* get() const;
50
51private:
52 CUstream_st* stream_;
53
54 int device_id_;
55};
56
57
64public:
67
73 hip_stream(int device_id);
74
77
78 hip_stream(const hip_stream&) = delete;
79
82
83 hip_stream& operator=(const hip_stream&) = delete;
84
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_
An RAII wrapper for a custom CUDA stream.
Definition stream.hpp:20
~cuda_stream()
Destroys the custom CUDA stream, if it isn't empty.
cuda_stream(cuda_stream &&)
Move-constructs from an existing stream, which will be emptied.
cuda_stream & operator=(cuda_stream &&)=delete
Move-assigns from an existing stream, which will be emptied.
CUstream_st * get() const
Returns the native CUDA stream handle.
cuda_stream()
Creates an empty stream wrapper, representing the default stream.
cuda_stream(int device_id)
Creates a new custom CUDA stream on the given device.
An RAII wrapper for a custom HIP stream.
Definition stream.hpp:63
hip_stream(hip_stream &&)
Move-constructs from an existing stream, which will be emptied.
hip_stream & operator=(hip_stream &&)=delete
Move-assigns from an existing stream, which will be emptied.
hip_stream(int device_id)
Creates a new custom HIP stream on the given device.
CUstream_st * get() const
Returns the native HIP stream handle.
hip_stream()
Creates an empty stream wrapper, representing the default stream.
~hip_stream()
Destroys the custom HIP stream, if it isn't empty.
The Ginkgo namespace.
Definition abstract_factory.hpp:20