NWChem
From Modelado Foundation
NWChem | |
---|---|
Location to an image/logo (if any) Image Caption | |
Developer(s) | Institute's name |
Stable Release | x.y.z/Latest Release Date here |
Operating Systems | Linux, Unix, etc. |
Type | Computational Chemistry? |
License | Open Source or else? |
Website | URL here |
NWChem is <...your description here...>
Applications
Kernel Name
Description
Download
Optimizations
Additional Work Skipping
The reference implementation has two tests to skip unnecessary work, one at the i,j level and one at the i,j,k,l level (innermost loop). An additional test can be added to the i,j,k level which will allow skipping entire iterations of the inner most loop.
Reference twoel function:
double twoel(double schwmax) { int i, j, k, l; for (i = 0; i < nbfn; i++) { for (j = 0; j < nbfn; j++) { if ((g_schwarz[i][j] * schwmax ) < tol2e) {icut1 += nbfn * nbfn; continue;} double KLTest = tol2e / g_schwarz[i][j]; for (k = 0; k < nbfn; k++) { for (l = 0; l < nbfn; l++) { if (g_schwarz[k][l] < KLTest) {icut2 ++; continue;} icut3 ++; double gg = g(i, j, k, l); g_fock[i][j] += ( gg * g_dens[k][l]); g_fock[i][k] -= (0.50 * gg * g_dens[j][l]); } } } } return (0.50 * contract_matrices(g_fock, g_dens)); }
The inner-most test, (g_schwarz[k][l] < KLTest)
, can be modified to work in the k loop under certain conditions. If the maximum value of all entries for a given row of g_schwarz is known, that can be compared to KLTest in the k loop and we can skip the l loop entirely in cases where it would not perform any updates.
This requires one additional line to be inserted between the k and l loops:
for (k = 0; k < nbfn; k++) { if (g_schwarz_max_row_value[k] < KLTest) {icut4 ++; continue;} for (l = 0; l < nbfn; l++) {
To enable this additional test, the array g_schwarz_max_row_value should be populated with the maximum value for each row in makesz while it is initializing the g_schwarz matrix.
The additional memory requirements for this work skipping test are minimal as the array only has one dimension of size nbfn.