Skip to content

Commit f65d815

Browse files
authored
Merge pull request #71 from GPUEngineering/feature/streams
Streams
2 parents 436d84e + 8258c61 commit f65d815

File tree

4 files changed

+193
-63
lines changed

4 files changed

+193
-63
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
<!-- ---------------------
9+
v1.9.0
10+
--------------------- -->
11+
## v1.9.0 - 28-03-2025
12+
13+
### Added
14+
15+
- Multiple streams supported
16+
17+
818
<!-- ---------------------
919
v1.8.0
1020
--------------------- -->

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,18 @@ size_t allocatedBytes =
403403
Session::getInstance().totalAllocatedBytes();
404404
```
405405

406-
406+
GPUtils supports multiple streams. By default a single stream is created,
407+
but you can set the number of streams you need with
408+
```c++
409+
/* This needs to be the first line in your code */
410+
Session::setStreams(4); // create 4 strems
411+
```
412+
Then, you can use `setStreamIdx` to select a stream to go with your instance of `DTensor`
413+
```c++
414+
auto a = DTensor<double>::createRandomTensor(3, 6, 4, -1, 1).setStreamIdx(0);
415+
auto b = DTensor<double>::createRandomTensor(3, 6, 4, -1, 1).setStreamIdx(1);
416+
// do stuff...
417+
Session::getInstance().synchronizeAllStreams();
418+
```
407419

408420
## Happy number crunching!

0 commit comments

Comments
 (0)