Question about MatSetValues

Sh.M shma7099 at student.uu.se
Sun Jun 4 12:10:31 CDT 2006


Hi,

When using the MatSetValues function with one CPU only, it will cache/save
the values locally and then distribute them to the other processes with
MatAssemblyBegin/MatAssemblyEnd? Is this true? What happens with the
cached/saved values afterwards? Are they released? Is there a way to not
cache/save the data locally at all?

I am asking these questions because right now speed is not of highest
priority, but memory is. And unfortunately in my case I do not generate the
matrix by my own and instead read it from a file obtained from "real world"
data samples.

I have read/distributed the matrix in a couple of different ways; for
example CPU 0 reads the file, and then calls MatSetValues.. One other way
has been that CPU 0 reads the file, sends the rows that belong to the other
processes to the other processes and those processes call MatSetValues by
their own on the received rows. And last one is that I have split the file
into several smaller files and several processes reads their own file and
call MatSetValues on the data they have read from their own file. To make it
more convenient for me, the number of files have been maximum number of
processors that I have used in my simulations. So If maximum number of
processors is 64, then number of files is 64. And if 8 processors are used,
then each processor reads 8 files etc.

I dont believe any of the approaches I have used are elegant...

What would you guys do if you had a file in CSR format, and you want to read
it, distribute it and then solve it if memory usage is of highest priority?

With best regards, Shaman Mahmoudi




More information about the petsc-users mailing list