From 425743939ca87dd84c4aec16e073f83e24067ffc Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Wed, 6 Apr 2022 11:02:32 +0200 Subject: [PATCH] Fix for new SuperLU_Dist version, change configure --- amgprec/impl/amg_dslud_interface.c | 30 +++++++++++++++--------------- amgprec/impl/amg_zslud_interface.c | 30 +++++++++++++++--------------- configure | 10 +++------- configure.ac | 10 +++------- 4 files changed, 36 insertions(+), 44 deletions(-) diff --git a/amgprec/impl/amg_dslud_interface.c b/amgprec/impl/amg_dslud_interface.c index c7b4f3c6..2831c6f1 100644 --- a/amgprec/impl/amg_dslud_interface.c +++ b/amgprec/impl/amg_dslud_interface.c @@ -94,7 +94,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define HANDLE_SIZE 8 -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) +#if (SLUD_VERSION_>=63) typedef struct { SuperMatrix *A; dLUstruct_t *LUstruct; @@ -135,7 +135,7 @@ int amg_dsludist_fact(int n, int nl, int nnzl, int ffstr, SuperMatrix *A; NRformat_loc *Astore; -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) +#if (SLUD_VERSION_>=63) dScalePermstruct_t *ScalePermstruct; dLUstruct_t *LUstruct; dSOLVEstruct_t SOLVEstruct; @@ -148,9 +148,9 @@ int amg_dsludist_fact(int n, int nl, int nnzl, int ffstr, int i, panel_size, permc_spec, relax, info; trans_t trans; double drop_tol = 0.0, b[1], berr[1]; -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) || defined(SLUD_VERSION_6)||defined(SLUD_VERSION_5) +#if (SLUD_VERSION_>=50) superlu_dist_options_t options; -#elif defined(SLUD_VERSION_4)||defined(SLUD_VERSION_3) +#elif (SLUD_VERSION_>=30) superlu_options_t options; #else choke_on_me; @@ -174,7 +174,7 @@ int amg_dsludist_fact(int n, int nl, int nnzl, int ffstr, SLU_NR_loc, SLU_D, SLU_GE); /* Initialize ScalePermstruct and LUstruct. */ -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) +#if (SLUD_VERSION_>=63) ScalePermstruct = (dScalePermstruct_t *) SUPERLU_MALLOC(sizeof(dScalePermstruct_t)); LUstruct = (dLUstruct_t *) SUPERLU_MALLOC(sizeof(dLUstruct_t)); dScalePermstructInit(n,n, ScalePermstruct); @@ -183,11 +183,11 @@ int amg_dsludist_fact(int n, int nl, int nnzl, int ffstr, LUstruct = (LUstruct_t *) SUPERLU_MALLOC(sizeof(LUstruct_t)); ScalePermstructInit(n,n, ScalePermstruct); #endif -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) +#if (SLUD_VERSION_>=63) dLUstructInit(n, LUstruct); -#elif defined(SLUD_VERSION_4) || defined(SLUD_VERSION_5) || defined(SLUD_VERSION_6) +#elif (SLUD_VERSION_>=40) LUstructInit(n, LUstruct); -#elif defined(SLUD_VERSION_3) +#elif (SLUD_VERSION_>=30) LUstructInit(n,n, LUstruct); #else choke_on_me; @@ -245,7 +245,7 @@ int amg_dsludist_solve(int itrans, int n, int nrhs, */ #ifdef Have_SLUDist_ SuperMatrix *A; -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) +#if (SLUD_VERSION_>=63) dScalePermstruct_t *ScalePermstruct; dLUstruct_t *LUstruct; dSOLVEstruct_t SOLVEstruct; @@ -259,9 +259,9 @@ int amg_dsludist_solve(int itrans, int n, int nrhs, trans_t trans; double drop_tol = 0.0; double *berr; -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) || defined(SLUD_VERSION_6) ||defined(SLUD_VERSION_5) +#if (SLUD_VERSION_>=50) superlu_dist_options_t options; -#elif defined(SLUD_VERSION_4)|| defined(SLUD_VERSION_3) +#elif (SLUD_VERSION_>=30) superlu_options_t options; #else choke_on_me; @@ -331,7 +331,7 @@ int amg_dsludist_free(void *f_factors) */ #ifdef Have_SLUDist_ SuperMatrix *A; -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) +#if (SLUD_VERSION_>=63) dScalePermstruct_t *ScalePermstruct; dLUstruct_t *LUstruct; dSOLVEstruct_t SOLVEstruct; @@ -345,9 +345,9 @@ int amg_dsludist_free(void *f_factors) trans_t trans; double drop_tol = 0.0; double *berr; -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7)||defined(SLUD_VERSION_6)||defined(SLUD_VERSION_5) +#if (SLUD_VERSION_>=50) superlu_dist_options_t options; -#elif defined(SLUD_VERSION_4)||defined(SLUD_VERSION_3) +#elif (SLUD_VERSION_>=30) superlu_options_t options; #else choke_on_me; @@ -368,7 +368,7 @@ int amg_dsludist_free(void *f_factors) // we either have a leak or a segfault here. // To be investigated further. //Destroy_CompRowLoc_Matrix_dist(A); -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) +#if (SLUD_VERSION_>=63) dScalePermstructFree(ScalePermstruct); dLUstructFree(LUstruct); #else diff --git a/amgprec/impl/amg_zslud_interface.c b/amgprec/impl/amg_zslud_interface.c index 95b9f4fa..6170772a 100644 --- a/amgprec/impl/amg_zslud_interface.c +++ b/amgprec/impl/amg_zslud_interface.c @@ -94,7 +94,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define HANDLE_SIZE 8 -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) +#if (SLUD_VERSION_>=63) typedef struct { SuperMatrix *A; zLUstruct_t *LUstruct; @@ -142,7 +142,7 @@ int amg_zsludist_fact(int n, int nl, int nnzl, int ffstr, SuperMatrix *A; NRformat_loc *Astore; -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) +#if (SLUD_VERSION_>=63) zScalePermstruct_t *ScalePermstruct; zLUstruct_t *LUstruct; zSOLVEstruct_t SOLVEstruct; @@ -155,9 +155,9 @@ int amg_zsludist_fact(int n, int nl, int nnzl, int ffstr, int i, panel_size, permc_spec, relax, info; trans_t trans; double drop_tol = 0.0,berr[1]; -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) || defined(SLUD_VERSION_6)||defined(SLUD_VERSION_5) +#if (SLUD_VERSION_>=50) superlu_dist_options_t options; -#elif defined(SLUD_VERSION_4)||defined(SLUD_VERSION_3) +#elif (SLUD_VERSION_>=30) superlu_options_t options; #else choke_on_me; @@ -181,7 +181,7 @@ int amg_zsludist_fact(int n, int nl, int nnzl, int ffstr, SLU_NR_loc, SLU_Z, SLU_GE); /* Initialize ScalePermstruct and LUstruct. */ -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) +#if (SLUD_VERSION_>=63) ScalePermstruct = (zScalePermstruct_t *) SUPERLU_MALLOC(sizeof(zScalePermstruct_t)); LUstruct = (zLUstruct_t *) SUPERLU_MALLOC(sizeof(zLUstruct_t)); zScalePermstructInit(n,n, ScalePermstruct); @@ -190,11 +190,11 @@ int amg_zsludist_fact(int n, int nl, int nnzl, int ffstr, LUstruct = (LUstruct_t *) SUPERLU_MALLOC(sizeof(LUstruct_t)); ScalePermstructInit(n,n, ScalePermstruct); #endif -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) +#if (SLUD_VERSION_>=63) zLUstructInit(n, LUstruct); -#elif defined(SLUD_VERSION_4) || defined(SLUD_VERSION_5) || defined(SLUD_VERSION_6) +#elif (SLUD_VERSION_>=40) LUstructInit(n, LUstruct); -#elif defined(SLUD_VERSION_3) +#elif (SLUD_VERSION_>=30) LUstructInit(n,n, LUstruct); #else choke_on_me; @@ -257,7 +257,7 @@ int amg_zsludist_solve(int itrans, int n, int nrhs, */ #ifdef Have_SLUDist_ SuperMatrix *A; -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) +#if (SLUD_VERSION_>=63) zScalePermstruct_t *ScalePermstruct; zLUstruct_t *LUstruct; zSOLVEstruct_t SOLVEstruct; @@ -271,9 +271,9 @@ int amg_zsludist_solve(int itrans, int n, int nrhs, trans_t trans; double drop_tol = 0.0; double *berr; -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) || defined(SLUD_VERSION_6) ||defined(SLUD_VERSION_5) +#if (SLUD_VERSION_>=50) superlu_dist_options_t options; -#elif defined(SLUD_VERSION_4)|| defined(SLUD_VERSION_3) +#elif (SLUD_VERSION_>=30) superlu_options_t options; #else choke_on_me; @@ -343,7 +343,7 @@ int amg_zsludist_free(void *f_factors) */ #ifdef Have_SLUDist_ SuperMatrix *A; -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) +#if (SLUD_VERSION_>=63) zScalePermstruct_t *ScalePermstruct; zLUstruct_t *LUstruct; zSOLVEstruct_t SOLVEstruct; @@ -357,9 +357,9 @@ int amg_zsludist_free(void *f_factors) trans_t trans; double drop_tol = 0.0; double *berr; -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7)||defined(SLUD_VERSION_6)||defined(SLUD_VERSION_5) +#if (SLUD_VERSION_>=50) superlu_dist_options_t options; -#elif defined(SLUD_VERSION_4)||defined(SLUD_VERSION_3) +#elif (SLUD_VERSION_>=30) superlu_options_t options; #else choke_on_me; @@ -380,7 +380,7 @@ int amg_zsludist_free(void *f_factors) // we either have a leak or a segfault here. // To be investigated further. //Destroy_CompRowLoc_Matrix_dist(A); -#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_7) +#if (SLUD_VERSION_>=63) zScalePermstructFree(ScalePermstruct); zLUstructFree(LUstruct); #else diff --git a/configure b/configure index f22332bc..7f1305d8 100755 --- a/configure +++ b/configure @@ -9307,14 +9307,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "x$amg4psblas_cv_have_superludist" == "xyes" ; then - pac_sludist_version="$amg4psblas_cv_superludist_major"; - if (($amg4psblas_cv_superludist_major==6)); then - if (($amg4psblas_cv_superludist_minor>=3)); then - pac_sludist_version="63"; - fi - fi + pac_sludist_version="$amg4psblas_cv_superludist_major$amg4psblas_cv_superludist_minor"; + SLUDIST_FLAGS="" - SLUDIST_FLAGS="-DHave_SLUDist_ -DSLUD_VERSION_$pac_sludist_version $SLUDIST_INCLUDES" + SLUDIST_FLAGS="-DHave_SLUDist_ -DSLUD_VERSION_="$pac_sludist_version" $SLUDIST_INCLUDES" FDEFINES="$amg_cv_define_prepend-DHAVE_SLUDIST_ $FDEFINES" else SLUDIST_FLAGS="" diff --git a/configure.ac b/configure.ac index e3869c3d..7e185bc9 100755 --- a/configure.ac +++ b/configure.ac @@ -707,14 +707,10 @@ fi PAC_CHECK_SUPERLUDIST() if test "x$amg4psblas_cv_have_superludist" == "xyes" ; then - pac_sludist_version="$amg4psblas_cv_superludist_major"; - if (($amg4psblas_cv_superludist_major==6)); then - if (($amg4psblas_cv_superludist_minor>=3)); then - pac_sludist_version="63"; - fi - fi + pac_sludist_version="$amg4psblas_cv_superludist_major$amg4psblas_cv_superludist_minor"; + SLUDIST_FLAGS="" - SLUDIST_FLAGS="-DHave_SLUDist_ -DSLUD_VERSION_$pac_sludist_version $SLUDIST_INCLUDES" + SLUDIST_FLAGS="-DHave_SLUDist_ -DSLUD_VERSION_="$pac_sludist_version" $SLUDIST_INCLUDES" FDEFINES="$amg_cv_define_prepend-DHAVE_SLUDIST_ $FDEFINES" else SLUDIST_FLAGS=""