Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/cutorch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Gross <sgross@fb.com>2016-10-17 18:49:23 +0300
committerSam Gross <sgross@fb.com>2016-10-17 18:49:23 +0300
commitc848e7d07913c7f5981f7fceae85f3bb89b3141b (patch)
tree73b9b22fc8e81291469019455b9889a5adf38336
parent9d35ccb9c3690f6b98acdaaec73b142da47f6665 (diff)
Fix cutorch.getStream()
state->numUserStreams does not include the NULL stream, which is stored in res->streams[i]
-rw-r--r--lib/THC/THCGeneral.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/THC/THCGeneral.c b/lib/THC/THCGeneral.c
index 1d4622b..2d478de 100644
--- a/lib/THC/THCGeneral.c
+++ b/lib/THC/THCGeneral.c
@@ -559,7 +559,7 @@ int THCState_getCurrentStreamIndex(THCState *state)
int device;
THCudaCheck(cudaGetDevice(&device));
THCCudaResourcesPerDevice* res = THCState_getDeviceResourcePtr(state, device);
- for (int i = 0; i < state->numUserStreams; ++i) {
+ for (int i = 0; i <= state->numUserStreams; ++i) {
if (res->streams[i] == stream) {
return i;
}