Question about MatSetValues
bsmith at mcs.anl.gov
Sun Jun 4 12:20:44 CDT 2006
Write a SEQUENTIAL program that reads in the matrix and then
saves it with MatView() to a binary file (can do a right hand side also)
then use ksp/ksp/examples/tutorials/ex10.c which uses MatLoad() to solve the
See for example src/mat/examples/tests/ex32.c for an example of
sequential program for reading in ASCII matrix. Also ex34.c ex50.c also ex78.c
On Sun, 4 Jun 2006, Sh.M wrote:
> 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