mirror of
https://github.com/LCPQ/quantum_package
synced 2024-08-24 21:41:46 +02:00
Added integrals access benchmark
This commit is contained in:
parent
62a8253244
commit
b3d0c06209
@ -35,6 +35,7 @@ except ImportError:
|
||||
|
||||
from qp_path import QP_ROOT, QP_SRC, QP_EZFIO
|
||||
|
||||
LIB = "" # join(QP_ROOT, "lib", "rdtsc.o")
|
||||
EZFIO_LIB = join(QP_ROOT, "lib", "libezfio.a")
|
||||
ROOT_BUILD_NINJA = join(QP_ROOT, "config", "build.ninja")
|
||||
|
||||
@ -94,7 +95,7 @@ def ninja_create_env_variable(pwd_config_file):
|
||||
l_string.append(str_)
|
||||
|
||||
lib_lapack = get_compilation_option(pwd_config_file, "LAPACK_LIB")
|
||||
l_string.append("{0} = {1} {2}".format("LIB", lib_lapack, EZFIO_LIB))
|
||||
l_string.append("LIB = {0} {1} {2}".format(LIB, lib_lapack, EZFIO_LIB))
|
||||
|
||||
l_string.append("")
|
||||
|
||||
|
@ -291,6 +291,7 @@ double precision function get_mo_bielec_integral(i,j,k,l,map)
|
||||
PROVIDE mo_bielec_integrals_in_map
|
||||
!DIR$ FORCEINLINE
|
||||
call bielec_integrals_index(i,j,k,l,idx)
|
||||
!DIR$ FORCEINLINE
|
||||
call map_get(map,idx,tmp)
|
||||
get_mo_bielec_integral = dble(tmp)
|
||||
end
|
||||
@ -306,12 +307,13 @@ double precision function get_mo_bielec_integral_schwartz(i,j,k,l,map)
|
||||
type(map_type), intent(inout) :: map
|
||||
real(integral_kind) :: tmp
|
||||
PROVIDE mo_bielec_integrals_in_map
|
||||
!DIR$ FORCEINLINE
|
||||
if (mo_bielec_integral_schwartz(i,k)*mo_bielec_integral_schwartz(j,l) < mo_integrals_threshold) then
|
||||
tmp = 0.d0
|
||||
else
|
||||
if (mo_bielec_integral_schwartz(i,k)*mo_bielec_integral_schwartz(j,l) > mo_integrals_threshold) then
|
||||
!DIR$ FORCEINLINE
|
||||
call bielec_integrals_index(i,j,k,l,idx)
|
||||
!DIR$ FORCEINLINE
|
||||
call map_get(map,idx,tmp)
|
||||
else
|
||||
tmp = 0.d0
|
||||
endif
|
||||
get_mo_bielec_integral_schwartz = dble(tmp)
|
||||
end
|
||||
|
136
src/Integrals_Bielec/test_integrals.irp.f
Normal file
136
src/Integrals_Bielec/test_integrals.irp.f
Normal file
@ -0,0 +1,136 @@
|
||||
program bench_maps
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Performs timing benchmarks on integral access
|
||||
END_DOC
|
||||
integer :: i,j,k,l
|
||||
integer*8 :: ii,jj
|
||||
double precision :: r, cpu
|
||||
integer*8 :: cpu0, cpu1, count_rate, count_max
|
||||
|
||||
PROVIDE mo_bielec_integrals_in_map
|
||||
print *, mo_tot_num, 'MOs'
|
||||
|
||||
! Time random function
|
||||
call system_clock(cpu0, count_rate, count_max)
|
||||
do ii=1,100000000_8
|
||||
call random_number(r)
|
||||
i = int(r*mo_tot_num)+1
|
||||
call random_number(r)
|
||||
j = int(r*mo_tot_num)+1
|
||||
call random_number(r)
|
||||
k = int(r*mo_tot_num)+1
|
||||
call random_number(r)
|
||||
l = int(r*mo_tot_num)+1
|
||||
enddo
|
||||
call system_clock(cpu1, count_rate, count_max)
|
||||
cpu = (cpu1-cpu0)/count_rate
|
||||
print *, 'Random function : ', cpu/dble(ii)
|
||||
|
||||
call system_clock(cpu0, count_rate, count_max)
|
||||
do ii=1,100000000_8
|
||||
call random_number(r)
|
||||
i = int(r*mo_tot_num)+1
|
||||
call random_number(r)
|
||||
j = int(r*mo_tot_num)+1
|
||||
call random_number(r)
|
||||
k = int(r*mo_tot_num)+1
|
||||
call random_number(r)
|
||||
l = int(r*mo_tot_num)+1
|
||||
call get_mo_bielec_integral(i,j,k,l,mo_integrals_map)
|
||||
enddo
|
||||
call system_clock(cpu1, count_rate, count_max)
|
||||
cpu = -cpu + (cpu1 - cpu0)/count_rate
|
||||
print *, 'Random access : ', cpu/dble(ii)
|
||||
|
||||
ii=0_8
|
||||
call system_clock(cpu0, count_rate, count_max)
|
||||
do jj=1,10
|
||||
do l=1,mo_tot_num
|
||||
do k=1,mo_tot_num
|
||||
do j=1,mo_tot_num
|
||||
do i=1,mo_tot_num
|
||||
ii += 1
|
||||
call get_mo_bielec_integral(i,j,k,l,mo_integrals_map)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
call system_clock(cpu1, count_rate, count_max)
|
||||
cpu = (cpu1 - cpu0)/count_rate
|
||||
print *, 'loop ijkl : ', cpu/dble(ii)
|
||||
|
||||
ii=0
|
||||
call system_clock(cpu0, count_rate, count_max)
|
||||
do jj=1,10
|
||||
do l=1,mo_tot_num
|
||||
do j=1,mo_tot_num
|
||||
do k=1,mo_tot_num
|
||||
do i=1,mo_tot_num
|
||||
ii += 1
|
||||
call get_mo_bielec_integral(i,j,k,l,mo_integrals_map)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
call system_clock(cpu1, count_rate, count_max)
|
||||
cpu = (cpu1 - cpu0)/count_rate
|
||||
print *, 'loop ikjl : ', cpu/dble(ii)
|
||||
|
||||
ii=0
|
||||
call system_clock(cpu0, count_rate, count_max)
|
||||
do jj=1,10
|
||||
do k=1,mo_tot_num
|
||||
do l=1,mo_tot_num
|
||||
do j=1,mo_tot_num
|
||||
do i=1,mo_tot_num
|
||||
ii += 1
|
||||
call get_mo_bielec_integral(i,j,k,l,mo_integrals_map)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
call system_clock(cpu1, count_rate, count_max)
|
||||
cpu = (cpu1 - cpu0)/count_rate
|
||||
print *, 'loop ijlk : ', cpu/dble(ii)
|
||||
|
||||
ii=0
|
||||
call system_clock(cpu0, count_rate, count_max)
|
||||
do jj=1,10
|
||||
do i=1,mo_tot_num
|
||||
do j=1,mo_tot_num
|
||||
do k=1,mo_tot_num
|
||||
do l=1,mo_tot_num
|
||||
ii += 1
|
||||
call get_mo_bielec_integral(i,j,k,l,mo_integrals_map)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
call system_clock(cpu1, count_rate, count_max)
|
||||
cpu = (cpu1 - cpu0)/count_rate
|
||||
print *, 'loop lkji : ', cpu/dble(ii)
|
||||
|
||||
ii=0
|
||||
call system_clock(cpu0, count_rate, count_max)
|
||||
do jj=1,10
|
||||
do j=1,mo_tot_num
|
||||
do i=1,mo_tot_num
|
||||
do k=1,mo_tot_num
|
||||
do l=1,mo_tot_num
|
||||
ii += 1
|
||||
call get_mo_bielec_integral(i,j,k,l,mo_integrals_map)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
call system_clock(cpu1, count_rate, count_max)
|
||||
cpu = (cpu1 - cpu0)/count_rate
|
||||
print *, 'loop lkij : ', cpu/dble(ii)
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user