[arrayfire] 67/284: Fix in Array::device method
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:20 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/experimental
in repository arrayfire.
commit 2217014ba231b8e7ceed9ed3072d2104e3ffb243
Author: pradeep <pradeep at arrayfire.com>
Date: Fri Dec 11 14:59:57 2015 -0500
Fix in Array::device method
When lambda functions are enqueued in cpu backend, the pointer that
is shared by Array objects has > 1 reference count making it seem
like it is referenced Array inside ::device member function. This is
now fixed by syncing the operations before fetching the device pointer.
---
src/api/c/assign.cpp | 2 +-
src/backend/cpu/Array.hpp | 3 +++
src/backend/cpu/platform.hpp | 2 ++
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/api/c/assign.cpp b/src/api/c/assign.cpp
index 13fa179..b8fcb12 100644
--- a/src/api/c/assign.cpp
+++ b/src/api/c/assign.cpp
@@ -39,7 +39,7 @@ void assign(Array<Tout> &out, const unsigned &ndims, const af_seq *index, const
DIM_ASSERT(0, (outDs.ndims()>=iDims.ndims()));
DIM_ASSERT(0, (outDs.ndims()>=(dim_t)ndims));
- evalArray(out);
+ out.eval();
vector<af_seq> index_(index, index+ndims);
diff --git a/src/backend/cpu/Array.hpp b/src/backend/cpu/Array.hpp
index 471a674..2b9cbb4 100644
--- a/src/backend/cpu/Array.hpp
+++ b/src/backend/cpu/Array.hpp
@@ -20,6 +20,8 @@
#include <memory>
#include <algorithm>
#include <vector>
+#include <platform.hpp>
+#include <async_queue.hpp>
namespace cpu
{
@@ -162,6 +164,7 @@ namespace cpu
T* device()
{
+ getQueue().sync();
if (!isOwner() || data.use_count() > 1) {
*this = Array<T>(dims(), get(), true, true);
}
diff --git a/src/backend/cpu/platform.hpp b/src/backend/cpu/platform.hpp
index 9abf075..1057552 100644
--- a/src/backend/cpu/platform.hpp
+++ b/src/backend/cpu/platform.hpp
@@ -7,6 +7,8 @@
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
+#pragma once
+
#include <string>
class async_queue;
--
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