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

Removed all ipc between Fortran and OCaml

This commit is contained in:
Anthony Scemama 2016-10-18 23:31:20 +02:00
parent 360d38a41d
commit 1185d70be7
6 changed files with 23 additions and 31 deletions

View File

@ -678,9 +678,9 @@ let run ~port =
(** Debug input *) (** Debug input *)
Printf.sprintf "q:%d r:%d n:%d : %s\n%!" Printf.sprintf "q:%d r:%d n:%d : %s\n%!"
(Queuing_system.number_of_queued program_state.queue) (Queuing_system.number_of_queued program_state.queue)
(Queuing_system.number_of_running program_state.queue) (Queuing_system.number_of_running program_state.queue)
(Queuing_system.number_of_tasks program_state.queue) (Queuing_system.number_of_tasks program_state.queue)
(Message.to_string message) (Message.to_string message)
|> debug; |> debug;

View File

@ -134,7 +134,7 @@ subroutine ZMQ_selection(N_in, pt2)
step = int(5000000.d0 / dble(N_int * N_states * elec_num * elec_num * mo_tot_num * mo_tot_num )) step = int(5000000.d0 / dble(N_int * N_states * elec_num * elec_num * mo_tot_num * mo_tot_num ))
step = max(1,step) step = max(1,step)
do i= 1,N_det_generators, step do i= N_det_generators, 1, -step
i_generator_start = max(i-step+1,1) i_generator_start = max(i-step+1,1)
i_generator_max = i i_generator_max = i
write(task,*) i_generator_start, i_generator_max, 1, N write(task,*) i_generator_start, i_generator_max, 1, N

View File

@ -1043,23 +1043,23 @@ END_PROVIDER
if (rho_mrcc(i,s) == 0.d0) then if (rho_mrcc(i,s) == 0.d0) then
rho_mrcc(i,s) = 1.d-32 rho_mrcc(i,s) = 1.d-32
endif endif
! f is such that f.\tilde{c_i} = c_i ! f is such that f.\tilde{c_i} = c_i
f = psi_non_ref_coef(i,s) / rho_mrcc(i,s) f = psi_non_ref_coef(i,s) / rho_mrcc(i,s)
! Avoid numerical instabilities ! Avoid numerical instabilities
f = min(f,2.d0) f = min(f,2.d0)
f = max(f,-2.d0) f = max(f,-2.d0)
norm = norm + f*f *rho_mrcc(i,s)*rho_mrcc(i,s) norm = norm + f*f *rho_mrcc(i,s)*rho_mrcc(i,s)
rho_mrcc(i,s) = f rho_mrcc(i,s) = f
enddo enddo
! norm now contains the norm of |T.Psi_0> ! norm now contains the norm of |T.Psi_0>
! rho_mrcc now contains the f factors ! rho_mrcc now contains the f factors
f = 1.d0/norm f = 1.d0/norm
! f now contains 1/ <T.Psi_0|T.Psi_0> ! f now contains 1/ <T.Psi_0|T.Psi_0>
norm = 1.d0 norm = 1.d0
do i=1,N_det_ref do i=1,N_det_ref
norm = norm - psi_ref_coef(i,s)*psi_ref_coef(i,s) norm = norm - psi_ref_coef(i,s)*psi_ref_coef(i,s)
@ -1067,14 +1067,14 @@ END_PROVIDER
! norm now contains <Psi_SD|Psi_SD> ! norm now contains <Psi_SD|Psi_SD>
f = dsqrt(f*norm) f = dsqrt(f*norm)
! f normalises T.Psi_0 such that (1+T)|Psi> is normalized ! f normalises T.Psi_0 such that (1+T)|Psi> is normalized
norm = norm*f norm = norm*f
print *, 'norm of |T Psi_0> = ', dsqrt(norm) print *, 'norm of |T Psi_0> = ', dsqrt(norm)
do i=1,N_det_ref do i=1,N_det_ref
norm = norm + psi_ref_coef(i,s)*psi_ref_coef(i,s) norm = norm + psi_ref_coef(i,s)*psi_ref_coef(i,s)
enddo enddo
do i=1,N_det_non_ref do i=1,N_det_non_ref
rho_mrcc(i,s) = rho_mrcc(i,s) * f rho_mrcc(i,s) = rho_mrcc(i,s) * f
enddo enddo

