Skip to content

Commit

Permalink
Added nelec as command line argument
Browse files Browse the repository at this point in the history
  • Loading branch information
scemama committed Mar 10, 2021
2 parents 26a69be + 0ea8087 commit 04113a9
Show file tree
Hide file tree
Showing 13 changed files with 17,969 additions and 128 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
IRPF90 = irpf90/bin/irpf90 # --codelet=jastrow_full:1000 #-s nelec:10 -s nnuc:2 -s ncord:5 #-a -d
FC = ifort -xHost -g -mkl=sequential
IRPF90 = irpf90/bin/irpf90 --codelet=factor_een:2 #-s nelec:10 -s nnuc:2 -s ncord:5 #-a -d
FC = ifort -xCORE-AVX512 -g -mkl=sequential
FCFLAGS= -O2 -I .
AR = ar
NINJA = ninja
ARCHIVE = ar crs
RANLIB = ranlib

Expand Down
19 changes: 19 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,22 @@
\sum_{i=1}^{Ne} \sum_{pkl} \sum_a^{Nn}
c_{apkl} R_{ia}^{p-k-l}\, C_{i,a(p-k+l)}^k
$$


* Running

#+begin_src bash :var Ratio=5 Natoms=500
python ./generateData.py -a $Natoms -r $Ratio
#+end_src

Cela genere les trois fichiers:
geometry.txt
elec_coords.txt
jast_coeffs.txt


#+begin_src bash :var Natoms=500
./codelet_factor_een_blas $Natoms
#+end_src


16 changes: 9 additions & 7 deletions codelet_factor_een.f → codelet_factor_een_blas.irp.f
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@

program codelet_factor_een
program codelet_factor_een_blas
implicit none
integer :: i
double precision :: ticks_0, ticks_1, cpu_0, cpu_1
integer, parameter :: irp_imax = 100000
integer, parameter :: irp_imax = 200



call provide_factor_een
PROVIDE factor_een_blas tmp_c

call provide_factor_een_blas

double precision :: irp_rdtsc

call cpu_time(cpu_0)
ticks_0 = irp_rdtsc()
do i=1,irp_imax
call bld_factor_een
call bld_tmp_c
call bld_factor_een_blas
enddo
ticks_1 = irp_rdtsc()
call cpu_time(cpu_1)
print *, 'factor_een'
print *, 'factor_een_blas'
print *, '-----------'
print *, 'Cycles:'
print *, (ticks_1-ticks_0)/dble(irp_imax)
print *, 'Seconds:'
print *, (cpu_1-cpu_0)/dble(irp_imax)
end



26 changes: 13 additions & 13 deletions el_nuc_el.irp.f
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,24 @@
rescale_een_e(i,j,k) * &
rescale_een_n(i,a,m+l)
daccu(1:4) = daccu(1:4) + &
rescale_een_e_deriv_e_t(1:4,i,j,k) * &
rescale_een_e_deriv_e_t(i,1:4,j,k) * &
rescale_een_n(i,a,m)
daccu2(1:4) = daccu2(1:4) + &
rescale_een_e_deriv_e_t(1:4,i,j,k) * &
rescale_een_e_deriv_e_t(i,1:4,j,k) * &
rescale_een_n(i,a,m+l)

enddo
factor_een_deriv_e(1:4,j) = factor_een_deriv_e(1:4,j) + &
(accu * rescale_een_n_deriv_e(1:4,j,a,m+l) + daccu(1:4) * rescale_een_n(j,a,m+l) +&
daccu2(1:4)* rescale_een_n(j,a,m) + accu2*rescale_een_n_deriv_e(1:4,j,a,m)) * cn
(accu * rescale_een_n_deriv_e(j,1:4,a,m+l) + daccu(1:4) * rescale_een_n(j,a,m+l) +&
daccu2(1:4)* rescale_een_n(j,a,m) + accu2*rescale_een_n_deriv_e(j,1:4,a,m)) * cn

