poisson3d demo fails in MPI: cannot reshape array
Issue #113
resolved
Running the poisson3d demo fails in mpi. e.g. running from the demos subdir,
$ make PETSC_DIR=${PETSC_DIR} MPIEXEC="mpiexec -n 4" -C poisson3d
make: Entering directory '/home/projects/petsc/build/test/test-demos/poisson3d'
mpiexec -n 4 python poisson3d.py
Traceback (most recent call last):
File "poisson3d.py", line 35, in <module>
Traceback (most recent call last):
Traceback (most recent call last):
File "poisson3d.py", line 35, in <module>
ksp.solve(b, x)
File "PETSc/KSP.pyx", line 387, in petsc4py.PETSc.KSP.solve
Traceback (most recent call last):
File "poisson3d.py", line 35, in <module>
ksp.solve(b, x)
File "PETSc/KSP.pyx", line 387, in petsc4py.PETSc.KSP.solve
ksp.solve(b, x)
File "PETSc/KSP.pyx", line 387, in petsc4py.PETSc.KSP.solve
File "libpetsc4py/libpetsc4py.pyx", line 861, in libpetsc4py.MatMult_Python
File "libpetsc4py/libpetsc4py.pyx", line 861, in libpetsc4py.MatMult_Python
File "libpetsc4py/libpetsc4py.pyx", line 861, in libpetsc4py.MatMult_Python
File "poisson3d.py", line 35, in <module>
File "/home/drew/projects/petsc/build/test/test-demos/poisson3d/del2mat.py", line 23, in mult
ksp.solve(b, x)
File "PETSc/KSP.pyx", line 387, in petsc4py.PETSc.KSP.solve
File "/home/drew/projects/petsc/build/test/test-demos/poisson3d/del2mat.py", line 23, in mult
xx = x.getArray(readonly=1).reshape(N, order='f')
ValueError: cannot reshape array of size 8192 into shape (32,32,32)
File "libpetsc4py/libpetsc4py.pyx", line 861, in libpetsc4py.MatMult_Python
File "/home/drew/projects/petsc/build/test/test-demos/poisson3d/del2mat.py", line 23, in mult
xx = x.getArray(readonly=1).reshape(N, order='f')
ValueError: cannot reshape array of size 8192 into shape (32,32,32)
File "/home/drew/projects/petsc/build/test/test-demos/poisson3d/del2mat.py", line 23, in mult
xx = x.getArray(readonly=1).reshape(N, order='f')
ValueError: cannot reshape array of size 8192 into shape (32,32,32)
xx = x.getArray(readonly=1).reshape(N, order='f')
ValueError: cannot reshape array of size 8192 into shape (32,32,32)
-------------------------------------------------------
Primary job terminated normally, but 1 process returned
a non-zero exit code. Per user-direction, the job has been aborted.
-------------------------------------------------------
--------------------------------------------------------------------------
mpiexec detected that one or more processes exited with non-zero status, thus causing
the job to be terminated. The first process to do so was:
Process name: [[21376,1],1]
Exit code: 1
--------------------------------------------------------------------------
make: *** [makefile:21: run_py] Error 1
make: Leaving directory '/home/projects/petsc/build/test/test-demos/poisson3d'
The size of the array is 8192 here for 4 processors, but depends on the number of processors. The demo runs successfully with 1 processor.
This is for petsc4py 3.9, but there are no more recent commits on poisson3d (apart from commit 1821d0c). MPI is openmpi 3.1.2 (debian version 3.1.2-4).
Comments (4)
-
-
Fixed in 23c3439 to fail if run on multiple MPI processes.
-
- changed status to resolved
-
reporter thanks Lisandro!
- Log in to comment
This demo is sequential, you cannot run it in parallel.