Discussion:
[petsc-users] Create Hypre ILU(0) PC Segmentation error
Feng Xing
2015-11-01 13:39:00 UTC
Permalink
Hello everyone,

I would like to look for help for a small problem. I am trying to create a Hypre ilu(0) preconditioned in Fortran with the following code, where the matrix A_mpi has been created.

call PCCreate(MPI_COMM_WORLD, pcilu0, Ierr)
CHKERRQ(Ierr)
call PCSetOperators(pcilu0, A_mpi, A_mpi, Ierr)
CHKERRQ(Ierr)
call PCSetType(pcilu0, PCHYPRE, Ierr)
CHKERRQ(Ierr)
call PCHYPRESetType(pcilu0, 'euclid', Ierr)
CHKERRQ(Ierr)
call PetscOptionsSetValue(pcilu0, '-pc_hypre_euclid_levels', '0', Ierr)
CHKERRQ(Ierr)

But, I got some segmentation errors. I tried to use valgrind, but it doesn’t report any errors.
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger

Thank you very much!

Kind regards,
Feng Xing
Postdoc in France
Barry Smith
2015-11-01 16:18:33 UTC
Permalink
You need to learn how to use the debugger to debug this type of crash. In this case it is very simple just run the code in the debugger and when it crashes type "where" and "up" and "list" to see where it crashed. Make sure to use the debug version of the code.
Post by Feng Xing
Hello everyone,
I would like to look for help for a small problem. I am trying to create a Hypre ilu(0) preconditioned in Fortran with the following code, where the matrix A_mpi has been created.
call PCCreate(MPI_COMM_WORLD, pcilu0, Ierr)
CHKERRQ(Ierr)
call PCSetOperators(pcilu0, A_mpi, A_mpi, Ierr)
CHKERRQ(Ierr)
call PCSetType(pcilu0, PCHYPRE, Ierr)
CHKERRQ(Ierr)
call PCHYPRESetType(pcilu0, 'euclid', Ierr)
CHKERRQ(Ierr)
call PetscOptionsSetValue(pcilu0, '-pc_hypre_euclid_levels', '0', Ierr)
This is likely the problem since you are using totally the wrong first argument for this function.

Note also you would use KSPGetPC() and then set the PC and not use a PCCreate()
Post by Feng Xing
CHKERRQ(Ierr)
But, I got some segmentation errors. I tried to use valgrind, but it doesn’t report any errors.
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
Thank you very much!
Kind regards,
Feng Xing
Postdoc in France
Feng Xing
2015-11-01 18:50:39 UTC
Permalink
Thanks very much for the stupid error and the advices. There should not have pcilu0 in call "PetscOptionsSetValue”.

Since I would like to create a shell pc (multicative and ...), I use PCCreate().

Kind reagards,
Post by Barry Smith
You need to learn how to use the debugger to debug this type of crash. In this case it is very simple just run the code in the debugger and when it crashes type "where" and "up" and "list" to see where it crashed. Make sure to use the debug version of the code.
Post by Feng Xing
Hello everyone,
I would like to look for help for a small problem. I am trying to create a Hypre ilu(0) preconditioned in Fortran with the following code, where the matrix A_mpi has been created.
call PCCreate(MPI_COMM_WORLD, pcilu0, Ierr)
CHKERRQ(Ierr)
call PCSetOperators(pcilu0, A_mpi, A_mpi, Ierr)
CHKERRQ(Ierr)
call PCSetType(pcilu0, PCHYPRE, Ierr)
CHKERRQ(Ierr)
call PCHYPRESetType(pcilu0, 'euclid', Ierr)
CHKERRQ(Ierr)
call PetscOptionsSetValue(pcilu0, '-pc_hypre_euclid_levels', '0', Ierr)
This is likely the problem since you are using totally the wrong first argument for this function.
Note also you would use KSPGetPC() and then set the PC and not use a PCCreate()
Post by Feng Xing
CHKERRQ(Ierr)
But, I got some segmentation errors. I tried to use valgrind, but it doesn’t report any errors.
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
Thank you very much!
Kind regards,
Feng Xing
Postdoc in France
Loading...