Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6977 Discussions

Manipulation of matrices with sparse storage

e112974
Beginner
249 Views

Hi,

recently I got involved with memory optimization of our in house FE program. I decided to use csr format storage with dss solver, which worked fine so far. However in our implementation, we have so called special elements, which require special treatment. To give you one example: you can define a special node in the mesh, where the program creates an additional node in the same location. Then we couple certain dofs between these nodes and allow them to move only in a certain direction wrt each other. Anyway, without going any further detail, the implementation of this coupling etc. requires some significant manipulation in global stiffness matrix, such as exchanging rows/columns, setting a whole row/column to zero, etc. As a result, the csr storage arrays (rowindex, columns, values) populated during the assembly of global matrix gets totally messed up and book keeping becomes a nightmare.

I was wondering if anyone faced a similar problem and could give me any feedback on how to tackle this issue. I have tried various things, such as converting the csr into dense format, do the manipulations and then convert back to csr again. However it really killed the efficiency, which was my main goal in the first place. 

Looking forward to your replies and thank you in advance!

Best regards,

Murat

0 Kudos
1 Reply
Alexander_K_Intel2
249 Views

Hi Murat,

On the first glance there are 2 different approach that can covered your case:

1. If you know all nodes that will added you can take them into account during implementation initial csr structure and nullify all element that doesn't used in this step. 

2. When you achieve additional elements put them into end of the list. Thus your ia, ja and value arrays will increase - additional values will appear in the end of them whereas first elements will not change. So you need to allocate ia, ja and values a bit huger and add additional value in the end after each singularity appearing. 

 

Thanks,

Alex

0 Kudos
Reply