Commit 12749465 authored by Kochunas, Brendan M.'s avatar Kochunas, Brendan M. Committed by Henderson, Shane
Browse files

Fixes build and tests with TPL_ENABLE_SLEPC=ON

Squash branch 'hotfix_slepc' into 'master'

* Fixes build and tests with TPL_ENABLE_SLEPC=ON

Description:
Futility has an optional dependency on SLEPC which is needed
by the arbitrary graph partitioner. When attempting to build
Futility with SLEPC a few build errors were encountered. These
were mostly related to missing USE statements and use of old
PETSC defines that were deprecated.

Source code now builds and SLEPC tests pass.

See commit message

**Developer Checklist:**
- [x] Have you done a self-review after creating the merge request?
- [x] Have you filled in the Merge Request information (title, description) thoroughly?
- [x] Have you updated the relevant tickets (if this MR is linked to any VERA-dev tickets)?
- [ ] Have you addressed all suggested feedback and commented on it to let the reviewer know? (Do not resolve discussions that the reviewer started)

**Reviewer Checklist:**
- [x] Have you confirmed all discussions were adequately addressed and resolved them all?
- [x] Does it conform to formatting guidelines?
- [x] Are there adequate and clear comments?
- [x] Is the design clean and sensible?
- [x] Are the changes optimal/efficient?
- [x] Were sufficient DBC checks added? 
- [x] Are there unit tests? (already existing, did not build; now they build)
- [ ] Is the MR description clear, including a link to the VERA-Dev issue if appropriate? (it is clear, no dev issue created or needed, it could refer to the old-old-old issue where this feature was implemented)

**PSM Checklist**
- [ ] Have you confirmed that all discussions were addressed, or that follow-on issues have been created for them?
- [x] Have you confirmed sufficient testing was conducted? (Yes, previous testing is sufficient)
- [x] Does this impact other repositories? (No)
- [x] Does the MR have an adequate description? (Yes)
- [x] If the MR has multiple commits, did you set the MR to squash merge? (Yes)

See merge request https://code.ornl.gov/futility/Futility/-/merge_requests/417
parent 61e39f07
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -42,6 +42,9 @@ USE ForTeuchos_ParameterList
#include <petscversion.h>
#if (((PETSC_VERSION_MAJOR>=3) && (PETSC_VERSION_MINOR>6)) || (PETSC_VERSION_MAJOR>=4))
USE PETSCSNES
#ifdef FUTILITY_HAVE_SLEPC
USE SLEPCEPS
#endif
#endif
#endif

+10 −2
Original line number Diff line number Diff line
@@ -33,10 +33,18 @@ USE VectorTypes
USE MatrixTypes
USE Sorting

#ifdef FUTILITY_HAVE_PETSC
#include <petscversion.h>
#if (((PETSC_VERSION_MAJOR>=3) && (PETSC_VERSION_MINOR>=6)) || (PETSC_VERSION_MAJOR>=4))
#ifdef FUTILITY_HAVE_SLEPC
USE SLEPCEPS
#endif
#endif
#endif

IMPLICIT NONE

#ifdef FUTILITY_HAVE_PETSC
#include <petscversion.h>
#if (((PETSC_VERSION_MAJOR>=3) && (PETSC_VERSION_MINOR>=6)) || (PETSC_VERSION_MAJOR>=4))
#include <petsc/finclude/petsc.h>
#else
@@ -1849,7 +1857,7 @@ SUBROUTINE getEigenVecs(A,lsmall,numvecs,V)
    !Assemble the matrix
    CALL A%assemble(ierr)
    !Set the operators (Only matrix A)
    CALL EPSSetOperators(eps, A%A,PETSC_NULL_OBJECT,ierr)
    CALL EPSSetOperators(eps, A%A,PETSC_NULL_MAT,ierr)
  ENDSELECT

  !Get the eigenvectors
+7 −1
Original line number Diff line number Diff line
@@ -17,6 +17,13 @@ USE VectorTypes
USE MatrixTypes
USE PartitionGraph

#ifdef FUTILITY_HAVE_SLEPC
#include <petscversion.h>
#if (((PETSC_VERSION_MAJOR>=3) && (PETSC_VERSION_MINOR>=6)) || (PETSC_VERSION_MAJOR>=4))
USE PETSCSYS
#endif
#endif

IMPLICIT NONE

TYPE(PartitionGraphType) :: testPG,testSG
@@ -25,7 +32,6 @@ TYPE(ParamType) :: refG1Params,refG2Params,refG3Params,refG4Params
TYPE(ExceptionHandlerType),POINTER :: e

#ifdef FUTILITY_HAVE_SLEPC
#include <petscversion.h>
#if (((PETSC_VERSION_MAJOR>=3) && (PETSC_VERSION_MINOR>=6)) || (PETSC_VERSION_MAJOR>=4))
#include <petsc/finclude/petsc.h>
#else
+8 −3
Original line number Diff line number Diff line
@@ -10,9 +10,14 @@ PROGRAM testTPLSLEPC

USE IntrType

#include <petscversion.h>
#if (((PETSC_VERSION_MAJOR>=3) && (PETSC_VERSION_MINOR>=6)) || (PETSC_VERSION_MAJOR>=4))
USE PETSCSYS
USE SLEPCEPS
#endif

IMPLICIT NONE

#include <petscversion.h>
#if (((PETSC_VERSION_MAJOR>=3) && (PETSC_VERSION_MINOR>=6)) || (PETSC_VERSION_MAJOR>=4))
#include <petsc/finclude/petsc.h>
#include <slepc/finclude/slepc.h>
@@ -130,7 +135,7 @@ SUBROUTINE testEX1F()
  CALL EPSCreate(PETSC_COMM_WORLD,eps,ierr)

  ! Set operators. In this case, it is a standard eigenvalue problem
  CALL EPSSetOperators(eps,A,PETSC_NULL_OBJECT,ierr)
  CALL EPSSetOperators(eps,A,PETSC_NULL_MAT,ierr)
  CALL EPSSetProblemType(eps,EPS_HEP,ierr)

  ! Set solver parameters at runtime
@@ -173,7 +178,7 @@ SUBROUTINE testEX1F()
    DO i=0,nconv-1
      ! Get converged eigenpairs: i-th eigenvalue is stored in kr
      ! (real part) and ki (imaginary part)
      CALL EPSGetEigenpair(eps,i,kr,ki,PETSC_NULL_OBJECT,PETSC_NULL_OBJECT,ierr)
      CALL EPSGetEigenpair(eps,i,kr,ki,PETSC_NULL_VEC,PETSC_NULL_VEC,ierr)

      ! Compute the relative error associated to each eigenpair
#if (((PETSC_VERSION_MAJOR>=3) && (PETSC_VERSION_MINOR>=6)) || (PETSC_VERSION_MAJOR>=4))