Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range

2,803 views
Skip to first unread message

Ehsan Esfahani

unread,
Jul 3, 2016, 4:50:48 PM7/3/16
to deal.II User Group
Dear All,

Greetings. I changed step-25 (minor changes) in order to solve my problem. Now I want to change this code for parallel computation based on the method mentioned in step-40. I got several errors and solved them one by one but the following error:
   
Number of active cells: 1024
   Total number of cells: 1365
{[0,4224]}
Time step #1; advancing to t = 0.1.
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD 
with errorcode 59.
NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
[0]PETSC ERROR: ------------------------------------------------------------------------
[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
[0]PETSC ERROR: or see http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind
[0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X to find memory corruption errors
[0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run 
[0]PETSC ERROR: to get more information on the crash.
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Signal received
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.6.3, Dec, 03, 2015 
[0]PETSC ERROR: /home/ehsan/apps/candi/deal.II-toolchain/deal.II-v8.4.0/examples/step-25 (mine)/step-25 on a arch-linux2-c-opt named levitasgrad01.me.iastate.edu by ehsan Sun Jul  3 13:46:52 2016
[0]PETSC ERROR: Configure options --prefix=/home/ehsan/apps/candi/deal.II-toolchain/petsc-3.6.3 --with-debugging=0 --with-shared-libraries=1 --with-mpi=1 --with-x=0 --download-hypre=1 CC=mpicc CXX=mpicxx FC=mpif90
[0]PETSC ERROR: #1 User provided function() line 0 in  unknown file

Eclipse gives me a backtrace in the following line of the code:
    solver.solve (system_matrix, completely_distributed_solution_update, system_rhs,
                  preconditioner); 
I have no idea why I got this error. The code is running properly for fe(1) and n_global_refinements (4) but when I change them to fe(2) and n_global_refinments (4) I got that error related to Segmentation Violation. Do you know what's going on? Also, I have attached the code here . Thanks in advance for your help.

Best Regards,
Ehsan Esfahani
step-25plus.cc

Wolfgang Bangerth

unread,
Jul 3, 2016, 5:32:16 PM7/3/16
to dea...@googlegroups.com
On 07/03/2016 03:50 PM, Ehsan Esfahani wrote:
> Dear All,
>
> Greetings. I changed step-25 (minor changes) in order to solve my problem. Now
> I want to change this code for parallel computation based on the method
> mentioned in step-40. I got several errors and solved them one by one but the
> following error:
>
> /Number of active cells: 1024
> // Total number of cells: 1365
> //{[0,4224]}//
> //Time step #1; advancing to t = 0.1.
> [...]
> //[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation,
> probably memory access out of range
> [...]
>
> /
> /
> Eclipse gives me a backtrace in the following line of the code:
> / solver.solve (system_matrix, completely_distributed_solution_update,
> system_rhs,/
> / preconditioner);/
> I have no idea why I got this error. The code is running properly for /fe(1)
> /and /n_global_refinements (4)/ but when I change them to /fe(2)/ and
> n_global_refinments (4) I got that error related to /Segmentation Violation.
> /Do you know what's going on? Also, I have attached the code here . Thanks in
> advance for your help.

Ehsan,

segmentation violations (SEGV) are typically easy to debug because you can get
a backtrave in the debugger of the exact place where it happens, and you can
then look at the local variables to see why this may have happened. Have you
tried to run the program in a debugger and see what is going on?

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@math.tamu.edu
www: http://www.math.tamu.edu/~bangerth/

Ehsan Esfahani

unread,
Jul 4, 2016, 12:59:05 PM7/4/16
to deal.II User Group
Dear Professor Bangerth,

Thanks for your response. Yes, I did. As I mentioned, I got a backtrace in the debugger (eclipse) and I find out that the problem is in the line I have mentioned but I couldn't find out what's the problem in that line of the code which causes segmentation violation.

Best,
Ehsan

Daniel Arndt

unread,
Jul 4, 2016, 6:00:51 PM7/4/16
to deal.II User Group
Ehsan,

All I can say: After switching the order of arguments in SparseMatrix::add, your code runs for me with a recent developer version and Trilinos at least.

Best,
Daniel

Ehsan Esfahani

unread,
Jul 5, 2016, 11:08:09 AM7/5/16
to deal.II User Group
Daniel,

thanks for your response. the problem is in preconditioner. I find out that my code is running on my friend's machine but I get the error related to SEGV. I have changed preconditioner to Jacobi and it's running but with more iterations than AMG. Also, it's not running on my computer and the problem on my computer remained the same as before :-(

Best,
Ehsan 

Wolfgang Bangerth

unread,
Jul 5, 2016, 12:25:48 PM7/5/16
to dea...@googlegroups.com
On 07/05/2016 10:08 AM, Ehsan Esfahani wrote:
>
> thanks for your response. the problem is in preconditioner. I find out
> that my code is running on my friend's machine but I get the error
> related to SEGV. I have changed preconditioner to Jacobi and it's
> running but with more iterations than AMG. Also, it's not running on my
> computer and the problem on my computer remained the same as before :-(

Ehsan,
then let us come back to my original suggestion: when you run a program
in a debugger and it crashes, the backtrace will show where this
happens. If the problem was really in the line
solver.solve (system_matrix, completely_distributed_solution_update,
system_rhs, preconditioner);
then that would mean that in creating one of the arguments to this call,
the program did something illegal. For example, it could be that one of
the arguments is a reference that is not bound to anything. You should
be able to see this by looking at the various arguments in the debugger.

More likely, however, is that the program actually crashed *inside* the
`solver.solve` function, or one of the functions that it calls. You can
see this too in the backtrace, by seeing which functions are being
called. Once you find out which function creates the problem, you can
again look at the arguments and local variables and see what is happening.

Hamed Babaei

unread,
Oct 14, 2016, 12:01:22 PM10/14/16
to deal.II User Group
Hi Daniel,

I hope you are doing well. I've been struggling to run step-40 using Trilinos instead of Petsc. 
I appreciate it if you could let me know which parts of the code should be changed and how.

Documentation in the include part says : " uncomment the following #define if you have PETSc and Trilinos installed and you prefer using Trilinos in this example: #define FORCE_USE_OF_TRILINOS"
I can't understand what it means by the change in the following part:

namespace LA
{
#if defined(DEAL_II_WITH_PETSC) && !(defined(DEAL_II_WITH_TRILINOS) && defined(FORCE_USE_OF_TRILINOS))
using namespace ::LinearAlgebraPETSc;
# define USE_PETSC_LA
#elif defined(DEAL_II_WITH_TRILINOS)
using namespace ::LinearAlgebraTrilinos;
#else
# error DEAL_II_WITH_PETSC or DEAL_II_WITH_TRILINOS required
#endif
}

Thanks

On Monday, July 4, 2016 at 5:00:51 PM UTC-5, Daniel Arndt wrote:

Timo Heister

unread,
Oct 14, 2016, 2:46:28 PM10/14/16
to dea...@googlegroups.com
> Documentation in the include part says : " uncomment the following #define
> if you have PETSc and Trilinos installed and you prefer using Trilinos in
> this example: #define FORCE_USE_OF_TRILINOS"
> I can't understand what it means by the change in the following part:

You only need to change that one line. The logic below is a bit
complicated because it will use PETSc (if available), otherwise
Trilinos (if available). The order is reversed if you uncomment the
line above.


--
Timo Heister
http://www.math.clemson.edu/~heister/

Wolfgang Bangerth

unread,
Oct 14, 2016, 4:58:48 PM10/14/16
to dea...@googlegroups.com
On 10/14/2016 12:45 PM, Timo Heister wrote:
>> Documentation in the include part says : " uncomment the following #define
>> > if you have PETSc and Trilinos installed and you prefer using Trilinos in
>> > this example: #define FORCE_USE_OF_TRILINOS"
>> > I can't understand what it means by the change in the following part:
> You only need to change that one line. The logic below is a bit
> complicated because it will use PETSc (if available), otherwise
> Trilinos (if available). The order is reversed if you uncomment the
> line above.

Timo -- I think what confused the reporter was that the comment says
"uncomment the following #define", but there is just an #if and a complicated
one to boot. Maybe ought to update the comment -- I think I recall the #if
having become significantly more complicated recently.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Timo Heister

unread,
Oct 16, 2016, 8:53:42 AM10/16/16
to dea...@googlegroups.com
> Timo -- I think what confused the reporter was that the comment says
> "uncomment the following #define", but there is just an #if and a
> complicated one to boot. Maybe ought to update the comment -- I think I
> recall the #if having become significantly more complicated recently.

I don't understand what you mean by "there is just an #if". This is
the block we are talking about:

// uncomment the following #define if you have PETSc and Trilinos installed
// and you prefer using Trilinos in this example:
// #define FORCE_USE_OF_TRILINOS

I don't know how to make that more clear: just uncomment the #define.

We could think about moving the block below into a deal.II header
though, so people won't try to mess with it.

Jean-Paul Pelteret

unread,
Oct 17, 2016, 1:22:41 AM10/17/16
to deal.II User Group
For later reference, this conversation has now been moved to this thread.
Reply all
Reply to author
Forward
0 new messages