Thanks, for clearing that up. Truly helps alot. From an efficiency point of view I will go with option 2. And maybe implement a third option: to create an SeqAIJ if run as a uniprocessor program.
Regards, Mads > On 4/24/07, Mads Fredrik Skoge Hoel <mfhoel at ifi.uio.no> wrote: >> 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. > > Yes, although you really want the data "distributed" for option 2. If > you are reading > from disk, have all procs read and just ignore rows which you do not own. > > Matt > >> 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. >> > >> > >> >> >> > > > -- > The government saving money is like me spilling beer. It happens, but > never on purpose. > >