factor_een_deriv_e(4,j) = factor_een_deriv_e(4,j) + 2.d0*( &
daccu (1) * rescale_een_n_deriv_e(1,j,a,m+l) + &
daccu (2) * rescale_een_n_deriv_e(2,j,a,m+l) + &
daccu (3) * rescale_een_n_deriv_e(3,j,a,m+l) + &
daccu2(1) * rescale_een_n_deriv_e(1,j,a,m ) + &
daccu2(2) * rescale_een_n_deriv_e(2,j,a,m ) + &
daccu2(3) * rescale_een_n_deriv_e(3,j,a,m ) )*cn
daccu (1) * rescale_een_n_deriv_e(j,1,a,m+l) + &
daccu (2) * rescale_een_n_deriv_e(j,2,a,m+l) + &
daccu (3) * rescale_een_n_deriv_e(j,3,a,m+l) + &
daccu2(1) * rescale_een_n_deriv_e(j,1,a,m ) + &
daccu2(2) * rescale_een_n_deriv_e(j,2,a,m ) + &
daccu2(3) * rescale_een_n_deriv_e(j,3,a,m ) )*cn
enddo
enddo
enddo
Expand Down Expand Up @@ -152,8 +152,8 @@
rjam_cn = rescale_een_n(j, a, m) * cn

do ii = 1, 4
drjal(ii) = rescale_een_n_deriv_e(ii, j, a, l)
drjam_cn(ii) = rescale_een_n_deriv_e(ii, j, a, m) * cn
drjal(ii) = rescale_een_n_deriv_e(j, ii, a, l)
drjam_cn(ii) = rescale_een_n_deriv_e(j, ii, a, m) * cn
enddo

do i = 1, nelec
Expand All @@ -162,7 +162,7 @@
rijk = rescale_een_e(i, j, k)

do ii = 1, 4
drijk(ii) = rescale_een_e_deriv_e(ii, j, i, k)
drijk(ii) = rescale_een_e_deriv_e(j, ii, i, k)
enddo

v1 = rijk * rial ! v(x)
Expand Down
88 changes: 53 additions & 35 deletions el_nuc_el_blas.irp.f
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
BEGIN_PROVIDER [ double precision, factor_een_blas ]
&BEGIN_PROVIDER [ double precision, factor_een_deriv_e_blas, (4, nelec) ]
BEGIN_PROVIDER [ double precision, tmp_c, (nelec,nnuc,0:ncord,0:ncord-1) ]
&BEGIN_PROVIDER [ double precision, dtmp_c, (nelec,4,nnuc,0:ncord,0:ncord-1) ]
implicit none
BEGIN_DOC
! Dimensions 1-3 : dx, dy, dz
! Dimension 4 : d2x + d2y + d2z
! Calculate the intermediate buffers
! tmp_c:
! r_{ij}^k . R_{ja}^l -> tmp_c_{ia}^{kl}
!
! dtmp_c:
! dr_{ij}^k . R_{ja}^l -> dtmp_c_{ia}^{kl}
END_DOC

integer :: i, j, a, p, k, l, lmax, m, n
double precision :: cn(ncord), accu
double precision :: f(nnuc,0:ncord-2,0:ncord-2)
double precision :: tmp_c(nelec,nnuc,0:ncord,0:ncord-1)
double precision :: dtmp_c(4,nelec,nnuc,0:ncord,0:ncord-1)

factor_een_blas = 0.0d0
factor_een_deriv_e_blas(1:4,1:nelec) = 0.0d0
integer :: k

! r_{ij}^k . R_{ja}^l -> tmp_c_{ia}^{kl}
do k=0,ncord-1
Expand All @@ -26,12 +22,30 @@
! dr_{ij}^k . R_{ja}^l -> dtmp_c_{ia}^{kl}
do k=0,ncord-1
call dgemm('N','N', 4*nelec, nnuc*(ncord+1), nelec, 1.d0, &
rescale_een_e_deriv_e(1,1,1,k), 4*size(rescale_een_e_deriv_e,2),&
rescale_een_e_deriv_e(1,1,1,k), 4*size(rescale_een_e_deriv_e,1),&
rescale_een_n(1,1,0), size(rescale_een_n,1), 0.d0, &
dtmp_c(1,1,1,0,k), 4*size(dtmp_c,2))
dtmp_c(1,1,1,0,k), 4*size(dtmp_c,1))
enddo


END_PROVIDER


