[petsc-users] Efficient reuse of vectors and matrices

Margreet Nool margreet.nool at gmail.com
Wed Jul 4 06:33:36 CDT 2012


Dear list,

How can I reuse vectors and matrices efficiently?

Our program uses a lot of global matrices and vectors and I want to 
reduce the amount of memory. Are there PETSC functions, which check 
whether a Mat or Vec is already created or destroyed? Our programs have 
been written in Fortran90.

The program performs a time stepping process, and I want to know what 
the best way is  to create a global vector only once. As an example, a 
global vector Vec y is created as a result of a matrix-vector product A 
. x = y, by calling the PETSC function MatMult. After the first call the 
Vec Y has already been created.

1. Do we have to store the result into a temporary vector temp_vec and 
copy its values into Vec y and destroy temp_vec?
2. Do we have to destroy Vec y before a call of MatMult and store the 
result directly in Vec y?
3. Does there exist a better solution?

Thanks in advance,
Margreet Nool

-- 
Margreet Nool
CWI - Centrum Wiskunde & Informatica
Science Park 123,
1098 XG Amsterdam
P.O. Box 94079
1090 GB Amsterdam
--------------------
tel: +31 20 592 4120
Room, M131



More information about the petsc-users mailing list