[firedrake] Calling PETSc within PyOP2 kernels

Justin Chang jychang48 at gmail.com
Tue Nov 3 06:59:55 GMT 2015


Lawrence,

So I have implemented PETSc into the PYOP2 kernel, but I am sometimes
getting strange errors.

Attached is the working code plus the reactions kernel file.

Run the code by typing "python 1D_analytical_ADR_ex1.py <seed> <0/1>
<0/1>". The last option is for using either Newtons Method (0) or
Variational Inequality (1).

The reason my errors are strange is because it only happens sometimes.
Sometimes I get errors like this:

python(11976,0x7fff7497a000) malloc: *** error for object 0x7fbb4b5e8ef0:
incorrect checksum for freed object - object was probably modified after
being freed.

*** set a breakpoint in malloc_error_break to debug

[Justins-MBP:11976] *** Process received signal ***

[Justins-MBP:11976] Signal: Abort trap: 6 (6)

[Justins-MBP:11976] Signal code:  (0)

[Justins-MBP:11976] [ 0] 0   libsystem_platform.dylib
0x00007fff94c5452a _sigtramp + 26

[Justins-MBP:11976] [ 1] 0   ???
0x0000000000000000 0x0 + 0

[Justins-MBP:11976] [ 2] 0   libsystem_c.dylib
0x00007fff946f937b abort + 129

[Justins-MBP:11976] [ 3] 0   libsystem_malloc.dylib
0x00007fff9502b3a6 szone_error + 626

[Justins-MBP:11976] [ 4] 0   libsystem_malloc.dylib
0x00007fff95021604 tiny_free_list_remove_ptr + 289

[Justins-MBP:11976] [ 5] 0   libsystem_malloc.dylib
0x00007fff9501f956 szone_free_definite_size + 1480

[Justins-MBP:11976] [ 6] 0   Python
0x000000010228f236 dict_dealloc + 154

[Justins-MBP:11976] [ 7] 0   Python
0x00000001022af3f2 subtype_dealloc + 481

[Justins-MBP:11976] [ 8] 0   Python
0x00000001022859c5 list_dealloc + 105

[Justins-MBP:11976] [ 9] 0   Python
0x0000000102280216 frame_dealloc + 110

[Justins-MBP:11976] [10] 0   Python
0x00000001022dd1c4 PyEval_EvalCodeEx + 1915

[Justins-MBP:11976] [11] 0   Python
0x00000001022e3640 fast_function + 117

[Justins-MBP:11976] [12] 0   Python
0x00000001022e0553 PyEval_EvalFrameEx + 13165

[Justins-MBP:11976] [13] 0   Python
0x00000001022dcfb4 PyEval_EvalCodeEx + 1387

[Justins-MBP:11976] [14] 0   Python
0x0000000102281bf5 function_call + 352

[Justins-MBP:11976] [15] 0   Python
0x0000000102263ad7 PyObject_Call + 99

[Justins-MBP:11976] [16] 0   Python
0x0000000102263c65 call_function_tail + 72

[Justins-MBP:11976] [17] 0   Python
0x0000000102263c06 PyObject_CallFunction + 196

[Justins-MBP:11976] [18] 0   Python
0x0000000102294755 _PyObject_GenericGetAttrWithDict + 219

[Justins-MBP:11976] [19] 0   Python
0x00000001022df15d PyEval_EvalFrameEx + 8055

[Justins-MBP:11976] [20] 0   Python
0x00000001022dcfb4 PyEval_EvalCodeEx + 1387

[Justins-MBP:11976] [21] 0   Python
0x0000000102281bf5 function_call + 352

[Justins-MBP:11976] [22] 0   Python
0x0000000102263ad7 PyObject_Call + 99

[Justins-MBP:11976] [23] 0   Python
0x0000000102263c65 call_function_tail + 72

[Justins-MBP:11976] [24] 0   Python
0x0000000102263c06 PyObject_CallFunction + 196

[Justins-MBP:11976] [25] 0   Python
0x0000000102294755 _PyObject_GenericGetAttrWithDict + 219

[Justins-MBP:11976] [26] 0   Python
0x00000001022df15d PyEval_EvalFrameEx + 8055

[Justins-MBP:11976] [27] 0   Python
0x00000001022dcfb4 PyEval_EvalCodeEx + 1387

[Justins-MBP:11976] [28] 0   Python
0x0000000102281bf5 function_call + 352

[Justins-MBP:11976] [29] 0   Python
0x0000000102263ad7 PyObject_Call + 99

[Justins-MBP:11976] *** End of error message ***

[1]    11976 abort      python 1D_analytical_ADR_ex1.py 100 0 1

Other times I get errors like this:

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

--------------------------------------------------------------------------

I am confused  as to why these errors occur randomly, even if I use the
same input arguments. I suspect it has sometime to do with how I have
implemented PETSc within PYOP2. Can you tell what is going on?

Thanks,
Justin
-------------- next part --------------
HTML attachment scrubbed and removed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1D_analytical_ADR_ex1.py
Type: text/x-python-script
Size: 6262 bytes
Desc: not available
URL: <http://mailman.ic.ac.uk/pipermail/firedrake/attachments/20151102/b7cbc452/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reactions_kernel.py
Type: text/x-python-script
Size: 3137 bytes
Desc: not available
URL: <http://mailman.ic.ac.uk/pipermail/firedrake/attachments/20151102/b7cbc452/attachment-0001.bin>


More information about the firedrake mailing list