MatSetSizes: C vs python
The right call in petsc4py is P.setSizes(((nrowsLoc,PETSc.DECIDE),(ncolsLoc,PETSc.DECIDE)),1) https://petsc.org/main/petsc4py/reference/petsc4py.PETSc.Mat.html#petsc4py.P... Il giorno mar 6 giu 2023 alle ore 13:05 Blaise Bourdin <[email protected]> ha scritto:
Hi,
Does anybody understand why MatSetSizes seem to behave differently in C and python?
I would expect the attached examples to be strictly equivalent but the python version fails in parallel. It may be that the python interface is different, but I don’t see any mention of this in the python docs.
Regards, Blaise
SiBookPro:test (master)$ mpirun -np 2 python3 testL2G2.py nrowsLoc: 10 ncolsLoc: 20 Traceback (most recent call last): File "/Users/blaise/Development/ccG_CR/test/testL2G2.py", line 20, in <module> nrowsLoc: 11 ncolsLoc: 21 Traceback (most recent call last): File "/Users/blaise/Development/ccG_CR/test/testL2G2.py", line 20, in <module> sys.exit(main()) sys.exit(main()) ^^^^^^ File "/Users/blaise/Development/ccG_CR/test/testL2G2.py", line 12, in main ^^^^^^ File "/Users/blaise/Development/ccG_CR/test/testL2G2.py", line 12, in main P.setSizes([nrowsLoc,ncolsLoc],1) P.setSizes([nrowsLoc,ncolsLoc],1) File "petsc4py/PETSc/Mat.pyx", line 323, in petsc4py.PETSc.Mat.setSizes petsc4py.PETSc.Error: error code 62 [1] MatSetSizes() at /opt/HPC/petsc-release/src/mat/utils/gcreate.c:161 [1] Invalid argument [1] Int value must be same on all processes, argument # 4 File "petsc4py/PETSc/Mat.pyx", line 323, in petsc4py.PETSc.Mat.setSizes petsc4py.PETSc.Error: error code 62 [0] MatSetSizes() at /opt/HPC/petsc-release/src/mat/utils/gcreate.c:161 [0] Invalid argument [0] Int value must be same on all processes, argument # 4
— Canada Research Chair in Mathematical and Computational Aspects of Solid Mechanics (Tier 1) Professor, Department of Mathematics & Statistics Hamilton Hall room 409A, McMaster University 1280 Main Street West, Hamilton, Ontario L8S 4K1, Canada https://www.math.mcmaster.ca/bourdin | +1 (905) 525 9140 ext. 27243
-- Stefano
participants (2)
-
Blaise Bourdin -
Stefano Zampini