Skip to content

Instantly share code, notes, and snippets.

@bonfus
Created March 31, 2017 14:36
Show Gist options
  • Save bonfus/bbe32f015c6411a8da237fb07d3c3b01 to your computer and use it in GitHub Desktop.
Save bonfus/bbe32f015c6411a8da237fb07d3c3b01 to your computer and use it in GitHub Desktop.
libxsmm in pw.x
! snippet from line 213 of s_psi.f90, pw 6.1
DO nt = 1, nsp
IF ( upf(nt)%tvanp ) THEN
DO na = 1, nat
IF ( ityp(na) == nt ) THEN
!
! Next operation computes ps(l',i)=\sum_m qq(l,m) becp(m',i)
! (l'=l+ijkb0, m'=m+ijkb0, indices run from 1 to nh(nt))
!
IF ( m_loc > 0 ) THEN
IF ( m_loc * nh(nt) * nh(nt) > 12167 ) THEN
CALL DGEMM('N', 'N', nh(nt), m_loc, nh(nt), 1.0_dp, &
qq(1,1,nt), nhm, becp%r(indv_ijkb0(na)+1,1),&
nkb, 0.0_dp, ps(indv_ijkb0(na)+1,1), nkb )
ELSE
print *, 'gemmsize ', m_loc * nh(nt) * nh(nt)
thetimes = libxsmm_timer_xtick()
CALL libxsmm_dgemm('N', 'N', nh(nt), m_loc, nh(nt), 1.0_dp, &
qq(1,1,nt), nhm, becp%r(indv_ijkb0(na)+1,1),&
nkb, 0.0_dp, ps(indv_ijkb0(na)+1,1), nkb )
thetimee = libxsmm_timer_xtick()
print *, 'x', thetimee-thetimes
thetimes = libxsmm_timer_xtick()
CALL DGEMM('N', 'N', nh(nt), m_loc, nh(nt), 1.0_dp, &
qq(1,1,nt), nhm, becp%r(indv_ijkb0(na)+1,1),&
nkb, 0.0_dp, ps(indv_ijkb0(na)+1,1), nkb )
thetimee = libxsmm_timer_xtick()
print *, 'b', thetimee-thetimes
END IF
END IF
END IF
END DO
END IF
END DO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment