Using CSR (Compressed sparse row)

Find answers or ask questions regarding LSDalton calculations
Post Reply
vivanic
Posts: 4
Joined: 03 Mar 2016, 14:02
First name(s): Vedran
Last name(s): Ivanic
Affiliation: University of Split
Country: Croatia

Using CSR (Compressed sparse row)

Post by vivanic » 11 Mar 2016, 13:36

Dear all,

I have few questions (and results) using sparse matrix (CSR from MKL) in lsdalton. Test run was one SCF run with DFT on cyanine dye, 96 atoms, def2-tzvp basis (1776 basis functions). Outputs are attached for more information.

Timings:

for entire SCF are 4:03 hours without CSR and 13:34 hours with CSR.

no CSR (from 2nd SCF iteration)
>>> wall Time used in reg-Jengine is 3 minutes 33 seconds
>>> wall Time used in LINK-Kbuild is 12 minutes 0 seconds
>>> wall Time used in II_get_xc_Fock_mat is 16.29 seconds
>>> wall Time used in FCK_FO is 15 minutes 50 seconds
>>> wall Time used in G_GRAD is 0.37 seconds
>>> wall Time used in AVERAG is 0.15 seconds
>>> wall Time used in HOMO-LUMO gap is 0.38 seconds
>>> wall Time used in CROP solver is 6.72 seconds
>>> wall Time used in NEW D is 0.38 seconds
>>> wall Time used in G_DENS is 7.75 seconds
>>> wall Time used in SCF iteration is 15 minutes 58 seconds

with CSR (from 2nd SCF iteration)
>>> wall Time used in reg-Jengine is 4 minutes 3 seconds
>>> wall Time used in LINK-Kbuild is 13 minutes 31 seconds
>>> wall Time used in II_get_xc_Fock_mat is 17.08 seconds
>>> wall Time used in FCK_FO is 18 minutes 1 second
>>> wall Time used in G_GRAD is 24.64 seconds
>>> wall Time used in AVERAG is 15.82 seconds
>>> wall Time used in HOMO-LUMO gap is 0.78 seconds
>>> wall Time used in CROP solver is 14 minutes 25 seconds
>>> wall Time used in NEW D is 26.38 seconds
>>> wall Time used in G_DENS is 15 minutes 43 seconds
>>> wall Time used in SCF iteration is 34 minutes 24 seconds

As it can be seen timings are larger for calculation with CSR.

Sparsity:

no CSR
from INIT SCF:
Matrix S has nnz= 1338530 sparsity: 42.437 %
Matrix AO D has nnz= 3103980 sparsity: 98.409 %
from 2nd SCF iteration:
Matrix AO D has nnz= 3103930 sparsity: 98.407 %
Matrix AO F has nnz= 3049648 sparsity: 96.686 %
Matrix OAO D has nnz= 3140900 sparsity: 99.579 %
Matrix OAO F has nnz= 3153066 sparsity: 99.965 %

with CSR
from INIT SCF:
Matrix S has nnz= 0 sparsity: 0.000 %
Matrix AO D has nnz= 3154176 sparsity: 100.000 %
from 2nd SCF iteration:
Matrix AO D has nnz= 3154176 sparsity: 100.000 %
Matrix AO F has nnz= 3154176 sparsity: 100.000 %
Matrix OAO D has nnz= 3154176 sparsity: 100.000 %
Matrix OAO F has nnz= 3154176 sparsity: 100.000 %

Why are sparsity diffrent and what exactly they mean (in lsdalton of course, I have some basic knowledge and understanding in sparse algebra)? Does 100% means everything matrix element is 0? Does 0% means everything matrix element is different from 0? Or other way around? And why do they change, for example, in INIT SCF with and without CSR?

When can I expect, and accordingly should use CSR? Some number of atoms or basis functions? For the same number of basis functions I presume it would be of more use for spatialy larger system with less precise basis than for spatialy smaller system with more precise basis. But what is small and what is large in terms of CSR?

Technical information: all test run were done on 20 cpu and 20 threads. Entire software stack is intel (compiler, omp, math libs).

Regards,
Vedran Ivanic
Attachments
csr.x.df.x.rmm.x.out
without CSR
(153.07 KiB) Downloaded 314 times
csr.v.df.x.rmm.x.out
with CSR
(153.99 KiB) Downloaded 291 times

tkjaer
Posts: 300
Joined: 27 Aug 2013, 20:35
First name(s): Thomas
Last name(s): Kjaergaard

Re: Using CSR (Compressed sparse row)

Post by tkjaer » 11 Mar 2016, 15:26

I would prefer the opposite definition but

Sparsity in LSDalton is defined as the procentage of nnz(=number of nonzero) elements
so 100% sparsity means all elements in the matrix is non zero
0% sparsity means that all elements are zero

The crossover for .CSR is somewhere between 10~20 % sparsity so you need a very sparse molecule (like a linear chain)

Note that the definition of "zero" can be set using

**DENSOPT
.ZERO
1d-10

and the default is "1d-20" which means that a number is defined to be zero if it has a value below this number

You can try to experiment with other values of this cutoff.

The sparsity printout seem to be broken with CSR. Weird. I will have a look at this.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest