From c22289ece563c86e0679ae8637572ef0df410de3 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 10 Apr 2017 16:21:35 +0200 Subject: [PATCH] Delay in zmq --- plugins/CAS_SD_ZMQ/selection.irp.f | 1 + src/ZMQ/utils.irp.f | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/plugins/CAS_SD_ZMQ/selection.irp.f b/plugins/CAS_SD_ZMQ/selection.irp.f index bdce5df5..e1d786c7 100644 --- a/plugins/CAS_SD_ZMQ/selection.irp.f +++ b/plugins/CAS_SD_ZMQ/selection.irp.f @@ -1254,6 +1254,7 @@ subroutine ZMQ_selection(N_in, pt2) if (i==0) then call selection_collector(b, pt2) else + call sleep(.1) call selection_slave_inproc(i) endif !$OMP END PARALLEL diff --git a/src/ZMQ/utils.irp.f b/src/ZMQ/utils.irp.f index 5603809b..3a7fd25d 100644 --- a/src/ZMQ/utils.irp.f +++ b/src/ZMQ/utils.irp.f @@ -407,7 +407,9 @@ subroutine end_zmq_sub_socket(zmq_socket_sub) integer(ZMQ_PTR), intent(in) :: zmq_socket_sub integer :: rc + call omp_set_lock(zmq_lock) rc = f77_zmq_close(zmq_socket_sub) + call omp_unset_lock(zmq_lock) if (rc /= 0) then print *, 'f77_zmq_close(zmq_socket_sub)' stop 'error' @@ -426,7 +428,9 @@ subroutine end_zmq_pair_socket(zmq_socket_pair) integer :: rc character*(8), external :: zmq_port + call omp_set_lock(zmq_lock) rc = f77_zmq_close(zmq_socket_pair) + call omp_unset_lock(zmq_lock) if (rc /= 0) then print *, 'f77_zmq_close(zmq_socket_pair)' stop 'error' @@ -444,7 +448,9 @@ subroutine end_zmq_pull_socket(zmq_socket_pull) integer :: rc character*(8), external :: zmq_port + call omp_set_lock(zmq_lock) rc = f77_zmq_close(zmq_socket_pull) + call omp_unset_lock(zmq_lock) if (rc /= 0) then print *, 'f77_zmq_close(zmq_socket_pull)' stop 'error' @@ -469,7 +475,9 @@ subroutine end_zmq_push_socket(zmq_socket_push,thread) stop 'Unable to set ZMQ_LINGER on push socket' endif + call omp_set_lock(zmq_lock) rc = f77_zmq_close(zmq_socket_push) + call omp_unset_lock(zmq_lock) if (rc /= 0) then print *, 'f77_zmq_close(zmq_socket_push)' stop 'error' @@ -500,10 +508,12 @@ subroutine new_parallel_job(zmq_to_qp_run_socket,name_in) integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket integer(ZMQ_PTR), intent(out) :: zmq_to_qp_run_socket + call omp_set_lock(zmq_lock) zmq_context = f77_zmq_ctx_new () if (zmq_context == 0_ZMQ_PTR) then stop 'ZMQ_PTR is null' endif + call omp_unset_lock(zmq_lock) ! rc = f77_zmq_ctx_set(zmq_context, ZMQ_IO_THREADS, nproc) ! if (rc /= 0) then ! print *, 'Unable to set the number of ZMQ IO threads to', nproc