10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-22 20:35:19 +01:00

in progress - iterations

This commit is contained in:
Yann Garniron 2016-07-13 18:12:25 +02:00
parent 32e911cea8
commit 6f63767823
6 changed files with 69 additions and 52 deletions

2
configure vendored
View File

@ -142,7 +142,7 @@ ezfio = Info(
default_path=join(QP_ROOT_INSTALL, "EZFIO")) default_path=join(QP_ROOT_INSTALL, "EZFIO"))
zeromq = Info( zeromq = Info(
url='http://download.zeromq.org/zeromq-4.0.7.tar.gz', url='https://github.com/zeromq/zeromq4-1/releases/download/v4.1.5/zeromq-4.1.5.tar.gz',
description=' ZeroMQ', description=' ZeroMQ',
default_path=join(QP_ROOT_LIB, "libzmq.a")) default_path=join(QP_ROOT_LIB, "libzmq.a"))

View File

@ -15,14 +15,14 @@ function _install()
./configure --without-libsodium || exit 1 ./configure --without-libsodium || exit 1
make -j 8 || exit 1 make -j 8 || exit 1
rm -f -- "${QP_ROOT}"/lib/libzmq.a "${QP_ROOT}"/lib/libzmq.so "${QP_ROOT}"/lib/libzmq.so.? rm -f -- "${QP_ROOT}"/lib/libzmq.a "${QP_ROOT}"/lib/libzmq.so "${QP_ROOT}"/lib/libzmq.so.?
# cp .libs/libzmq.a "${QP_ROOT}"/lib cp .libs/libzmq.a "${QP_ROOT}"/lib
# cp .libs/libzmq.so "${QP_ROOT}"/lib/libzmq.so.5 cp .libs/libzmq.so "${QP_ROOT}"/lib/libzmq.so.5
cp src/.libs/libzmq.a "${QP_ROOT}"/lib # cp src/.libs/libzmq.a "${QP_ROOT}"/lib
cp src/.libs/libzmq.so "${QP_ROOT}"/lib/libzmq.so.4 # cp src/.libs/libzmq.so "${QP_ROOT}"/lib/libzmq.so.4
cp include/{zmq.h,zmq_utils.h} "${QP_ROOT}"/lib cp include/{zmq.h,zmq_utils.h} "${QP_ROOT}"/lib
cd "${QP_ROOT}"/lib cd "${QP_ROOT}"/lib
# ln -s libzmq.so.5 libzmq.so ln -s libzmq.so.5 libzmq.so
ln -s libzmq.so.4 libzmq.so # ln -s libzmq.so.4 libzmq.so
cd ${ORIG} cd ${ORIG}
return 0 return 0
} }

View File

@ -9,10 +9,13 @@ program Full_CI_ZMQ
integer :: i,ithread integer :: i,ithread
integer(ZMQ_PTR) :: zmq_socket_push integer(ZMQ_PTR) :: zmq_socket_push
integer(ZMQ_PTR) :: new_zmq_push_socket integer(ZMQ_PTR), external :: new_zmq_push_socket
zmq_context = f77_zmq_ctx_new () zmq_context = f77_zmq_ctx_new ()
PROVIDE H_apply_buffer_allocated
! do while (N_det < N_det_max)
PROVIDE ci_electronic_energy
PROVIDE nproc PROVIDE nproc
!$OMP PARALLEL PRIVATE(i,ithread,zmq_socket_push) num_threads(nproc+1) !$OMP PARALLEL PRIVATE(i,ithread,zmq_socket_push) num_threads(nproc+1)
ithread = omp_get_thread_num() ithread = omp_get_thread_num()
@ -23,12 +26,10 @@ program Full_CI_ZMQ
do i=ithread,N_det_generators,nproc do i=ithread,N_det_generators,nproc
print *, i , "/", N_det_generators print *, i , "/", N_det_generators
!!$OMP TASK DEFAULT(SHARED) call select_connected(i, 1.d-7, ci_electronic_energy,zmq_socket_push)
call select_connected(i, 1.d-6, ci_electronic_energy,zmq_socket_push)
!!$OMP END TASK
enddo enddo
!!$OMP TASKWAIT
print *, "END .... " print *, "END .... "
if (ithread == 1) then if (ithread == 1) then
integer :: rc integer :: rc
rc = f77_zmq_send(zmq_socket_push,0,1,0) rc = f77_zmq_send(zmq_socket_push,0,1,0)
@ -36,10 +37,12 @@ program Full_CI_ZMQ
stop 'Error sending termination signal' stop 'Error sending termination signal'
endif endif
endif endif
call end_zmq_push_socket(zmq_socket_push) call end_zmq_push_socket(zmq_socket_push, 0)
endif endif
!$OMP END PARALLEL !$OMP END PARALLEL
call copy_H_apply_buffer_to_wf()
call diagonalize_CI
call save_wavefunction()
! end do
end end

View File

