How to write a program, which can be run on 1 and multiple processors?
Yixun Liu
enjoywm at cs.wm.edu
Sun Apr 26 16:30:00 CDT 2009
Hi,
I want to make my code run on 1 or multiple processors. The code, which
can run on multiple processors is like the following,
MatCreate(PETSC_COMM_WORLD, &A);
MatSetSizes(A, 3*numOfVerticesOfOneProcessor,
3*numOfVerticesOfOneProcessor, systemSize, systemSize);
MatSetFromOptions(A);
MatMPIAIJSetPreallocation(A, 50, PETSC_NULL, 50, PETSC_NULL);
However if I want to run on 1 processor I have to change the last code to:
MatSeqAIJSetPreallocation(A,1000,PETSC_NULL);
How to avoid changing code?
Thanks.
Yixun
More information about the petsc-users
mailing list