This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Why It will be wrong if I include the dolfin library!

0 votes

I want to use scipy and petsc4py in program, but the second code is wrong because I include the dolfin library. Does anybody know where is wrong!? Thanks!

The first code :

import numpy as np
from petsc4py import PETSc
import scipy.sparse

csr_mat = scipy.sparse.rand(1000, 1000, density=0.1, format='csr')
csr = (csr_mat.indptr,csr_mat.indices,csr_mat.data)
A = PETSc.Mat()
A.createAIJ(size=csr_mat.shape ,csr = csr)

The second code :

from dolfin import *
import numpy as np
from petsc4py import PETSc
import scipy.sparse

csr_mat = scipy.sparse.rand(1000, 1000, density=0.1, format='csr')
csr = (csr_mat.indptr,csr_mat.indices,csr_mat.data)
A = PETSc.Mat()
A.createAIJ(size=csr_mat.shape ,csr = csr)
asked Nov 21, 2014 by motianlunfenics FEniCS Novice (310 points)

Both work for me on development version of dolfin.

But I got the error as following :

[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.
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD 
with errorcode -384715702.

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.
--------------------------------------------------------------------------

1 Answer

0 votes

Code runs fine for other users (including me), so I suggest you update your installation.

answered Dec 23, 2014 by Garth N. Wells FEniCS Expert (35,930 points)
...