From a6267d8e67334d0a70d33f1da55fe73992e8a042 Mon Sep 17 00:00:00 2001 From: sfilippone Date: Fri, 19 Dec 2025 12:49:45 +0100 Subject: [PATCH] Update configure and interfaces for SUPERLU version 7. --- amgprec/impl/amg_cslu_interface.c | 10 ++++++- amgprec/impl/amg_dslu_interface.c | 2 +- amgprec/impl/amg_sslu_interface.c | 2 +- amgprec/impl/amg_zslu_interface.c | 2 +- config/pac.m4 | 31 +++++++++++++++---- configure | 50 +++++++++++++++++++++++++++---- 6 files changed, 82 insertions(+), 15 deletions(-) diff --git a/amgprec/impl/amg_cslu_interface.c b/amgprec/impl/amg_cslu_interface.c index 3195be79..41e114e4 100644 --- a/amgprec/impl/amg_cslu_interface.c +++ b/amgprec/impl/amg_cslu_interface.c @@ -112,7 +112,11 @@ typedef struct { int amg_cslu_fact(int n, int nnz, #ifdef AMG_HAVE_SLU +#if defined(AMG_SLU_VERSION_7) + singlecomplex *values, +#else complex *values, +#endif #else void *values, #endif @@ -177,7 +181,7 @@ int amg_cslu_fact(int n, int nnz, panel_size = sp_ienv(1); relax = sp_ienv(2); -#if defined(AMG_SLU_VERSION_5) +#if defined(AMG_SLU_VERSION_7) ||defined(AMG_SLU_VERSION_5) cgstrf(&options, &AC, relax, panel_size, etree, NULL, 0, perm_c, perm_r, L, U, &Glu, &stat, &info); #elif defined(AMG_SLU_VERSION_4) @@ -230,7 +234,11 @@ int amg_cslu_fact(int n, int nnz, int amg_cslu_solve(int itrans, int n, int nrhs, #ifdef AMG_HAVE_SLU +#if defined(AMG_SLU_VERSION_7) + singlecomplex *b, +#else complex *b, +#endif #else void *b, #endif diff --git a/amgprec/impl/amg_dslu_interface.c b/amgprec/impl/amg_dslu_interface.c index f2c2718f..829f3473 100644 --- a/amgprec/impl/amg_dslu_interface.c +++ b/amgprec/impl/amg_dslu_interface.c @@ -171,7 +171,7 @@ int amg_dslu_fact(int n, int nnz, double *values, panel_size = sp_ienv(1); relax = sp_ienv(2); -#if defined(AMG_SLU_VERSION_5) +#if defined(AMG_SLU_VERSION_7) ||defined(AMG_SLU_VERSION_5) dgstrf(&options, &AC, relax, panel_size, etree, NULL, 0, perm_c, perm_r, L, U, &Glu, &stat, &info); #elif defined(AMG_SLU_VERSION_4) diff --git a/amgprec/impl/amg_sslu_interface.c b/amgprec/impl/amg_sslu_interface.c index 5c4c271c..cb020909 100644 --- a/amgprec/impl/amg_sslu_interface.c +++ b/amgprec/impl/amg_sslu_interface.c @@ -172,7 +172,7 @@ int amg_sslu_fact(int n, int nnz, float *values, panel_size = sp_ienv(1); relax = sp_ienv(2); -#if defined(AMG_SLU_VERSION_5) +#if defined(AMG_SLU_VERSION_7) ||defined(AMG_SLU_VERSION_5) sgstrf(&options, &AC, relax, panel_size, etree, NULL, 0, perm_c, perm_r, L, U, &Glu, &stat, &info); #elif defined(AMG_SLU_VERSION_4) diff --git a/amgprec/impl/amg_zslu_interface.c b/amgprec/impl/amg_zslu_interface.c index 1cbf6308..63795a52 100644 --- a/amgprec/impl/amg_zslu_interface.c +++ b/amgprec/impl/amg_zslu_interface.c @@ -176,7 +176,7 @@ int amg_zslu_fact(int n, int nnz, panel_size = sp_ienv(1); relax = sp_ienv(2); -#if defined(AMG_SLU_VERSION_5) +#if defined(AMG_SLU_VERSION_7) ||defined(AMG_SLU_VERSION_5) zgstrf(&options, &AC, relax, panel_size, etree, NULL, 0, perm_c, perm_r, L, U, &Glu, &stat, &info); #elif defined(AMG_SLU_VERSION_4) diff --git a/config/pac.m4 b/config/pac.m4 index 180e3817..9ecbbd72 100644 --- a/config/pac.m4 +++ b/config/pac.m4 @@ -749,21 +749,40 @@ if test "x$pac_slu_header_ok" == "xyes" ; then AC_MSG_RESULT($pac_slu_lib_ok) fi if test "x$pac_slu_header_ok" == "xyes" ; then - AC_MSG_CHECKING([for superlu version 5]) + AC_MSG_CHECKING([for superlu version 7]) AC_LANG_PUSH([C]) AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([[#include "slu_ddefs.h" - int testdslu() + [AC_LANG_SOURCE([[#include "slu_cdefs.h" + int testcslu() { SuperMatrix AC, *L, *U; int *perm_r, *perm_c, *etree, panel_size, permc_spec, relax, info; superlu_options_t options; SuperLUStat_t stat; + singlecomplex *x; GlobalLU_t Glu; - dgstrf(&options, &AC, relax, panel_size, etree, + cgstrf(&options, &AC, relax, panel_size, etree, NULL, 0, perm_c, perm_r, L, U, &Glu, &stat, &info); }]])], - [ AC_MSG_RESULT([yes]); pac_slu_version="5";], - [ AC_MSG_RESULT([no]); pac_slu_version="4";]) + [ AC_MSG_RESULT([yes]); pac_slu_version="7";], + [ AC_MSG_RESULT([no]); pac_slu_version="";]) + if test "x$pac_slu_version" == "x" ; then + AC_MSG_CHECKING([for superlu version 5]) + AC_LANG_PUSH([C]) + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([[#include "slu_ddefs.h" + int testdslu() + { SuperMatrix AC, *L, *U; + int *perm_r, *perm_c, *etree, panel_size, permc_spec, relax, info; + superlu_options_t options; SuperLUStat_t stat; + GlobalLU_t Glu; + dgstrf(&options, &AC, relax, panel_size, etree, + NULL, 0, perm_c, perm_r, L, U, &Glu, &stat, &info); + + }]])], + [ AC_MSG_RESULT([yes]); pac_slu_version="5";], + [ AC_MSG_RESULT([no]); pac_slu_version="4";]) + AC_LANG_POP([C]) + fi AC_LANG_POP([C]) fi diff --git a/configure b/configure index d63ea66c..85dde08a 100755 --- a/configure +++ b/configure @@ -10891,8 +10891,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ printf "%s\n" "$pac_slu_lib_ok" >&6; } fi if test "x$pac_slu_header_ok" == "xyes" ; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for superlu version 5" >&5 -printf %s "checking for superlu version 5... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for superlu version 7" >&5 +printf %s "checking for superlu version 7... " >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -10901,18 +10901,51 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include "slu_ddefs.h" - int testdslu() +#include "slu_cdefs.h" + int testcslu() { SuperMatrix AC, *L, *U; int *perm_r, *perm_c, *etree, panel_size, permc_spec, relax, info; superlu_options_t options; SuperLUStat_t stat; + singlecomplex *x; GlobalLU_t Glu; - dgstrf(&options, &AC, relax, panel_size, etree, + cgstrf(&options, &AC, relax, panel_size, etree, NULL, 0, perm_c, perm_r, L, U, &Glu, &stat, &info); } _ACEOF if ac_fn_c_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; }; pac_slu_version="7"; +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; }; pac_slu_version=""; ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if test "x$pac_slu_version" == "x" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for superlu version 5" >&5 +printf %s "checking for superlu version 5... " >&6; } + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include "slu_ddefs.h" + int testdslu() + { SuperMatrix AC, *L, *U; + int *perm_r, *perm_c, *etree, panel_size, permc_spec, relax, info; + superlu_options_t options; SuperLUStat_t stat; + GlobalLU_t Glu; + dgstrf(&options, &AC, relax, panel_size, etree, + NULL, 0, perm_c, perm_r, L, U, &Glu, &stat, &info); + + } +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; }; pac_slu_version="5"; @@ -10922,6 +10955,13 @@ printf "%s\n" "no" >&6; }; pac_slu_version="4"; ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'