[petsc-users] Problem with encapsulation of PETSc/SLEPc in Fortran

Thibaut Appel t.appel17 at imperial.ac.uk
Wed Nov 1 10:23:53 CDT 2017


Dear PETSc/SLEPc users,

I am encountering a problem when I try to isolate my calls to 
PETSc/SLEPc routines in a module. When I have a single file everything 
works fine, but when I have, say:

    - modA.f90 (Independant modules)
    - modB.F90 (Contains all the calls to PETSc and SLEPc)
    - main.f90 or main.F90

When calling EPSSolve, I keep having the error "[1]PETSC ERROR: Caught 
signal number 8 FPE: Floating Point Exception,probably divide by zero" 
plus "User provided function() line 0 in  unknown file."
With gdb: "Thread 1 "main" received signal SIGFPE, Arithmetic exception. 
0x00007ffff1662cf6 in dlamch_ () from 
/home/linuxbrew/.linuxbrew/lib/libopenblas.so.0"

The PETSc/SLEPc module looks like
   USE SlepcEps
   IMPLICIT NONE
#include <slepc/finclude/slepcepsdef.h>

which is the only preprocessed directive used. I tried to add more 
(petscsys, petscmat, petscvec, slepseps), tried to change main.f90 to 
main.F90 and incorporate the preprocessed directives there as well 
without any effect. My code calls CHKERRQ(ierr) systematically. My 
makefile looks like

     include ${SLEPC_DIR}/lib/slepc/conf/slepc_common
     INCL = -I$(PETSC_DIR)/include/ -I$(SLEPC_DIR)/include/
     %.o: %.f90
         $(FC) $(FLAGS) $(INCL) -c $< -o $@ $(SLEPC_EPS_LIB)
     %.o: %.F90
         $(FC) $(FLAGS) $(INCL) -c $< -o $@ $(SLEPC_EPS_LIB)
     $(EXEC): $(OBJS)
         $(FC) $(FLAGS) $(INCL) $(OBJS) -o $@ $(SLEPC_EPS_LIB)

Could you spot anything I am doing wrong or dangerous? Furthermore, do 
you know how to avoid the warnings "Same actual argument associated with 
INTENT(IN) argument 'errorcode' and INTENT(OUT) argument 'ierror' at 
(1)" when calling CHKERRQ(ierr) when ierr is declared as INTEGER?

Thanks in advance for your continued support,

Thibaut
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20171101/36b4de98/attachment.html>


More information about the petsc-users mailing list