10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-04 05:03:54 +01:00
quantum_package/plugins/Full_CI_ZMQ/run_selection_slave.irp.f

225 lines
6.5 KiB
Fortran
Raw Normal View History

2016-09-01 14:43:13 +02:00
subroutine run_selection_slave(thread,iproc,energy)
use f77_zmq
use selection_types
implicit none
2016-11-16 21:28:10 +01:00
double precision, intent(in) :: energy(N_states)
2016-09-01 14:43:13 +02:00
integer, intent(in) :: thread, iproc
integer :: rc, i
integer :: worker_id, task_id(1), ctask, ltask
character*(512) :: task
integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
integer(ZMQ_PTR), external :: new_zmq_push_socket
integer(ZMQ_PTR) :: zmq_socket_push
type(selection_buffer) :: buf, buf2
2017-11-26 11:09:03 +01:00
logical :: done, buffer_ready
2016-09-01 14:43:13 +02:00
double precision :: pt2(N_states)
2017-05-15 12:33:41 +02:00
PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_order psi_bilinear_matrix_order
PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns
PROVIDE psi_bilinear_matrix_transp_order
2016-09-01 14:43:13 +02:00
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
2017-11-29 15:15:10 +01:00
integer, external :: connect_to_taskserver
if (connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) == -1) then
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
2016-09-01 14:43:13 +02:00
return
2017-11-29 15:15:10 +01:00
endif
zmq_socket_push = new_zmq_push_socket(thread)
2016-09-01 14:43:13 +02:00
buf%N = 0
2017-11-26 11:09:03 +01:00
buffer_ready = .False.
2016-09-01 14:43:13 +02:00
ctask = 1
2017-11-23 10:35:13 +01:00
pt2(:) = 0d0
2016-09-01 14:43:13 +02:00
do
2017-11-29 15:15:10 +01:00
integer, external :: get_task_from_taskserver
if (get_task_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id(ctask), task) == -1) then
exit
endif
2016-09-01 14:43:13 +02:00
done = task_id(ctask) == 0
if (done) then
ctask = ctask - 1
else
2018-05-23 13:49:37 +02:00
integer :: i_generator, N, subset
read(task,*) subset, i_generator, N
2016-09-01 14:43:13 +02:00
if(buf%N == 0) then
! Only first time
call create_selection_buffer(N, N*2, buf)
2017-04-19 15:31:12 +02:00
call create_selection_buffer(N, N*2, buf2)
2017-11-26 11:09:03 +01:00
buffer_ready = .True.
2016-09-01 14:43:13 +02:00
else
2017-05-18 14:11:22 +02:00
ASSERT (N == buf%N)
2016-09-01 14:43:13 +02:00
end if
Squashed commit of the following: commit 96715abd7bc0645b994fc4fff1c764e7bec3042e Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr> Date: Thu Sep 6 12:08:34 2018 +0200 Tasks commit e43b1e2faff5ad1ec4ecd2eb99e8d86e0000a9a2 Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr> Date: Thu Sep 6 11:47:02 2018 +0200 Fixed print commit c498c8944b5695b953909711a2e9a542e1bc6015 Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr> Date: Thu Sep 6 11:11:51 2018 +0200 PT2 and shiftedBk fixed commit 965cf0361d54df096c9bfca93f9d50ecd946c198 Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr> Date: Wed Sep 5 18:48:59 2018 +0200 Shifted Bk multistate broken commit 87ef641b65a122fa1256605cbe098c1a0de04bc0 Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr> Date: Wed Sep 5 17:23:38 2018 +0200 PT2 fixed commit a2adb533bcaf96191a24ff5fcef86cd14ac00697 Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr> Date: Wed Sep 5 16:55:05 2018 +0200 Working on PT2 (broken) commit 33f52991b65ac42ced5521ef0e713df765268860 Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr> Date: Wed Sep 5 12:13:23 2018 +0200 Fixed missing argument commit 712bf75f76421880299dc65b30acfda3d531f709 Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr> Date: Wed Sep 5 11:42:31 2018 +0200 Fixed floating invalid in PT2 commit cf2412ebd99f9acf573a5180603611f1c3e35155 Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr> Date: Wed Sep 5 11:34:37 2018 +0200 n_states_diag >= n_states commit bb415435e4d9be72a285ec789c3d63046a9173e4 Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr> Date: Wed Sep 5 11:23:41 2018 +0200 Fixed final print commit f2d339cf7b3535359bfc9d3057225b5957cf9e16 Merge: cfa8e1dc 52ca18c1 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 20:51:14 2018 +0200 Merge branch 'thesis' of ssh://github.com/garniron/quantum_package into thesis commit cfa8e1dc34c78f666aad677d2362a0b23e738e55 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 20:50:09 2018 +0200 restored relative_error commit bccad69c7785d79eb079bd15cd8d7143503ba9b5 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 20:47:11 2018 +0200 uninitialized variable commit 52ca18c1525cbe51f290813a4706928f227af142 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 20:47:11 2018 +0200 uninitialized variable commit ba0094f5f88153da295f479568bea9c6f494098c Merge: 093e3fd0 68458296 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 20:07:15 2018 +0200 merge with garniroy commit 68458296dcc86c57bab25582e138ae057a66f019 Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr> Date: Tue Sep 4 18:43:39 2018 +0200 Almost working but still broken commit 9ebb88cbf32eed90ed2c1ff985128f271bcc1c15 Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr> Date: Tue Sep 4 18:05:00 2018 +0200 Cleaning commit 873035e01635a1a0576cc0e8bf834beb3c60fc80 Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr> Date: Tue Sep 4 17:31:45 2018 +0200 Squashed commit of the following: commit 4b9c435dce0f3b3078d573e66fd32b40fca26497 Merge: 74e559c8 093e3fd0 Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr> Date: Tue Sep 4 16:58:51 2018 +0200 Merge branch 'thesis' of git://github.com/garniron/quantum_package into garniron-thesis commit 093e3fd021ca5ed73fe3be530fa18e79ceb0085e Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 16:13:00 2018 +0200 removed ungodly hack commit 8529a0f3f66d2f1ba9d717b0de60b268a4a821a7 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 14:57:19 2018 +0200 reduced prints in pt2_stoch commit 03b8f353bd94b837c02e570a8d3fb68689003135 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 14:41:46 2018 +0200 teeth building check for pt2_stoch commit 0d91b9310a7d580e8bc97a6a0af7a62a8506f8c0 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 14:35:04 2018 +0200 timestamp of first pull commit 34d9fa01657ed5d159a1c62f8f24cdb266d48153 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 14:27:10 2018 +0200 potential numerical precision bug commit 9a0f900d8c57bcbca36a09c11616e234528e1643 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 14:09:51 2018 +0200 tests if teeth can be built commit dda0dc34df82a59fac3c3abb2b14943fdb23c0f8 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Mon Sep 3 17:48:04 2018 +0200 corrected pt2_find_sample commit a521f0cb82bd333ce9879b4dfd87ae1abcf2baaa Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Mon Sep 3 16:08:02 2018 +0200 tasks get by batches of Nproc commit 997a5a1265951394753d3154a6136ca40177ba8d Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Mon Sep 3 14:18:04 2018 +0200 buffered task_id send commit 99ea7948e0d58023f7ce02386014c8c3d493deb4 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Mon Sep 3 12:29:12 2018 +0200 unbalanced fragmentation commit abb3b7e08bebdcaf84208ebbe404441d3571b1f9 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Sun Sep 2 17:18:44 2018 +0200 overflow of pt2_J commit 8df49f394b588ca304ce2ee7d8f8095455573784 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Sun Sep 2 15:58:48 2018 +0200 removed useless computation of intermediate checkpoints commit 4ba5b79eb391819a4966c7cd19b2e2fdf2ed5129 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Sun Sep 2 15:50:14 2018 +0200 dressing only sent for chosen checkpoint commit a4a6a69459321b1b210c2f51ffbef4f792943919 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Sat Sep 1 17:01:56 2018 +0200 cumulative dot_F commit 6a7f04cb79ec921d5829a011aa8d8b2ea224760d Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Sat Sep 1 16:58:07 2018 +0200 simpler purge commit 168ca2f2e29b902ab37afc58672b678998f0212a Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Fri Aug 31 21:07:01 2018 +0200 task list optimized commit de4a0d0caf0e1d441e0244a9ba7c65ae535d58b1 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Fri Aug 31 18:57:03 2018 +0200 removed print commit fee31d4e3e70c2edf1aeda202d3f067eddc17532 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Fri Aug 31 18:56:23 2018 +0200 dress fragmentation commit 02893a419de07c922708fe8ee2b828d9ebfd2e9b Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Fri Aug 31 15:52:16 2018 +0200 bug in blocked search - replaced with thesis version commit bb6e073cf10039f8a333d120b88dda109169528b Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Thu Aug 30 21:24:45 2018 +0200 ungodly hack to prevent double providing commit 0609e8c627ea7bf88d617e45dffeb64c9aea37b6 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Thu Aug 30 20:52:05 2018 +0200 debugging commit a254fdd7cffd8348846c910f240965104c969a09 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Thu Aug 30 15:24:07 2018 +0200 parallel bug commit 2a6c1941d45be78083ec8c1dccb453f51a12c338 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Thu Aug 30 11:43:11 2018 +0200 corrected when relative_error=0d0 commit bac039bdf1bd00673c0795b1cb23adb593e9d426 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Thu Aug 30 10:58:17 2018 +0200 relative error 1d-5 commit aae9d203ecbf8d53accc6bc35c2ab56aeeae78a6 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Thu Aug 30 10:07:02 2018 +0200 potential fragmentation bug commit ad69f39f99d0b0dd73f556fb13d1d55337c5b066 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Wed Aug 29 20:54:58 2018 +0200 dress_zmq re-implemented commit d78f64732a5493d7f10c7c80b564005e63a133fc Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Wed Aug 29 11:30:19 2018 +0200 pt2_stoch re-implemented commit 4b9b54e19ac7459589681e5ff7aa358dde9f5fd5 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Aug 28 10:24:38 2018 +0200 removed test for phase_mask_bit commit 3abccca5e35948e54a659cacccea42fbfcf4c296 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Fri Aug 3 23:44:05 2018 +0200 phasemask_bit commit 093e3fd021ca5ed73fe3be530fa18e79ceb0085e Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 16:13:00 2018 +0200 removed ungodly hack commit 8529a0f3f66d2f1ba9d717b0de60b268a4a821a7 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 14:57:19 2018 +0200 reduced prints in pt2_stoch commit 03b8f353bd94b837c02e570a8d3fb68689003135 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 14:41:46 2018 +0200 teeth building check for pt2_stoch commit 0d91b9310a7d580e8bc97a6a0af7a62a8506f8c0 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 14:35:04 2018 +0200 timestamp of first pull commit 34d9fa01657ed5d159a1c62f8f24cdb266d48153 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 14:27:10 2018 +0200 potential numerical precision bug commit 9a0f900d8c57bcbca36a09c11616e234528e1643 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Sep 4 14:09:51 2018 +0200 tests if teeth can be built commit dda0dc34df82a59fac3c3abb2b14943fdb23c0f8 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Mon Sep 3 17:48:04 2018 +0200 corrected pt2_find_sample commit a521f0cb82bd333ce9879b4dfd87ae1abcf2baaa Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Mon Sep 3 16:08:02 2018 +0200 tasks get by batches of Nproc commit 997a5a1265951394753d3154a6136ca40177ba8d Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Mon Sep 3 14:18:04 2018 +0200 buffered task_id send commit 99ea7948e0d58023f7ce02386014c8c3d493deb4 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Mon Sep 3 12:29:12 2018 +0200 unbalanced fragmentation commit abb3b7e08bebdcaf84208ebbe404441d3571b1f9 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Sun Sep 2 17:18:44 2018 +0200 overflow of pt2_J commit 8df49f394b588ca304ce2ee7d8f8095455573784 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Sun Sep 2 15:58:48 2018 +0200 removed useless computation of intermediate checkpoints commit 4ba5b79eb391819a4966c7cd19b2e2fdf2ed5129 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Sun Sep 2 15:50:14 2018 +0200 dressing only sent for chosen checkpoint commit a4a6a69459321b1b210c2f51ffbef4f792943919 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Sat Sep 1 17:01:56 2018 +0200 cumulative dot_F commit 6a7f04cb79ec921d5829a011aa8d8b2ea224760d Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Sat Sep 1 16:58:07 2018 +0200 simpler purge commit 168ca2f2e29b902ab37afc58672b678998f0212a Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Fri Aug 31 21:07:01 2018 +0200 task list optimized commit de4a0d0caf0e1d441e0244a9ba7c65ae535d58b1 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Fri Aug 31 18:57:03 2018 +0200 removed print commit fee31d4e3e70c2edf1aeda202d3f067eddc17532 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Fri Aug 31 18:56:23 2018 +0200 dress fragmentation commit 02893a419de07c922708fe8ee2b828d9ebfd2e9b Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Fri Aug 31 15:52:16 2018 +0200 bug in blocked search - replaced with thesis version commit bb6e073cf10039f8a333d120b88dda109169528b Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Thu Aug 30 21:24:45 2018 +0200 ungodly hack to prevent double providing commit 0609e8c627ea7bf88d617e45dffeb64c9aea37b6 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Thu Aug 30 20:52:05 2018 +0200 debugging commit a254fdd7cffd8348846c910f240965104c969a09 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Thu Aug 30 15:24:07 2018 +0200 parallel bug commit 2a6c1941d45be78083ec8c1dccb453f51a12c338 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Thu Aug 30 11:43:11 2018 +0200 corrected when relative_error=0d0 commit bac039bdf1bd00673c0795b1cb23adb593e9d426 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Thu Aug 30 10:58:17 2018 +0200 relative error 1d-5 commit aae9d203ecbf8d53accc6bc35c2ab56aeeae78a6 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Thu Aug 30 10:07:02 2018 +0200 potential fragmentation bug commit ad69f39f99d0b0dd73f556fb13d1d55337c5b066 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Wed Aug 29 20:54:58 2018 +0200 dress_zmq re-implemented commit d78f64732a5493d7f10c7c80b564005e63a133fc Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Wed Aug 29 11:30:19 2018 +0200 pt2_stoch re-implemented commit 4b9b54e19ac7459589681e5ff7aa358dde9f5fd5 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Tue Aug 28 10:24:38 2018 +0200 removed test for phase_mask_bit commit 3abccca5e35948e54a659cacccea42fbfcf4c296 Author: Yann Garniron <yann.garniron@yahoo.fr> Date: Fri Aug 3 23:44:05 2018 +0200 phasemask_bit
2018-09-06 15:19:51 +02:00
call select_connected(i_generator,energy,pt2,buf,subset,pt2_F(i_generator))
2016-09-01 14:43:13 +02:00
endif
2017-11-29 15:15:10 +01:00
integer, external :: task_done_to_taskserver
2016-09-01 14:43:13 +02:00
if(done .or. ctask == size(task_id)) then
do i=1, ctask
2017-11-29 15:15:10 +01:00
if (task_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id(i)) == -1) then
call sleep(1)
if (task_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id(i)) == -1) then
ctask = 0
done = .true.
exit
endif
endif
2016-09-01 14:43:13 +02:00
end do
if(ctask > 0) then
2017-05-05 11:32:17 +02:00
call sort_selection_buffer(buf)
call merge_selection_buffers(buf,buf2)
2017-05-10 21:33:53 +02:00
call push_selection_results(zmq_socket_push, pt2, buf, task_id(1), ctask)
2016-09-01 14:43:13 +02:00
buf%mini = buf2%mini
2017-11-23 10:35:13 +01:00
pt2(:) = 0d0
2016-09-01 14:43:13 +02:00
buf%cur = 0
end if
ctask = 0
end if
if(done) exit
ctask = ctask + 1
end do
2017-11-29 15:15:10 +01:00
integer, external :: disconnect_from_taskserver
2017-12-05 18:54:10 +01:00
if (disconnect_from_taskserver(zmq_to_qp_run_socket,worker_id) == -1) then
2017-11-29 15:15:10 +01:00
continue
endif
2016-09-01 14:43:13 +02:00
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
call end_zmq_push_socket(zmq_socket_push,thread)
2017-11-26 11:09:03 +01:00
if (buffer_ready) then
2017-05-05 15:54:08 +02:00
call delete_selection_buffer(buf)
call delete_selection_buffer(buf2)
endif
2016-09-01 14:43:13 +02:00
end subroutine
subroutine push_selection_results(zmq_socket_push, pt2, b, task_id, ntask)
use f77_zmq
use selection_types
implicit none
integer(ZMQ_PTR), intent(in) :: zmq_socket_push
double precision, intent(in) :: pt2(N_states)
type(selection_buffer), intent(inout) :: b
integer, intent(in) :: ntask, task_id(*)
integer :: rc
2017-05-10 22:09:53 +02:00
2017-05-11 10:56:33 +02:00
rc = f77_zmq_send( zmq_socket_push, b%cur, 4, ZMQ_SNDMORE)
2017-05-10 22:09:53 +02:00
if(rc /= 4) then
2017-05-11 10:56:33 +02:00
print *, 'f77_zmq_send( zmq_socket_push, b%cur, 4, ZMQ_SNDMORE)'
2017-05-10 22:09:53 +02:00
endif
2016-09-01 14:43:13 +02:00
2017-05-11 10:56:33 +02:00
if (b%cur > 0) then
2016-09-01 14:43:13 +02:00
2017-05-11 10:56:33 +02:00
rc = f77_zmq_send( zmq_socket_push, pt2, 8*N_states, ZMQ_SNDMORE)
if(rc /= 8*N_states) then
print *, 'f77_zmq_send( zmq_socket_push, pt2, 8*N_states, ZMQ_SNDMORE)'
endif
rc = f77_zmq_send( zmq_socket_push, b%val(1), 8*b%cur, ZMQ_SNDMORE)
if(rc /= 8*b%cur) then
print *, 'f77_zmq_send( zmq_socket_push, b%val(1), 8*b%cur, ZMQ_SNDMORE)'
endif
rc = f77_zmq_send( zmq_socket_push, b%det(1,1,1), bit_kind*N_int*2*b%cur, ZMQ_SNDMORE)
if(rc /= bit_kind*N_int*2*b%cur) then
print *, 'f77_zmq_send( zmq_socket_push, b%det(1,1,1), bit_kind*N_int*2*b%cur, ZMQ_SNDMORE)'
endif
2016-09-01 14:43:13 +02:00
2017-05-10 22:09:53 +02:00
endif
2016-09-01 14:43:13 +02:00
rc = f77_zmq_send( zmq_socket_push, ntask, 4, ZMQ_SNDMORE)
2017-05-10 22:09:53 +02:00
if(rc /= 4) then
print *, 'f77_zmq_send( zmq_socket_push, ntask, 4, ZMQ_SNDMORE)'
endif
2016-09-01 14:43:13 +02:00
rc = f77_zmq_send( zmq_socket_push, task_id(1), ntask*4, 0)
2017-05-10 22:09:53 +02:00
if(rc /= 4*ntask) then
print *, 'f77_zmq_send( zmq_socket_push, task_id(1), ntask*4, 0)'
endif
2016-09-01 14:43:13 +02:00
! Activate is zmq_socket_push is a REQ
2017-05-16 16:31:35 +02:00
IRP_IF ZMQ_PUSH
IRP_ELSE
2017-11-24 01:02:53 +01:00
character*(2) :: ok
rc = f77_zmq_recv( zmq_socket_push, ok, 2, 0)
if ((rc /= 2).and.(ok(1:2) /= 'ok')) then
print *, irp_here//': error in receiving ok'
stop -1
endif
2017-05-16 16:31:35 +02:00
IRP_ENDIF
2016-09-01 14:43:13 +02:00
end subroutine
subroutine pull_selection_results(zmq_socket_pull, pt2, val, det, N, task_id, ntask)
use f77_zmq
use selection_types
implicit none
integer(ZMQ_PTR), intent(in) :: zmq_socket_pull
double precision, intent(inout) :: pt2(N_states)
double precision, intent(out) :: val(*)
integer(bit_kind), intent(out) :: det(N_int, 2, *)
integer, intent(out) :: N, ntask, task_id(*)
integer :: rc, rn, i
rc = f77_zmq_recv( zmq_socket_pull, N, 4, 0)
2017-05-10 22:09:53 +02:00
if(rc /= 4) then
print *, 'f77_zmq_recv( zmq_socket_pull, N, 4, 0)'
endif
2016-09-01 14:43:13 +02:00
2017-05-11 10:56:33 +02:00
if (N>0) then
rc = f77_zmq_recv( zmq_socket_pull, pt2, N_states*8, 0)
if(rc /= 8*N_states) then
print *, 'f77_zmq_recv( zmq_socket_pull, pt2, N_states*8, 0)'
endif
rc = f77_zmq_recv( zmq_socket_pull, val(1), 8*N, 0)
if(rc /= 8*N) then
print *, 'f77_zmq_recv( zmq_socket_pull, val(1), 8*N, 0)'
endif
rc = f77_zmq_recv( zmq_socket_pull, det(1,1,1), bit_kind*N_int*2*N, 0)
if(rc /= bit_kind*N_int*2*N) then
print *, 'f77_zmq_recv( zmq_socket_pull, det(1,1,1), bit_kind*N_int*2*N, 0)'
endif
else
pt2(:) = 0.d0
2017-05-10 22:09:53 +02:00
endif
2016-09-01 14:43:13 +02:00
rc = f77_zmq_recv( zmq_socket_pull, ntask, 4, 0)
2017-05-10 22:09:53 +02:00
if(rc /= 4) then
print *, 'f77_zmq_recv( zmq_socket_pull, ntask, 4, 0)'
endif
2016-09-01 14:43:13 +02:00
rc = f77_zmq_recv( zmq_socket_pull, task_id(1), ntask*4, 0)
2017-05-10 22:09:53 +02:00
if(rc /= 4*ntask) then
print *, 'f77_zmq_recv( zmq_socket_pull, task_id(1), ntask*4, 0)'
endif
2016-09-01 14:43:13 +02:00
! Activate is zmq_socket_pull is a REP
2017-05-16 16:31:35 +02:00
IRP_IF ZMQ_PUSH
IRP_ELSE
2017-11-24 01:02:53 +01:00
rc = f77_zmq_send( zmq_socket_pull, 'ok', 2, 0)
if (rc /= 2) then
print *, irp_here//': error in sending ok'
stop -1
endif
2017-05-16 16:31:35 +02:00
IRP_ENDIF
2016-09-01 14:43:13 +02:00
end subroutine
2016-09-05 17:16:09 +02:00