[petsc-users] [slepc] nan output for eigenvectors

Patrick Alken patrick.alken at geomag.info
Fri Sep 9 01:09:50 CDT 2022


I have attached a minimal example, although it does have a dependency on 
the GSL library (sorry for this). The script mwe.sh shows how I am 
running the program with the various command line arguments. The program 
will write the computed eigenvectors to an output file called 'evec' in 
GNU octave / matlab format.

I tried running it on 3 different systems with 3 different GCC versions. 
I am using the latest petsc downloaded from git, and SLEPc 3.17.2. Here 
are the results:

GCC 7.5.0: produces nan values in the eigenvector output file, as well 
as extremely large and small values. In addition, the petsc/slepc 'make 
check' tests fail on this system.

GCC 10.2.0: produces nan values in the eigenvector output file, as well 
as extremely large and small values. On this system, the petsc/slepc 
'make check' tests pass.

GCC 11.2.0: does not produce nan values, and the eigenvector values are 
all between about -0.01 and +0.01. On this system, the petsc/slepc 'make 
check' tests pass.

At first I thought it was a compiler bug in the old GCC 7.5 version, but 
10.2 also seems to have the same problem. I need to do more testing with 
11.2.

Any advice is appreciated!

Patrick

On 9/7/22 01:20, Jose E. Roman wrote:
>
>> El 7 sept 2022, a las 6:18, Patrick Alken <patrick.alken at geomag.info> escribió:
>>
>> I sometimes get Nan output values in computed eigenvectors for the generalized symmetric eigenvalue problem produced by slepc. Is this a known issue, and is it related to the conditioning of the matrix pair (A,B)? Is there some way to compute a "condition number" of the matrix pair ahead of time to see if i have a good chance of getting stable eigenvectors out?
> You should never get NaN. Can you send a reproducible example?
>
>> In a possibly related issue, i am finding that petsc/slepc compiled with debugging vs optimization can produce very different eigenvectors for the same problem, while the eigenvalues are the same. The eigenvectors seem more accurate when I use the debugging version of the libraries. Could this be also a conditioning problem with the matrix pair?
> What do you mean more accurate? The residual norm computed with EPSComputeError() should be below the tolerance in both debugging and optimized versions.
>
> Jose
>
-------------- next part --------------
default: mwe

include ${SLEPC_DIR}/lib/slepc/conf/slepc_common

OBJECTS = mwe.o

mwe: ${OBJECTS}
	${CLINKER} -o mwe ${OBJECTS} ${SLEPC_EPS_LIB} -lgsl -lgslcblas -lm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mwe.c
Type: text/x-csrc
Size: 11082 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220909/9afc2e8e/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mwe.sh
Type: application/x-shellscript
Size: 146 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220909/9afc2e8e/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oct.c
Type: text/x-csrc
Size: 11933 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220909/9afc2e8e/attachment-0005.bin>


More information about the petsc-users mailing list