<div dir="ltr">To whom it may concern,<div><br></div><div>I would like to modify the code in SNES's ex2.c to run in parallel.</div><div><br></div><div><a href="https://www.mcs.anl.gov/petsc/petsc-3.6.4/src/snes/examples/tutorials/ex2.c.html">https://www.mcs.anl.gov/petsc/petsc-3.6.4/src/snes/examples/tutorials/ex2.c.html</a><br></div><div><br></div><div>I modified my ex2.c, as attached here. Even though ex3.c is the parallel version, I would like my implementation to "not contain" DMDA.</div><div><br></div><div>(Despite version 3.6.4, it works for version 3.15.0, which I use in my debugging purpose.)</div><div><br></div><div>The "crucial" parts of ex2.c that I modified are (apart from deletion of comments, exact solution verification, etc):</div><div><br></div><div>- (line 63-64) matrix preallocation</div><div>- use MatGetOwnershipRange on a PETSc matrix jac (in FormJacobian)</div><div>- use VecGetOwnershipRange on every PETSc vector in the program </div><div><br></div><div>I try to run the program with mpiexec. For n = 1 it works fine for -pc_type lu -snes_type newtonls. However, when I increase n to be n = 2, the code does not iterate further. (It does not go into the FormJacobian for after the first iteration.) I try several different pc_type and snes_type, but still do not get the result as obtained with n = 1.</div><div><br></div><div>I attached the terminal printout also.</div><div><br></div><div>Since the manual (3.15.0) said that (p81, section 2.4, 1st paragraph)</div><div><br></div><div>"Also, the SNES interface is identical for the uniprocess and parallel cases; the only difference in the parallel version is that each process typically forms only its local contribution to various matrices and vectors"</div><div><br></div><div>Therefore, I think that by modified only the vectors and matrices part, I should be able to get parallelism.</div><div><br></div><div>Regards,</div><div>Suwun</div><div><br></div><div>PS1: I compile using mpicc and use mpiexec found in the directory ${PETSC_DIR}/arch-mumps-opt/bin/ to run the code.</div><div>PS2: I attached the install.sh (I install with MUMPS) that I use to install PETSc. Note that I also turn on --with-debuggin=yes</div><div>PS3: my OS is Ubuntu 20.04.2. Intel CPU. My environment should have everything necessary (gfortran, gcc, g++, valgrind, cmake).</div></div>