From 3bd401513dc7ac28b1b0ec0037d5096ece333ed9 Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Mon, 1 Aug 2016 17:15:03 +0200 Subject: [PATCH] Bugs --- plugins/Full_CI_ZMQ/selection.irp.f | 7 +++---- plugins/Full_CI_ZMQ/selection_slave.irp.f | 12 ++++-------- src/ZMQ/utils.irp.f | 5 +++-- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/plugins/Full_CI_ZMQ/selection.irp.f b/plugins/Full_CI_ZMQ/selection.irp.f index 0cf7e576..b26b3e1b 100644 --- a/plugins/Full_CI_ZMQ/selection.irp.f +++ b/plugins/Full_CI_ZMQ/selection.irp.f @@ -62,9 +62,9 @@ subroutine selection_slaved(thread,iproc) !print *, "psi_selectors_coef ", psi_selectors_coef(N_det_selectors-5:N_det_selectors, 1) !call debug_det(psi_selectors(1,1,N_det_selectors), N_int) call select_connected(i_generator,ci_electronic_energy,pt2,buf) - end if - - if(done) ctask = ctask - 1 + else + ctask = ctask - 1 + endif if(done .or. ctask == size(task_id)) then if(buf%N == 0 .and. ctask > 0) stop "uninitialized selection_buffer" @@ -77,7 +77,6 @@ subroutine selection_slaved(thread,iproc) buf%cur = 0 end if - ctask = 0 end if diff --git a/plugins/Full_CI_ZMQ/selection_slave.irp.f b/plugins/Full_CI_ZMQ/selection_slave.irp.f index fd7728f7..db18ca59 100644 --- a/plugins/Full_CI_ZMQ/selection_slave.irp.f +++ b/plugins/Full_CI_ZMQ/selection_slave.irp.f @@ -31,17 +31,14 @@ subroutine run_wf call provide_everything zmq_context = f77_zmq_ctx_new () + zmq_state = 'selection' + state = 'Waiting' zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() do - call wait_for_state("selection", zmq_state) - if(trim(zmq_state) /= "selection") exit - if(oki < 0) then - oki += 1 - cycle - end if - oki = 0 + call wait_for_state(zmq_state,state) + if(trim(state) /= 'selection') exit print *, 'Getting wave function' call zmq_get_psi(zmq_to_qp_run_socket,1,energy,size(energy)) integer :: j,k @@ -59,7 +56,6 @@ subroutine run_wf endif call write_double(6,ci_energy,'Energy') - !zmq_state = 'selection' integer :: rc, i diff --git a/src/ZMQ/utils.irp.f b/src/ZMQ/utils.irp.f index 6b22158e..4a6085e2 100644 --- a/src/ZMQ/utils.irp.f +++ b/src/ZMQ/utils.irp.f @@ -872,8 +872,8 @@ subroutine wait_for_state(state_wait,state) integer :: rc zmq_socket_sub = new_zmq_sub_socket() - state = "Waiting" - do while (trim(state) /= trim(state_wait) .and. trim(state) /= "Stopped") + state = 'Waiting' + do while (trim(state) /= trim(state_wait) .and. trim(state) /= 'Stopped') rc = f77_zmq_recv( zmq_socket_sub, state, 64, 0) if (rc > 0) then state = trim(state(1:rc)) @@ -881,6 +881,7 @@ subroutine wait_for_state(state_wait,state) print *, 'Timeout reached. Stopping' state = "Stopped" endif +print *, '|'//trim(state(1:rc))//'|'//trim(state_wait)//'|' end do call end_zmq_sub_socket(zmq_socket_sub) end