[arrayfire] 01/284: Setup async project; Setup basic queues;
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:12 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 be0ff221c0f3dac94e6c07fcd96e373c3edc7256
Author: Umar Arshad <umar at arrayfire.com>
Date: Sun Aug 9 01:18:10 2015 -0400
Setup async project; Setup basic queues;
---
src/backend/cpu/CMakeLists.txt | 14 ++++++++++++++
src/backend/cpu/copy.cpp | 3 +++
src/backend/cpu/platform.cpp | 11 ++++++++++-
src/backend/cpu/platform.hpp | 4 ++++
4 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/src/backend/cpu/CMakeLists.txt b/src/backend/cpu/CMakeLists.txt
index ab1e0a6..10a749b 100644
--- a/src/backend/cpu/CMakeLists.txt
+++ b/src/backend/cpu/CMakeLists.txt
@@ -47,12 +47,25 @@ IF(NOT UNIX)
ADD_DEFINITIONS(-DAFDLL)
ENDIF()
+INCLUDE(ExternalProject)
+ExternalProject_Add(
+ threads
+ PREFIX ${CMAKE_BINARY_DIR}/third_party/threads
+ GIT_REPOSITORY https://github.com/alltheflops/threads.git
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
+ <SOURCE_DIR>/threads ${CMAKE_BINARY_DIR}/third_party/threads
+ LOG_DOWNLOAD ON
+ LOG_INSTALL ON
+ )
INCLUDE_DIRECTORIES(
${CMAKE_INCLUDE_PATH}
"${CMAKE_SOURCE_DIR}/src/backend/cpu"
${FFTW_INCLUDES}
${CBLAS_INCLUDE_DIR}
${LAPACK_INCLUDE_DIR}
+ ${CMAKE_BINARY_DIR}/third_party/threads/src/threads
)
FILE(GLOB cpu_headers
@@ -148,6 +161,7 @@ TARGET_LINK_LIBRARIES(afcpu
PRIVATE ${CBLAS_LIBRARIES}
PRIVATE ${FFTW_LIBRARIES})
+ADD_DEPENDENCIES(afcpu threads)
IF(FORGE_FOUND AND NOT USE_SYSTEM_FORGE)
ADD_DEPENDENCIES(afcpu forge)
ENDIF()
diff --git a/src/backend/cpu/copy.cpp b/src/backend/cpu/copy.cpp
index a2bb4ff..35c1ebe 100644
--- a/src/backend/cpu/copy.cpp
+++ b/src/backend/cpu/copy.cpp
@@ -18,6 +18,8 @@
#include <cassert>
#include <err_cpu.hpp>
#include <math.hpp>
+#include <platform.hpp>
+#include <async_queue.hpp>
namespace cpu
{
@@ -46,6 +48,7 @@ namespace cpu
template<typename T>
void copyData(T *to, const Array<T> &from)
{
+ getQueue().sync();
if(from.isOwner()) {
// FIXME: Check for errors / exceptions
memcpy(to, from.get(), from.elements()*sizeof(T));
diff --git a/src/backend/cpu/platform.cpp b/src/backend/cpu/platform.cpp
index d6b4724..73bd587 100644
--- a/src/backend/cpu/platform.cpp
+++ b/src/backend/cpu/platform.cpp
@@ -10,6 +10,8 @@
#include <af/version.h>
#include <platform.hpp>
#include <sstream>
+#include <async_queue.hpp>
+#include <array>
namespace cpu
{
@@ -75,9 +77,16 @@ int getActiveDeviceId()
return 0;
}
+static const int MAX_QUEUES = 1;
+
+async_queue& getQueue(int idx) {
+ static std::array<async_queue, MAX_QUEUES> queues;
+ return queues[idx];
+}
+
void sync(int device)
{
- // Nothing here
+ getQueue().sync();
}
}
diff --git a/src/backend/cpu/platform.hpp b/src/backend/cpu/platform.hpp
index e899837..2bf6bf2 100644
--- a/src/backend/cpu/platform.hpp
+++ b/src/backend/cpu/platform.hpp
@@ -9,6 +9,8 @@
#include <string>
+class async_queue;
+
namespace cpu {
std::string getInfo();
@@ -23,4 +25,6 @@ namespace cpu {
int getActiveDeviceId();
void sync(int device);
+
+ async_queue& getQueue(int idx = 0);
}
--
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