[arrayfire] 43/84: Check the stream before returning in getStream
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Jan 4 23:22:21 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository arrayfire.
commit bf9d70ae153dc01a4d1031d3355b194ee645839c
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date: Mon Dec 21 15:55:08 2015 -0500
Check the stream before returning in getStream
---
src/backend/cuda/platform.cpp | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/backend/cuda/platform.cpp b/src/backend/cuda/platform.cpp
index 0dcad38..38e8a04 100644
--- a/src/backend/cuda/platform.cpp
+++ b/src/backend/cuda/platform.cpp
@@ -289,7 +289,17 @@ int getDeviceIdFromNativeId(int nativeId)
cudaStream_t getStream(int device)
{
- return DeviceManager::getInstance().streams[device];
+ cudaStream_t str = DeviceManager::getInstance().streams[device];
+ // if the stream has not yet been initialized, ie. the device has not been
+ // set to active at least once (cuz that's where the stream is created)
+ // then set the device, get the stream, reset the device to current
+ if(!str) {
+ int active_dev = DeviceManager::getInstance().activeDev;
+ setDevice(device);
+ str = DeviceManager::getInstance().streams[device];
+ setDevice(active_dev);
+ }
+ return str;
}
int setDevice(int device)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git
More information about the debian-science-commits
mailing list