[arrayfire] 132/284: FEAT Added isLAPACKAvailable function to check support

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:26 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 1b85d6d1acf795193080593e970888a01f6d0e85
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Thu Dec 31 12:12:09 2015 -0500

    FEAT Added isLAPACKAvailable function to check support
---
 docs/details/lapack.dox    |  8 ++++++++
 include/af/lapack.h        | 25 +++++++++++++++++++++++++
 include/arrayfire.h        |  2 ++
 src/api/c/lu.cpp           | 10 ++++++++++
 src/api/cpp/lapack.cpp     |  7 +++++++
 src/api/unified/lapack.cpp |  5 +++++
 src/backend/cpu/lu.cpp     |  5 +++++
 src/backend/cpu/lu.hpp     |  2 ++
 src/backend/cuda/lu.cu     | 15 +++++++++++++++
 src/backend/cuda/lu.hpp    |  2 ++
 src/backend/opencl/lu.cpp  | 10 ++++++++++
 src/backend/opencl/lu.hpp  |  2 ++
 12 files changed, 93 insertions(+)

diff --git a/docs/details/lapack.dox b/docs/details/lapack.dox
index c0d8aae..522dbe5 100644
--- a/docs/details/lapack.dox
+++ b/docs/details/lapack.dox
@@ -287,5 +287,13 @@ This function can return the norm using various metrics based on the type paramt
 
 ===============================================================================
 
+\defgroup lapack_helper_func_available isLAPACKAvailable
+
+\ingroup lapack_helper
+
+\brief Returns true is ArrayFire is compiled with LAPACK support
+
+===============================================================================
+
 @}
 */
diff --git a/include/af/lapack.h b/include/af/lapack.h
index f1cf87a..bb54069 100644
--- a/include/af/lapack.h
+++ b/include/af/lapack.h
@@ -237,6 +237,18 @@ namespace af
     */
     AFAPI double norm(const array &in, const normType type=AF_NORM_EUCLID,
                       const double p=1, const double q=1);
+
+#if AF_API_VERSION >= 33
+    /**
+       Returns true is ArrayFire is compiled with LAPACK support
+
+       \returns true is LAPACK support is available, false otherwise
+
+       \ingroup lapack_ops_func_norm
+    */
+    AFAPI bool isLAPACKAvailable();
+#endif
+
 }
 #endif
 
@@ -425,6 +437,19 @@ extern "C" {
     */
     AFAPI af_err af_norm(double *out, const af_array in, const af_norm_type type, const double p, const double q);
 
+#if AF_API_VERSION >= 33
+    /**
+       Returns true is ArrayFire is compiled with LAPACK support
+
+       \param[out] out is true if LAPACK support is available, false otherwise
+
+       \returns AF_SUCCESS if successful (does not depend on the value of out)
+
+       \ingroup lapack_ops_func_norm
+    */
+    AFAPI af_err af_is_lapack_available(bool *out);
+#endif
+
 
 #ifdef __cplusplus
 }
diff --git a/include/arrayfire.h b/include/arrayfire.h
index 7d9e75a..73b417b 100644
--- a/include/arrayfire.h
+++ b/include/arrayfire.h
@@ -113,6 +113,8 @@
 
      @defgroup lapack_ops_mat Matrix operations
      inverse, det, rank, norm etc.
+
+     @defgroup lapack_helper LAPACK Helper functions
    @}
 
    @defgroup image_mat Image Processing
diff --git a/src/api/c/lu.cpp b/src/api/c/lu.cpp
index c6004bc..1d98e02 100644
--- a/src/api/c/lu.cpp
+++ b/src/api/c/lu.cpp
@@ -95,3 +95,13 @@ af_err af_lu_inplace(af_array *pivot, af_array in, const bool is_lapack_piv)
 
     return AF_SUCCESS;
 }
+
+af_err af_is_lapack_available(bool *out)
+{
+    try {
+        *out = isLAPACKAvailable();
+    }
+    CATCHALL;
+
+    return AF_SUCCESS;
+}
diff --git a/src/api/cpp/lapack.cpp b/src/api/cpp/lapack.cpp
index cf9b3ec..091c807 100644
--- a/src/api/cpp/lapack.cpp
+++ b/src/api/cpp/lapack.cpp
@@ -153,4 +153,11 @@ namespace af
         AF_THROW(af_norm(&out, in.get(), type, p, q));
         return out;
     }
+
+    bool isLAPACKAvailable()
+    {
+        bool out = false;
+        AF_THROW(af_is_lapack_available(&out));
+        return out;
+    }
 }
diff --git a/src/api/unified/lapack.cpp b/src/api/unified/lapack.cpp
index b2364ac..8a36701 100644
--- a/src/api/unified/lapack.cpp
+++ b/src/api/unified/lapack.cpp
@@ -96,3 +96,8 @@ af_err af_norm(double *out, const af_array in, const af_norm_type type, const do
     CHECK_ARRAYS(in);
     return CALL(out, in, type, p, q);
 }
