Re: [petsc-dev] Patch to fix vector allocation in ksp-fcg
When I added this change src/ksp/ksp/examples/tutorials/ex60 make runex60 failed with valgrind errors. bsmith@es:/sandbox/bsmith/petsc/src/ksp/ksp/examples/tutorials$ /sandbox/bsmith/petsc/bin/petscmpiexec -valgrind -n 1 ./ex60 -ksp_monitor_short -ksp_rtol 1e-6 -diagfunc 1 -ksp_type fcg -ksp_fcg_mmax 1 -eta 0.1 ==14854== Invalid write of size 8 ==14854== at 0x5C32987: KSPAllocateVectors_FCG (fcg.c:37) ==14854== by 0x5C32FE2: KSPSetUp_FCG (fcg.c:77) ==14854== by 0x5BEBD69: KSPSetUp (itfunc.c:267) ==14854== by 0x5BED3E3: KSPSolve (itfunc.c:419) ==14854== by 0x403599: main (ex60.c:219) ==14854== Address 0xa49f720 is 0 bytes after a block of size 16 alloc'd ==14854== at 0x4C29BE8: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==14854== by 0x4F33A45: PetscMallocAlign (mal.c:27) ==14854== by 0x5C32D96: KSPSetUp_FCG (fcg.c:63) ==14854== by 0x5BEBD69: KSPSetUp (itfunc.c:267) ==14854== by 0x5BED3E3: KSPSolve (itfunc.c:419) ==14854== by 0x403599: main (ex60.c:219) ==14854== Thus I have removed this change. Barry
On Dec 19, 2014, at 8:18 AM, Sascha Schnepp <[email protected]> wrote:
Hello developers,
I prepared a patch to fix the allocation of direction vectors in KSPAllocateVectors_FCG within ksp-fcg.
The fix consists only of replacing a PetscMin with a PetscMax. This prevents vectors being allocated one-by-one instead of chunksize of them once the preallocated ones (nprealloc) are exhausted.
Let me know if you prefer a PR.
Best, Sascha
-------------------------------------- ETH Zurich Sascha Schnepp Institute of Geophysics - Geophysical Fluid Dynamics NO H23, Sonneggstrasse 5, 8092 Zurich, Switzerland
[email protected] www.gfd.ethz.ch; www.saschaschnepp.net
+41 44 632 0244 phone
Consider encrypting your mail Public Key ID: 0x67AC24EF --------------------------------------
<Fix-to-KSPAllocateVectors_FCG.patch>
participants (1)
-
Barry Smith