BEGIN_PROVIDER [ double precision, factor_een_blas ]
&BEGIN_PROVIDER [ double precision, factor_een_deriv_e_blas, (nelec,4) ]
implicit none
BEGIN_DOC
! Dimensions 1-3 : dx, dy, dz
! Dimension 4 : d2x + d2y + d2z
END_DOC

integer :: i, j, a, p, k, l, lmax, m, n, ii
double precision :: accu, cn
! double precision,dimension(:),allocatable :: cn

factor_een_blas = 0.0d0
factor_een_deriv_e_blas(1:nelec,1:4) = 0.0d0

do n = 1, dim_cord_vect

l = lkpm_of_cindex(1,n)
Expand All @@ -40,33 +54,37 @@
m = lkpm_of_cindex(4,n)

do a = 1, nnuc
cn(a) = cord_vect_full(n, a)
enddo
cn = cord_vect_full(n, a)
if (cn == 0.d0) cycle

do a = 1, nnuc
accu = 0.d0

do j=1,nelec
accu = accu + rescale_een_n(j,a,m) * tmp_c(j,a,m+l,k)
enddo
factor_een_blas = factor_een_blas + accu * cn

factor_een_deriv_e_blas(1:4,j) = factor_een_deriv_e_blas(1:4,j) + (&
tmp_c(j,a,m,k) * rescale_een_n_deriv_e(1:4,j,a,m+l) + &
dtmp_c(1:4,j,a,m,k) * rescale_een_n(j,a,m+l) + &
dtmp_c(1:4,j,a,m+l,k) * rescale_een_n(j,a,m) + &
tmp_c(j,a,m+l,k)*rescale_een_n_deriv_e(1:4,j,a,m) &
) * cn(a)

factor_een_deriv_e_blas(4,j) = factor_een_deriv_e_blas(4,j) + (&
dtmp_c(1,j,a,m ,k) * rescale_een_n_deriv_e(1,j,a,m+l) + &
dtmp_c(2,j,a,m ,k) * rescale_een_n_deriv_e(2,j,a,m+l) + &
dtmp_c(3,j,a,m ,k) * rescale_een_n_deriv_e(3,j,a,m+l) + &
dtmp_c(1,j,a,m+l,k) * rescale_een_n_deriv_e(1,j,a,m ) + &
dtmp_c(2,j,a,m+l,k) * rescale_een_n_deriv_e(2,j,a,m ) + &
dtmp_c(3,j,a,m+l,k) * rescale_een_n_deriv_e(3,j,a,m ) &
)*cn(a)*2.d0
do ii=1,4
do j=1,nelec
factor_een_deriv_e_blas(j,ii) = factor_een_deriv_e_blas(j,ii) + (&
tmp_c(j,a,m,k) * rescale_een_n_deriv_e(j,ii,a,m+l) + &
dtmp_c(j,ii,a,m,k) * rescale_een_n(j,a,m+l) + &
dtmp_c(j,ii,a,m+l,k) * rescale_een_n(j,a,m) + &
tmp_c(j,a,m+l,k)*rescale_een_n_deriv_e(j,ii,a,m) &
) * cn
enddo
enddo

cn = cn+cn
do j=1,nelec
factor_een_deriv_e_blas(j,4) = factor_een_deriv_e_blas(j,4) + (&
dtmp_c(j,1,a,m ,k) * rescale_een_n_deriv_e(j,1,a,m+l) + &
dtmp_c(j,2,a,m ,k) * rescale_een_n_deriv_e(j,2,a,m+l) + &
dtmp_c(j,3,a,m ,k) * rescale_een_n_deriv_e(j,3,a,m+l) + &
dtmp_c(j,1,a,m+l,k) * rescale_een_n_deriv_e(j,1,a,m ) + &
dtmp_c(j,2,a,m+l,k) * rescale_een_n_deriv_e(j,2,a,m ) + &
dtmp_c(j,3,a,m+l,k) * rescale_een_n_deriv_e(j,3,a,m ) &
)*cn
enddo
factor_een_blas = factor_een_blas + accu * cn(a)

enddo
enddo
Expand Down
Loading

0 comments on commit 04113a9

Please sign in to comment.