From d13e7584e190d63ce91f1f182e88c87b8aab56f8 Mon Sep 17 00:00:00 2001 From: Codi McKee Date: Sat, 16 Mar 2024 02:38:44 -0500 Subject: [PATCH] Update DistributedSuperLU.cpp Add precompile logic to handle major structure changes in SuperLU_DIST introduced in v6.2.x --- .../sparseGEN/DistributedSuperLU.cpp | 62 ++++++++++++++----- 1 file changed, 48 insertions(+), 14 deletions(-) diff --git a/SRC/system_of_eqn/linearSOE/sparseGEN/DistributedSuperLU.cpp b/SRC/system_of_eqn/linearSOE/sparseGEN/DistributedSuperLU.cpp index 5370bf0de4..527f48843e 100644 --- a/SRC/system_of_eqn/linearSOE/sparseGEN/DistributedSuperLU.cpp +++ b/SRC/system_of_eqn/linearSOE/sparseGEN/DistributedSuperLU.cpp @@ -39,20 +39,37 @@ #include -// SuperLU_DIST 'options' was redefined starting in Version 5.X.X -#if defined(SUPERLU_DIST_MAJOR_VERSION) && SUPERLU_DIST_MAJOR_VERSION >= 5 - superlu_dist_options_t options; -#else - superlu_options_t options; +#ifdef SUPERLU_DIST_MAJOR_VERSION + // SuperLU_Dist 6.2.0 brought a major change that separated several structures tobe "precision-dependent" + // which changes the name (prefixes with 'd' or 'z') + #if (SUPERLU_DIST_MAJOR_VERSION >= 6 && SUPERLU_DIST_MINOR_VERSION >= 2) + #include + #ifndef _SUPERLU_DIST_6 + #define _SUPERLU_DIST_6 + #endif + #endif + + // SuperLU_DIST 'options' was redefined starting in Version 5.X.X + #if SUPERLU_DIST_MAJOR_VERSION >= 5 + superlu_dist_options_t options; + #else + superlu_options_t options; + #endif #endif SuperLUStat_t stat; SuperMatrix A; -ScalePermstruct_t ScalePermstruct; -LUstruct_t LUstruct; gridinfo_t grid; MPI_Comm comm_SuperLU; +#ifdef _SUPERLU_DIST_6 + dScalePermstruct_t ScalePermstruct; + dLUstruct_t LUstruct; +#else + ScalePermstruct_t ScalePermstruct; + LUstruct_t LUstruct; +#endif + DistributedSuperLU::DistributedSuperLU(int npR, int npC) :SparseGenColLinSolver(SOLVER_TAGS_DistributedSuperLU), @@ -75,8 +92,13 @@ DistributedSuperLU::DistributedSuperLU() DistributedSuperLU::~DistributedSuperLU() { //Destroy_LU(theSOE->size, &grid, &LUstruct); - ScalePermstructFree(&ScalePermstruct); - LUstructFree(&LUstruct); + #ifdef _SUPERLU_DIST_6 + dScalePermstructFree(&ScalePermstruct); + dLUstructFree(&LUstruct); + #else + ScalePermstructFree(&ScalePermstruct); + LUstructFree(&LUstruct); + #endif //superlu_gridexit(&grid); @@ -208,9 +230,16 @@ DistributedSuperLU::setSize() // free old structures if resize already called } else { - Destroy_LU(theSOE->size, &grid, &LUstruct); - ScalePermstructFree(&ScalePermstruct); - LUstructFree(&LUstruct); + + #ifdef _SUPERLU_DIST_6 + dDestroy_LU(theSOE->size, &grid, &LUstruct); + dScalePermstructFree(&ScalePermstruct); + dLUstructFree(&LUstruct); + #else + Destroy_LU(theSOE->size, &grid, &LUstruct); + ScalePermstructFree(&ScalePermstruct); + LUstructFree(&LUstruct); + #endif } // @@ -237,8 +266,13 @@ DistributedSuperLU::setSize() // // Initialize ScalePermstruct and LUstruct. // - ScalePermstructInit(n, n, &ScalePermstruct); - LUstructInit(n, &LUstruct); + #ifdef _SUPERLU_DIST_6 + dScalePermstructInit(n, n, &ScalePermstruct); + dLUstructInit(n, &LUstruct); + #else + ScalePermstructInit(n, n, &ScalePermstruct); + LUstructInit(n, &LUstruct); + #endif }