Skip to content

Commit

Permalink
Merge pull request OpenSees#1363 from mckee107/Update_SuperLU_DIST_Pr…
Browse files Browse the repository at this point in the history
…ecompile_logic

Update DistributedSuperLU.cpp
  • Loading branch information
fmckenna authored Mar 19, 2024
2 parents b35ead4 + d13e758 commit 4c7d090
Showing 1 changed file with 48 additions and 14 deletions.
62 changes: 48 additions & 14 deletions SRC/system_of_eqn/linearSOE/sparseGEN/DistributedSuperLU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,37 @@

#include <superlu_ddefs.h>

// 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 <superlu_FCnames.h>
#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),
Expand All @@ -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);

Expand Down Expand Up @@ -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
}

//
Expand All @@ -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
}


Expand Down

0 comments on commit 4c7d090

Please sign in to comment.