Skip to content

Commit 6929a08

Browse files
committed
docs for streams
1 parent 901ba14 commit 6929a08

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,15 @@ 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(2);
415+
```
407416

408417
## Happy number crunching!

include/tensor.cuh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ inline void gpuAssert(T code, const char *file, int line, bool abort = true) {
116116
/* ================================================================================================
117117
* SESSION
118118
* ================================================================================================ */
119+
/**
120+
* Total number of allocated streams
121+
* Can be changed with Session::setStreams()
122+
*/
119123
static size_t s_numStreams = 1;
120124

121125
/**

0 commit comments

Comments
 (0)