@ -17,6 +17,9 @@ subroutine select_connected(i_generator,thr,E0,zmq_socket_push)
double precision :: fock_diag_tmp(2,mo_tot_num+1) double precision :: fock_diag_tmp(2,mo_tot_num+1)
! print *, i_generator, "MM"
! return
call build_fock_tmp(fock_diag_tmp,psi_det_generators(1,1,i_generator),N_int) call build_fock_tmp(fock_diag_tmp,psi_det_generators(1,1,i_generator),N_int)
integer :: k,l integer :: k,l
@ -49,20 +52,22 @@ subroutine receive_selected_determinants()
! Receive via ZMQ the selected determinants ! Receive via ZMQ the selected determinants
END_DOC END_DOC
integer(ZMQ_PTR) :: zmq_socket_pull integer(ZMQ_PTR) :: zmq_socket_pull
integer(ZMQ_PTR) :: new_zmq_pull_socket integer(ZMQ_PTR), external :: new_zmq_pull_socket
integer(bit_kind) :: received_det(N_int,2), shtak(N_int, 2, 100000) integer(bit_kind) :: received_det(N_int,2), shtak(N_int, 2, 100)
integer :: msg_size, rc integer :: msg_size, rc
integer :: acc, tac, j integer :: acc, tac, j, robin
logical, external :: detEq logical, external :: detEq, is_in_wavefunction
acc = 0 acc = 0
tac = 0 tac = 0
robin = 0
msg_size = bit_kind*N_int*2 msg_size = bit_kind*N_int*2
zmq_socket_pull = new_zmq_pull_socket() zmq_socket_pull = new_zmq_pull_socket()
grab : do while (f77_zmq_recv(zmq_socket_pull, received_det, msg_size, 0) == msg_size) grab : do while (f77_zmq_recv(zmq_socket_pull, received_det, msg_size, 0) == msg_size)
tac += 1 tac += 1
if (is_in_wavefunction(received_det,N_int)) stop "???..."
do j=1,acc do j=1,acc
if(detEq(received_det, shtak(1,1,j), N_int)) then if(detEq(received_det, shtak(1,1,j), N_int)) then
cycle grab cycle grab
@ -70,12 +75,21 @@ subroutine receive_selected_determinants()
end do end do
acc += 1 acc += 1
shtak(:,:,acc) = received_det shtak(:,:,acc) = received_det
print *, acc, size(shtak, 3)
if(acc == size(shtak, 3)) then
print *, robin, nproc
call fill_H_apply_buffer_no_selection(acc,shtak,N_int,robin)
acc = 0
robin += 1
if(robin == nproc) robin = 0
end if
call debug_det(received_det,N_int) call debug_det(received_det,N_int)
print *, "tot ", acc, tac print *, "tot ", acc, tac
end do grab end do grab
print *, "tot ", acc, tac print *, "tot ", acc, tac
call fill_H_apply_buffer_no_selection(acc,shtak,N_int,robin)
call end_zmq_pull_socket(zmq_socket_pull) call end_zmq_pull_socket(zmq_socket_pull)
end end
subroutine select_singles(i_generator,thr,hole_mask,particle_mask,fock_diag_tmp,E0,zmq_socket_push) subroutine select_singles(i_generator,thr,hole_mask,particle_mask,fock_diag_tmp,E0,zmq_socket_push)

View File

@ -192,7 +192,7 @@ subroutine copy_H_apply_buffer_to_wf
SOFT_TOUCH N_det psi_det psi_coef SOFT_TOUCH N_det psi_det psi_coef
logical :: found_duplicates logical :: found_duplicates
call remove_duplicates_in_psi_det(found_duplicates) !call remove_duplicates_in_psi_det(found_duplicates)
end end
subroutine remove_duplicates_in_psi_det(found_duplicates) subroutine remove_duplicates_in_psi_det(found_duplicates)

View File

@ -347,19 +347,19 @@ subroutine end_zmq_pull_socket(zmq_socket_pull)
integer :: rc integer :: rc
character*(8), external :: zmq_port character*(8), external :: zmq_port
rc = f77_zmq_unbind(zmq_socket_pull,zmq_socket_pull_inproc_address) ! rc = f77_zmq_unbind(zmq_socket_pull,zmq_socket_pull_inproc_address)
! if (rc /= 0) then ! if (rc /= 0) then
! print *, rc ! print *, rc
! print *, irp_here, 'f77_zmq_unbind(zmq_socket_pull,zmq_socket_pull_inproc_address)' ! print *, irp_here, 'f77_zmq_unbind(zmq_socket_pull,zmq_socket_pull_inproc_address)'
! stop 'error' ! stop 'error'
! endif ! endif
rc = f77_zmq_unbind(zmq_socket_pull,zmq_socket_pull_tcp_address) ! rc = f77_zmq_unbind(zmq_socket_pull,zmq_socket_pull_tcp_address)
if (rc /= 0) then ! if (rc /= 0) then
print *, rc ! print *, rc
print *, irp_here, 'f77_zmq_unbind(zmq_socket_pull,zmq_socket_pull_tcp_address)' ! print *, irp_here, 'f77_zmq_unbind(zmq_socket_pull,zmq_socket_pull_tcp_address)'
stop 'error' ! stop 'error'
endif ! endif
call sleep(1) ! see https://github.com/zeromq/libzmq/issues/1922 call sleep(1) ! see https://github.com/zeromq/libzmq/issues/1922