[eigen] [patch] Add support for SuperLU 5

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Dear Eigen devs,
please find attached a patchset to add support for SuperLU. This is
meant to fix bug 1119.
I haven't figured out how testing works within Eigen, so it is possible
that the patch does not work. What should I do test my changes or where
can I read about it?

Bye
Christoph
# HG changeset patch
# User Christoph Grüninger <foss@xxxxxxxxxxxxx>
# Date 1466355332 -7200
#      Sun Jun 19 18:55:32 2016 +0200
# Node ID a630579c7bb180ed47ab980917c949f44383f37e
# Parent  9a13728899fe76905151e0bdc1d3bb3c27acc395
Adjust call to ?gssvx for SuperLU 5

diff -r 9a13728899fe -r a630579c7bb1 Eigen/src/SuperLUSupport/SuperLUSupport.h
--- a/Eigen/src/SuperLUSupport/SuperLUSupport.h	Sun Jun 19 18:54:31 2016 +0200
+++ b/Eigen/src/SuperLUSupport/SuperLUSupport.h	Sun Jun 19 18:55:32 2016 +0200
@@ -10,8 +10,33 @@
 #ifndef EIGEN_SUPERLUSUPPORT_H
 #define EIGEN_SUPERLUSUPPORT_H
 
-namespace Eigen { 
+namespace Eigen {
 
+#if SUPERLU_VERSION_VAR >= 5.0
+#define DECL_GSSVX(PREFIX,FLOATTYPE,KEYTYPE)		\
+    extern "C" {                                                                                          \
+      extern void PREFIX##gssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,                  \
+                                char *, FLOATTYPE *, FLOATTYPE *, SuperMatrix *, SuperMatrix *,           \
+                                void *, int, SuperMatrix *, SuperMatrix *,                                \
+                                FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, FLOATTYPE *,                       \
+                                GlobalLU_t *, mem_usage_t *, SuperLUStat_t *, int *);                     \
+    }                                                                                                     \
+    inline float SuperLU_gssvx(superlu_options_t *options, SuperMatrix *A,                                \
+         int *perm_c, int *perm_r, int *etree, char *equed,                                               \
+         FLOATTYPE *R, FLOATTYPE *C, SuperMatrix *L,                                                      \
+         SuperMatrix *U, void *work, int lwork,                                                           \
+         SuperMatrix *B, SuperMatrix *X,                                                                  \
+         FLOATTYPE *recip_pivot_growth,                                                                   \
+         FLOATTYPE *rcond, FLOATTYPE *ferr, FLOATTYPE *berr,                                              \
+         SuperLUStat_t *stats, int *info, KEYTYPE) {                                                      \
+    mem_usage_t mem_usage;                                                                        \
+    GlobalLU_t gLU;                                                                                       \
+    PREFIX##gssvx(options, A, perm_c, perm_r, etree, equed, R, C, L,                                      \
+         U, work, lwork, B, X, recip_pivot_growth, rcond,                                                 \
+         ferr, berr, &gLU, &mem_usage, stats, info);                                                      \
+    return mem_usage.for_lu; /* bytes used by the factor storage */                                       \
+  }
+#else // version < 5.0
 #define DECL_GSSVX(PREFIX,FLOATTYPE,KEYTYPE)		\
     extern "C" {                                                                                          \
       extern void PREFIX##gssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,                  \
@@ -34,6 +59,7 @@
          ferr, berr, &mem_usage, stats, info);                                                            \
     return mem_usage.for_lu; /* bytes used by the factor storage */                                       \
   }
+#endif
 
 DECL_GSSVX(s,float,float)
 DECL_GSSVX(c,float,std::complex<float>)
# HG changeset patch
# User Christoph Grüninger <foss@xxxxxxxxxxxxx>
# Date 1466355271 -7200
#      Sun Jun 19 18:54:31 2016 +0200
# Node ID 9a13728899fe76905151e0bdc1d3bb3c27acc395
# Parent  206929dc586cdec58cbd59274448c3f7d721e220
Find SuperLU 5 with CMake

diff -r 206929dc586c -r 9a13728899fe cmake/FindSuperLU.cmake
--- a/cmake/FindSuperLU.cmake	Thu Jun 16 11:37:40 2016 -0700
+++ b/cmake/FindSuperLU.cmake	Sun Jun 19 18:54:31 2016 +0200
@@ -17,7 +17,10 @@
   SRC
 )
 
-find_library(SUPERLU_LIBRARIES NAMES "superlu_4.3" "superlu_4.2" "superlu_4.1" "superlu_4.0" "superlu_3.1" "superlu_3.0" "superlu" PATHS $ENV{SUPERLUDIR} ${LIB_INSTALL_DIR} PATH_SUFFIXES lib)
+find_library(SUPERLU_LIBRARIES
+  NAMES "superlu_5.2.1" "superlu_5.2" "superlu_5.1.1" "superlu_5.1" "superlu_5.0" "superlu_4.3" "superlu_4.2" "superlu_4.1" "superlu_4.0" "superlu_3.1" "superlu_3.0" "superlu"
+  PATHS $ENV{SUPERLUDIR} ${LIB_INSTALL_DIR}
+  PATH_SUFFIXES lib)
 
 if(SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
 
@@ -48,11 +51,25 @@
 }"
 SUPERLU_HAS_CLEAN_ENUMS)
 
-if(SUPERLU_HAS_CLEAN_ENUMS)
+check_c_source_compiles("
+typedef int int_t;
+#include <supermatrix.h>
+#include <slu_util.h>
+int main(void)
+{
+  GlobalLU_t glu;
+  return 0;
+}"
+SUPERLU_HAS_GLOBALLU_T)
+
+if(SUPERLU_HAS_GLOBALLU_T)
+  # at least 5.0
+  set(SUPERLU_VERSION_VAR "5.0")
+elseif(SUPERLU_HAS_CLEAN_ENUMS)
   # at least 4.3
   set(SUPERLU_VERSION_VAR "4.3")
 elseif(SUPERLU_HAS_GLOBAL_MEM_USAGE_T)
-  # at least 4.3
+  # at least 4.0
   set(SUPERLU_VERSION_VAR "4.0")
 else()
   set(SUPERLU_VERSION_VAR "3.0")


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/