[arrayfire] 144/248: Optimizations to backends available computation
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Nov 17 15:54:17 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch dfsg-clean
in repository arrayfire.
commit 218d2b1f67ba1e2f9242e9880375e653bf8ef6f1
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date: Wed Oct 21 10:37:11 2015 -0400
Optimizations to backends available computation
---
src/api/unified/symbol_manager.cpp | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/src/api/unified/symbol_manager.cpp b/src/api/unified/symbol_manager.cpp
index fda482e..0f1219b 100644
--- a/src/api/unified/symbol_manager.cpp
+++ b/src/api/unified/symbol_manager.cpp
@@ -133,22 +133,19 @@ AFSymbolManager& AFSymbolManager::getInstance()
AFSymbolManager::AFSymbolManager()
: activeHandle(NULL), defaultHandle(NULL), numBackends(0), backendsAvailable(0)
{
- // In reverse order of priority. The last successful backend loaded will be
- // the most prefered one.
- static const int order[] = {AF_BACKEND_CPU, // 1
- AF_BACKEND_OPENCL, // 4
- AF_BACKEND_CUDA}; // 2
-
- static const int index[] = {-1, 0, 2, -1, 1}; // Nothing at position 0, 3
-
- for(int i = 0; i < NUM_BACKENDS; ++i) {
- int backend = index[order[i]];
+ // In order of priority.
+ static const int order[] = {AF_BACKEND_CUDA, // 1 -> Most Preferred
+ AF_BACKEND_OPENCL, // 4 -> Preferred if CUDA unavailable
+ AF_BACKEND_CPU}; // 2 -> Preferred if CUDA and OpenCL unavailable
+
+ // Decremeting loop. The last successful backend loaded will be the most prefered one.
+ for(int i = NUM_BACKENDS - 1; i >= 0; i--) {
+ int backend = order[i] >> 1; // Convert order[1, 4, 2] -> backend[0, 2, 1]
bkndHandles[backend] = openDynLibrary(backend);
if (bkndHandles[backend]) {
activeHandle = bkndHandles[backend];
numBackends++;
- backendsAvailable += std::pow(2, backend);
- printf("BA %d %d\n", backend, backendsAvailable);
+ backendsAvailable += order[i];
}
}
// Keep a copy of default order handle
--
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