+
+af_err af_is_lapack_available(bool *out)
+{
+    return CALL(out);
+}
diff --git a/src/backend/cpu/lu.cpp b/src/backend/cpu/lu.cpp
index 93862f2..f8fc92d 100644
--- a/src/backend/cpu/lu.cpp
+++ b/src/backend/cpu/lu.cpp
@@ -85,6 +85,11 @@ Array<int> lu_inplace(Array<T> &in, const bool convert_pivot)
     }
 }
 
+bool isLAPACKAvailable()
+{
+    return true;
+}
+
 }
 
 #else
diff --git a/src/backend/cpu/lu.hpp b/src/backend/cpu/lu.hpp
index c25dcaa..3fef461 100644
--- a/src/backend/cpu/lu.hpp
+++ b/src/backend/cpu/lu.hpp
@@ -17,4 +17,6 @@ namespace cpu
 
     template<typename T>
     Array<int> lu_inplace(Array<T> &in, const bool convert_pivot = true);
+
+    bool isLAPACKAvailable();
 }
diff --git a/src/backend/cuda/lu.cu b/src/backend/cuda/lu.cu
index 2a45d4b..ce0b545 100644
--- a/src/backend/cuda/lu.cu
+++ b/src/backend/cuda/lu.cu
@@ -156,6 +156,11 @@ Array<int> lu_inplace(Array<T> &in, const bool convert_pivot)
     return pivot;
 }
 
+bool isLAPACKAvailable()
+{
+    return true;
+}
+
 #define INSTANTIATE_LU(T)                                                                           \
     template Array<int> lu_inplace<T>(Array<T> &in, const bool convert_pivot);                      \
     template void lu<T>(Array<T> &lower, Array<T> &upper, Array<int> &pivot, const Array<T> &in);
@@ -186,6 +191,11 @@ Array<int> lu_inplace(Array<T> &in, const bool convert_pivot)
     return cpu::lu_inplace(in, convert_pivot);
 }
 
+bool isLAPACKAvailable()
+{
+    return true;
+}
+
 #define INSTANTIATE_LU(T)                                                                           \
     template Array<int> lu_inplace<T>(Array<T> &in, const bool convert_pivot);                      \
     template void lu<T>(Array<T> &lower, Array<T> &upper, Array<int> &pivot, const Array<T> &in);
@@ -213,6 +223,11 @@ Array<int> lu_inplace(Array<T> &in, const bool convert_pivot)
              AF_ERR_NOT_CONFIGURED);
 }
 
+bool isLAPACKAvailable()
+{
+    return false;
+}
+
 #define INSTANTIATE_LU(T)                                                                           \
     template Array<int> lu_inplace<T>(Array<T> &in, const bool convert_pivot);                      \
     template void lu<T>(Array<T> &lower, Array<T> &upper, Array<int> &pivot, const Array<T> &in);
diff --git a/src/backend/cuda/lu.hpp b/src/backend/cuda/lu.hpp
index 0753129..acf9dba 100644
--- a/src/backend/cuda/lu.hpp
+++ b/src/backend/cuda/lu.hpp
@@ -17,4 +17,6 @@ namespace cuda
 
     template<typename T>
     Array<int> lu_inplace(Array<T> &in, const bool convert_pivot = true);
+
+    bool isLAPACKAvailable();
 }
diff --git a/src/backend/opencl/lu.cpp b/src/backend/opencl/lu.cpp
index ee76f47..2d94d4d 100644
--- a/src/backend/opencl/lu.cpp
+++ b/src/backend/opencl/lu.cpp
@@ -88,6 +88,11 @@ Array<int> lu_inplace(Array<T> &in, const bool convert_pivot)
     }
 }
 
+bool isLAPACKAvailable()
+{
+    return true;
+}
+
 #define INSTANTIATE_LU(T)                                                                           \
     template Array<int> lu_inplace<T>(Array<T> &in, const bool convert_pivot);                      \
     template void lu<T>(Array<T> &lower, Array<T> &upper, Array<int> &pivot, const Array<T> &in);
@@ -116,6 +121,11 @@ Array<int> lu_inplace(Array<T> &in, const bool convert_pivot)
     AF_ERROR("Linear Algebra is disabled on OpenCL", AF_ERR_NOT_CONFIGURED);
 }
 
+bool isLAPACKAvailable()
+{
+    return false;
+}
+
 #define INSTANTIATE_LU(T)                                                                           \
     template Array<int> lu_inplace<T>(Array<T> &in, const bool convert_pivot);                      \
     template void lu<T>(Array<T> &lower, Array<T> &upper, Array<int> &pivot, const Array<T> &in);
diff --git a/src/backend/opencl/lu.hpp b/src/backend/opencl/lu.hpp
index af43f24..b44eca8 100644
--- a/src/backend/opencl/lu.hpp
+++ b/src/backend/opencl/lu.hpp
@@ -17,4 +17,6 @@ namespace opencl
 
     template<typename T>
     Array<int> lu_inplace(Array<T> &in, const bool convert_pivot = true);
+
+    bool isLAPACKAvailable();
 }

-- 
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