Initializing a large sparse matrix
Hi everyone, I initialize a large sparse matrix (50000x20000) using MatCreate() and then filling it with MatSetValues() line by line but it takes a bit more than an hour on 80 cores to fill in the matrix. Is there a way to optimize this initialization? Fuji
You have to preallocate, see https://petsc.org/release/docs/manual/mat/#sec-matsparse
El 17 oct 2022, a las 8:37, fujisan <[email protected]> escribió:
Hi everyone,
I initialize a large sparse matrix (50000x20000) using MatCreate() and then filling it with MatSetValues() line by line but it takes a bit more than an hour on 80 cores to fill in the matrix.
Is there a way to optimize this initialization?
Fuji
Can I preallocate space for a rectangular matrix using MatCreateAIJ() in parallel? It is not clear to me how I have to define d_nnz when the matrix is rectangular? X * * * * * X * * * * * X * * * * * X * * * * * X * * * * * * * * * * The example shown is for an 8x8 matrix on 3 cpu X * * * X * * * X On Mon, Oct 17, 2022 at 9:02 AM Jose E. Roman <[email protected]> wrote:
You have to preallocate, see https://petsc.org/release/docs/manual/mat/#sec-matsparse
El 17 oct 2022, a las 8:37, fujisan <[email protected]> escribió:
Hi everyone,
I initialize a large sparse matrix (50000x20000) using MatCreate() and then filling it with MatSetValues() line by line but it takes a bit more than an hour on 80 cores to fill in the matrix.
Is there a way to optimize this initialization?
Fuji
There are examples in the manpages, see for instance https://petsc.org/release/docs/manualpages/Mat/MatCreateAIJ/ https://petsc.org/release/docs/manualpages/Mat/MatMPIAIJSetPreallocation/ Jose
El 17 oct 2022, a las 10:12, fujisan <[email protected]> escribió:
Can I preallocate space for a rectangular matrix using MatCreateAIJ() in parallel? It is not clear to me how I have to define d_nnz when the matrix is rectangular?
X * * * * * X * * * * * X * * * * * X * * * * * X * * * * * * * * * *
The example shown is for an 8x8 matrix on 3 cpu X * * * X * * * X
On Mon, Oct 17, 2022 at 9:02 AM Jose E. Roman <[email protected]> wrote: You have to preallocate, see https://petsc.org/release/docs/manual/mat/#sec-matsparse
El 17 oct 2022, a las 8:37, fujisan <[email protected]> escribió:
Hi everyone,
I initialize a large sparse matrix (50000x20000) using MatCreate() and then filling it with MatSetValues() line by line but it takes a bit more than an hour on 80 cores to fill in the matrix.
Is there a way to optimize this initialization?
Fuji
participants (2)
-
fujisan -
Jose E. Roman