View File

@ -554,7 +554,6 @@ END_PROVIDER
do k=1,N_det_non_ref do k=1,N_det_non_ref
call i_h_j(psi_ref(1,1,j), psi_non_ref(1,1,k),N_int,Hjk) call i_h_j(psi_ref(1,1,j), psi_non_ref(1,1,k),N_int,Hjk)
! call i_h_j(psi_non_ref(1,1,k),psi_ref(1,1,i), N_int,Hki)
delta_cas(i,j,i_state) += Hjk * dij(i, k, i_state) ! * Hki * lambda_mrcc(i_state, k) delta_cas(i,j,i_state) += Hjk * dij(i, k, i_state) ! * Hki * lambda_mrcc(i_state, k)
!print *, Hjk * get_dij(psi_ref(1,1,i), psi_non_ref(1,1,k), N_int), Hki * get_dij(psi_ref(1,1,j), psi_non_ref(1,1,k), N_int) !print *, Hjk * get_dij(psi_ref(1,1,i), psi_non_ref(1,1,k), N_int), Hki * get_dij(psi_ref(1,1,j), psi_non_ref(1,1,k), N_int)

View File

@ -501,7 +501,7 @@ subroutine davidson_miniserver_end()
integer rc integer rc
character*(64) buf character*(64) buf
address = trim(qp_run_address_tcp)//':11223' address = trim(qp_run_address)//':11223'
requester = f77_zmq_socket(zmq_context, ZMQ_REQ) requester = f77_zmq_socket(zmq_context, ZMQ_REQ)
rc = f77_zmq_connect(requester,address) rc = f77_zmq_connect(requester,address)
@ -520,7 +520,7 @@ subroutine davidson_miniserver_get()
character*(20) buffer character*(20) buffer
integer rc integer rc
address = trim(qp_run_address_tcp)//':11223' address = trim(qp_run_address)//':11223'
requester = f77_zmq_socket(zmq_context, ZMQ_REQ) requester = f77_zmq_socket(zmq_context, ZMQ_REQ)
rc = f77_zmq_connect(requester,address) rc = f77_zmq_connect(requester,address)

View File

