[petsc-users] erratic bug with nested PETSc and SLEPc
Jose E. Roman
jroman at dsic.upv.es
Mon Jan 25 05:03:01 CST 2016
> El 25 ene 2016, a las 11:34, Marco Zocca <zocca.marco at gmail.com> escribió:
>
> Dear all,
>
> I have a simple code with a matrix filling, assembly and output to stdout.
> This in turn is wrapped within a SLEPc bracket, and that in turn in a
> PETSc bracket, both called with default options
> (`XInitializeNoArguments`).
>
> I run this on my laptop, MPI comm size == 1.
>
> Issue: _sometimes_ the above crashes upon exit from the SLEPc bracket
> (i.e. after printing out the matrix), with an error code > 8000 . I
> haven't found this documented anywhere.
> It's funny because this doesn't happen with probability 1 and no
> conditions change (running from a makefile).
>
> Other times it simply works.
>
> In general, when using both PETSc and SLEPc functionality, is it
> enough to link to SLEPc alone? Does it take care of importing all of
> PETSc?
>
> Any hints re. this behaviour?
>
>
> Thank you in advance and kind regards,
>
> Marco
SLEPc makefiles include PETSc makefiles. Generally you just need to include ${SLEPC_DIR}/lib/slepc/conf/slepc_common and then add e.g. ${SLEPC_EPS_LIB} in your link line, which in turn will add ${PETSC_KSP_LIB}. [Note: if you need other components of PETSc such as SNES or TS you may need to add these, but it is usually not necessary unless PETSc has been configured --with-single-library=0].
If you call both SlepcInitialize() and PetscInitialize(), in any order, it should work. It should work also with the NoArguments versions. So I don't know where the problem is. If you share a test code I could try to reproduce the problem.
Jose
More information about the petsc-users
mailing list