10
1
mirror of https://gitlab.com/scemama/qmcchem.git synced 2024-11-06 22:23:39 +01:00

Optimized mod(0)

This commit is contained in:
Anthony Scemama 2016-06-06 18:21:32 +02:00
parent b5f2e62421
commit f88fc822d9

View File

@ -321,20 +321,24 @@ subroutine det_update$n(n,LDS,m,l,S,S_inv,d)
!DIR$ ASSUME (mod(LDS,$IRP_ALIGN/8) == 0) !DIR$ ASSUME (mod(LDS,$IRP_ALIGN/8) == 0)
!DIR$ ASSUME (LDS >= $n) !DIR$ ASSUME (LDS >= $n)
integer :: i,j integer :: i,j
double precision :: zj, zj1, zj2, zj3
!DIR$ VECTOR ALIGNED !DIR$ VECTOR ALIGNED
!DIR$ SIMD
do i=1,$n do i=1,$n
u(i) = m(i) - S(i,l) u(i) = m(i) - S(i,l)
enddo enddo
z(l) = 0.d0 zj = 0.d0
!DIR$ VECTOR ALIGNED !DIR$ VECTOR ALIGNED
do i=1,$n !DIR$ SIMD REDUCTION(+:zj)
z(l) = z(l) + S_inv(i,l)*u(i) do i=1,$n-1,4
zj = zj + S_inv(i,l)*u(i) + S_inv(i+1,l)*u(i+1) &
+ S_inv(i+2,l)*u(i+2) + S_inv(i+3,l)*u(i+3)
enddo enddo
d_inv = 1.d0/d d_inv = 1.d0/d
d = d+z(l) d = d+zj
lambda = d*d_inv lambda = d*d_inv
if (dabs(lambda) < 1.d-3) then if (dabs(lambda) < 1.d-3) then
d = 0.d0 d = 0.d0
@ -343,20 +347,26 @@ subroutine det_update$n(n,LDS,m,l,S,S_inv,d)
!DIR$ VECTOR ALIGNED !DIR$ VECTOR ALIGNED
do j=1,$n,4 do j=1,$n,4
z(j ) = 0.d0 zj = 0.d0
z(j+1) = 0.d0 zj1 = 0.d0
z(j+2) = 0.d0 zj2 = 0.d0
z(j+3) = 0.d0 zj3 = 0.d0
!DIR$ VECTOR ALIGNED !DIR$ VECTOR ALIGNED
!DIR$ SIMD REDUCTION(+:zj,zj1,zj2,zj3)
do i=1,$n do i=1,$n
z(j ) = z(j ) + S_inv(i,j )*u(i) zj = zj + S_inv(i,j )*u(i)
z(j+1) = z(j+1) + S_inv(i,j+1)*u(i) zj1 = zj1 + S_inv(i,j+1)*u(i)
z(j+2) = z(j+2) + S_inv(i,j+2)*u(i) zj2 = zj2 + S_inv(i,j+2)*u(i)
z(j+3) = z(j+3) + S_inv(i,j+3)*u(i) zj3 = zj3 + S_inv(i,j+3)*u(i)
enddo enddo
z(j ) = zj
z(j+1) = zj1
z(j+2) = zj2
z(j+3) = zj3
enddo enddo
!DIR$ VECTOR ALIGNED !DIR$ VECTOR ALIGNED
!DIR$ SIMD FIRSTPRIVATE(d_inv)
do i=1,$n do i=1,$n
w(i) = S_inv(i,l)*d_inv w(i) = S_inv(i,l)*d_inv
S(i,l) = m(i) S(i,l) = m(i)
@ -364,11 +374,12 @@ subroutine det_update$n(n,LDS,m,l,S,S_inv,d)
do i=1,$n,4 do i=1,$n,4
!DIR$ VECTOR ALIGNED !DIR$ VECTOR ALIGNED
!DIR$ SIMD FIRSTPRIVATE(lambda,z)
do j=1,$n do j=1,$n
S_inv(j,i ) = S_inv(j,i )*lambda -z(i )*w(j) S_inv(j,i ) = S_inv(j,i )*lambda - w(j)*z(i )
S_inv(j,i+1) = S_inv(j,i+1)*lambda -z(i+1)*w(j) S_inv(j,i+1) = S_inv(j,i+1)*lambda - w(j)*z(i+1)
S_inv(j,i+2) = S_inv(j,i+2)*lambda -z(i+2)*w(j) S_inv(j,i+2) = S_inv(j,i+2)*lambda - w(j)*z(i+2)
S_inv(j,i+3) = S_inv(j,i+3)*lambda -z(i+3)*w(j) S_inv(j,i+3) = S_inv(j,i+3)*lambda - w(j)*z(i+3)
enddo enddo
enddo enddo