@ -17,8 +17,6 @@ END_PROVIDER
BEGIN_PROVIDER [ character*(128), qp_run_address ] BEGIN_PROVIDER [ character*(128), qp_run_address ]
&BEGIN_PROVIDER [ character*(128), qp_run_address_ipc ]
&BEGIN_PROVIDER [ character*(128), qp_run_address_tcp ]
&BEGIN_PROVIDER [ integer, zmq_port_start ] &BEGIN_PROVIDER [ integer, zmq_port_start ]
use f77_zmq use f77_zmq
implicit none implicit none
@ -36,22 +34,19 @@ END_PROVIDER
integer :: i integer :: i
do i=len(buffer),1,-1 do i=len(buffer),1,-1
if ( buffer(i:i) == ':') then if ( buffer(i:i) == ':') then
qp_run_address_tcp = trim(buffer(1:i-1)) qp_run_address = trim(buffer(1:i-1))
read(buffer(i+1:), *) zmq_port_start read(buffer(i+1:), *) zmq_port_start
exit exit
endif endif
enddo enddo
qp_run_address_ipc = 'ipc:///tmp/qp_run'
qp_run_address = qp_run_address_ipc
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ character*(128), zmq_socket_pull_tcp_address ] BEGIN_PROVIDER [ character*(128), zmq_socket_pull_tcp_address ]
&BEGIN_PROVIDER [ character*(128), zmq_socket_pull_inproc_address ]
&BEGIN_PROVIDER [ character*(128), zmq_socket_pair_inproc_address ] &BEGIN_PROVIDER [ character*(128), zmq_socket_pair_inproc_address ]
&BEGIN_PROVIDER [ character*(128), zmq_socket_push_tcp_address ] &BEGIN_PROVIDER [ character*(128), zmq_socket_push_tcp_address ]
&BEGIN_PROVIDER [ character*(128), zmq_socket_pull_inproc_address ]
&BEGIN_PROVIDER [ character*(128), zmq_socket_push_inproc_address ] &BEGIN_PROVIDER [ character*(128), zmq_socket_push_inproc_address ]
&BEGIN_PROVIDER [ character*(128), zmq_socket_sub_address ] &BEGIN_PROVIDER [ character*(128), zmq_socket_sub_tcp_address ]
use f77_zmq use f77_zmq
implicit none implicit none
BEGIN_DOC BEGIN_DOC
@ -59,12 +54,12 @@ END_PROVIDER
END_DOC END_DOC
character*(8), external :: zmq_port character*(8), external :: zmq_port
zmq_socket_sub_tcp_address = trim(qp_run_address)//':'//zmq_port(1)//' '
zmq_socket_pull_tcp_address = 'tcp://*:'//zmq_port(2)//' ' zmq_socket_pull_tcp_address = 'tcp://*:'//zmq_port(2)//' '
zmq_socket_push_tcp_address = trim(qp_run_address)//':'//zmq_port(2)//' '
zmq_socket_pull_inproc_address = 'inproc://'//zmq_port(2)//' ' zmq_socket_pull_inproc_address = 'inproc://'//zmq_port(2)//' '
zmq_socket_pair_inproc_address = 'inproc://'//zmq_port(3)//' '
zmq_socket_push_tcp_address = trim(qp_run_address_tcp)//':'//zmq_port(2)//' '
zmq_socket_push_inproc_address = zmq_socket_pull_inproc_address zmq_socket_push_inproc_address = zmq_socket_pull_inproc_address
zmq_socket_sub_address = trim(qp_run_address)//':'//zmq_port(1)//' ' zmq_socket_pair_inproc_address = 'inproc://'//zmq_port(3)//' '
! /!\ Don't forget to change subroutine reset_zmq_addresses ! /!\ Don't forget to change subroutine reset_zmq_addresses
END_PROVIDER END_PROVIDER
@ -77,13 +72,12 @@ subroutine reset_zmq_addresses
END_DOC END_DOC
character*(8), external :: zmq_port character*(8), external :: zmq_port
zmq_socket_sub_tcp_address = trim(qp_run_address)//':'//zmq_port(1)//' '
zmq_socket_pull_tcp_address = 'tcp://*:'//zmq_port(2)//' ' zmq_socket_pull_tcp_address = 'tcp://*:'//zmq_port(2)//' '
zmq_socket_push_tcp_address = trim(qp_run_address)//':'//zmq_port(2)//' '
zmq_socket_pull_inproc_address = 'inproc://'//zmq_port(2)//' ' zmq_socket_pull_inproc_address = 'inproc://'//zmq_port(2)//' '
zmq_socket_pair_inproc_address = 'inproc://'//zmq_port(3)//' '
zmq_socket_push_tcp_address = trim(qp_run_address_tcp)//':'//zmq_port(2)//' '
zmq_socket_push_inproc_address = zmq_socket_pull_inproc_address zmq_socket_push_inproc_address = zmq_socket_pull_inproc_address
zmq_socket_sub_address = trim(qp_run_address)//':'//zmq_port(1)//' ' zmq_socket_pair_inproc_address = 'inproc://'//zmq_port(3)//' '
end end
@ -111,7 +105,6 @@ subroutine switch_qp_run_to_master
exit exit
endif endif
enddo enddo
qp_run_address_tcp = qp_run_address
call reset_zmq_addresses call reset_zmq_addresses
end end
@ -374,7 +367,7 @@ function new_zmq_sub_socket()
stop 'Unable to subscribe new_zmq_sub_socket' stop 'Unable to subscribe new_zmq_sub_socket'
endif endif
rc = f77_zmq_connect(new_zmq_sub_socket, zmq_socket_sub_address) rc = f77_zmq_connect(new_zmq_sub_socket, zmq_socket_sub_tcp_address)
if (rc /= 0) then if (rc /= 0) then
stop 'Unable to connect new_zmq_sub_socket' stop 'Unable to connect new_zmq_sub_socket'
endif endif