mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
bug #1119: Adjust call to ?gssvx for SuperLU 5
Also improved corresponding cmake module to detect versions 5.x Based on patch by Christoph Grüninger.
This commit is contained in:
parent
57113e00f9
commit
3c795c6923
@ -43,7 +43,7 @@ namespace Eigen { struct SluMatrix; }
|
|||||||
* - class SuperLU: a supernodal sequential LU factorization.
|
* - class SuperLU: a supernodal sequential LU factorization.
|
||||||
* - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods).
|
* - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods).
|
||||||
*
|
*
|
||||||
* \warning This wrapper is only for the 4.x versions of SuperLU. The 3.x and 5.x versions are not supported.
|
* \warning This wrapper requires at least versions 4.0 of SuperLU. The 3.x versions are not supported.
|
||||||
*
|
*
|
||||||
* \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting.
|
* \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting.
|
||||||
*
|
*
|
||||||
|
@ -10,15 +10,16 @@
|
|||||||
#ifndef EIGEN_SUPERLUSUPPORT_H
|
#ifndef EIGEN_SUPERLUSUPPORT_H
|
||||||
#define EIGEN_SUPERLUSUPPORT_H
|
#define EIGEN_SUPERLUSUPPORT_H
|
||||||
|
|
||||||
namespace Eigen {
|
namespace Eigen {
|
||||||
|
|
||||||
|
#if defined(SUPERLU_MAJOR_VERSION) && (SUPERLU_MAJOR_VERSION >= 5)
|
||||||
#define DECL_GSSVX(PREFIX,FLOATTYPE,KEYTYPE) \
|
#define DECL_GSSVX(PREFIX,FLOATTYPE,KEYTYPE) \
|
||||||
extern "C" { \
|
extern "C" { \
|
||||||
extern void PREFIX##gssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, \
|
extern void PREFIX##gssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, \
|
||||||
char *, FLOATTYPE *, FLOATTYPE *, SuperMatrix *, SuperMatrix *, \
|
char *, FLOATTYPE *, FLOATTYPE *, SuperMatrix *, SuperMatrix *, \
|
||||||
void *, int, SuperMatrix *, SuperMatrix *, \
|
void *, int, SuperMatrix *, SuperMatrix *, \
|
||||||
FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, \
|
FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, \
|
||||||
mem_usage_t *, SuperLUStat_t *, int *); \
|
GlobalLU_t *, mem_usage_t *, SuperLUStat_t *, int *); \
|
||||||
} \
|
} \
|
||||||
inline float SuperLU_gssvx(superlu_options_t *options, SuperMatrix *A, \
|
inline float SuperLU_gssvx(superlu_options_t *options, SuperMatrix *A, \
|
||||||
int *perm_c, int *perm_r, int *etree, char *equed, \
|
int *perm_c, int *perm_r, int *etree, char *equed, \
|
||||||
@ -28,12 +29,37 @@ namespace Eigen {
|
|||||||
FLOATTYPE *recip_pivot_growth, \
|
FLOATTYPE *recip_pivot_growth, \
|
||||||
FLOATTYPE *rcond, FLOATTYPE *ferr, FLOATTYPE *berr, \
|
FLOATTYPE *rcond, FLOATTYPE *ferr, FLOATTYPE *berr, \
|
||||||
SuperLUStat_t *stats, int *info, KEYTYPE) { \
|
SuperLUStat_t *stats, int *info, KEYTYPE) { \
|
||||||
mem_usage_t mem_usage; \
|
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 *, \
|
||||||
|
char *, FLOATTYPE *, FLOATTYPE *, SuperMatrix *, SuperMatrix *, \
|
||||||
|
void *, int, SuperMatrix *, SuperMatrix *, \
|
||||||
|
FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, \
|
||||||
|
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; \
|
||||||
PREFIX##gssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, \
|
PREFIX##gssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, \
|
||||||
U, work, lwork, B, X, recip_pivot_growth, rcond, \
|
U, work, lwork, B, X, recip_pivot_growth, rcond, \
|
||||||
ferr, berr, &mem_usage, stats, info); \
|
ferr, berr, &mem_usage, stats, info); \
|
||||||
return mem_usage.for_lu; /* bytes used by the factor storage */ \
|
return mem_usage.for_lu; /* bytes used by the factor storage */ \
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
DECL_GSSVX(s,float,float)
|
DECL_GSSVX(s,float,float)
|
||||||
DECL_GSSVX(c,float,std::complex<float>)
|
DECL_GSSVX(c,float,std::complex<float>)
|
||||||
|
@ -17,7 +17,10 @@ find_path(SUPERLU_INCLUDES
|
|||||||
SRC
|
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)
|
if(SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
|
||||||
|
|
||||||
@ -48,11 +51,25 @@ int main() {
|
|||||||
}"
|
}"
|
||||||
SUPERLU_HAS_CLEAN_ENUMS)
|
SUPERLU_HAS_CLEAN_ENUMS)
|
||||||
|
|
||||||
if(SUPERLU_HAS_CLEAN_ENUMS)
|
check_cxx_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
|
# at least 4.3
|
||||||
set(SUPERLU_VERSION_VAR "4.3")
|
set(SUPERLU_VERSION_VAR "4.3")
|
||||||
elseif(SUPERLU_HAS_GLOBAL_MEM_USAGE_T)
|
elseif(SUPERLU_HAS_GLOBAL_MEM_USAGE_T)
|
||||||
# at least 4.3
|
# at least 4.0
|
||||||
set(SUPERLU_VERSION_VAR "4.0")
|
set(SUPERLU_VERSION_VAR "4.0")
|
||||||
else()
|
else()
|
||||||
set(SUPERLU_VERSION_VAR "3.0")
|
set(SUPERLU_VERSION_VAR "3.0")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user