Thank you for your answer. I did not at first understand Barrys suggestion, but looking at it a second time helped.
So if i got it right there is two options: 1. Barrys suggestion: use code that distributes a SeqAIJ matrix owned by a single process to multiple processes. Ie. code from http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/src/ksp/pc/impls/openmp/openmp.c.html#PCOPENMP 2. Randys suggestion: create an empty distributed MPIAIJ matrix, using MatCreateMPIAIJ. Have it filled with existing data, distributed or non- distributed, in an CRS format, and have it assembeled. Regards, Mads > On 4/24/07, Mads Fredrik Skoge Hoel <mfhoel at ifi.uio.no> wrote: >> Hi, >> >> I am in a similar situation as Tim. I am starting out with a sequential >> program using PETSc as a solver and this other library to discretisize. >> Which hopefully will become a parallel program once run under mpirun. >> >> But calling MatCreateMPIAIJWithArrays i get the error message: >> [0]PETSC ERROR: --------------------- Error Message >> ------------------------------------ >> [0]PETSC ERROR: Object is in wrong state! >> [0]PETSC ERROR: Must call MatSetSizes() first! >> [0]PETSC ERROR: >> ------------------------------------------------------------------------ >> >> This is the call generating the error message: >> MatCreateMPIAIJWithArrays(PETSC_COMM_WORLD, n, m, n, m, irow, jcol, >> &dpA(1), &A); >> >> I am probably using the MatCreateMPIAIJWithArrays function wrong or in a >> wrong context. >> >> Is it allowed to call MatCreateMPIAIJWithArrays when running as a >> uniprocessor application? Or must I use in a multiprocessor context >> calling MatCreateSeqAIJWithArrays on each processor? And how would a >> PETSc >> solver know that local Mat A is part of a global matrix? > > No, this method is for people who already have partitioned their matrix. > For a > uniprocessor application, please follow Barry's instructions for the > OPENMP PC. > Otherwise, you will need to rework your code as Randy pointed out before. > > Thanks, > > Matt > >> Any help is highly appreciated. >> >> Regards, >> Mads >> >> > > > -- > The government saving money is like me spilling beer. It happens, but > never on purpose. > >
