42 integer,
intent(in) :: ierr
45 if (ierr /= mpi_success)
then
73 integer,
intent(in) :: status
78 call mpi_abort(mpi_comm_world, status, ierr)
93 call mpi_finalize(ierr)
107 call mpi_barrier(mpi_comm_world, ierr)
119 integer :: rank, ierr
121 call mpi_comm_rank(mpi_comm_world, rank, ierr)
136 integer :: size, ierr
138 call mpi_comm_size(mpi_comm_world,
size, ierr)
153 real(kind=
dp),
parameter :: test_real = 2.718281828459d0
154 complex(kind=dc),
parameter :: test_complex &
155 = (0.707106781187d0, 1.4142135624d0)
156 logical,
parameter :: test_logical = .true.
157 character(len=100),
parameter :: test_string &
158 =
"a truth universally acknowledged"
159 integer,
parameter :: test_integer = 314159
161 character,
allocatable :: buffer(:)
162 integer :: buffer_size, max_buffer_size, position
163 real(kind=
dp) :: send_real, recv_real
164 complex(kind=dc) :: send_complex, recv_complex
165 logical :: send_logical, recv_logical
166 character(len=100) :: send_string, recv_string
167 integer :: send_integer, recv_integer
168 real(kind=
dp),
allocatable :: send_real_array(:)
169 real(kind=
dp),
allocatable :: recv_real_array(:)
172 send_real = test_real
173 send_complex = test_complex
174 send_logical = test_logical
175 send_string = test_string
176 send_integer = test_integer
177 allocate(send_real_array(2))
178 send_real_array(1) = real(test_complex)
179 send_real_array(2) = aimag(test_complex)
182 max_buffer_size = max_buffer_size &
184 max_buffer_size = max_buffer_size &
186 max_buffer_size = max_buffer_size &
188 max_buffer_size = max_buffer_size &
190 max_buffer_size = max_buffer_size &
192 max_buffer_size = max_buffer_size &
195 allocate(buffer(max_buffer_size))
204 call assert_msg(350740830, position <= max_buffer_size, &
205 "MPI test failure: pack position " &
207 //
" greater than max_buffer_size " &
209 buffer_size = position
215 allocate(buffer(buffer_size))
228 call assert_msg(787677020, position == buffer_size, &
229 "MPI test failure: unpack position " &
231 //
" not equal to buffer_size " &
238 call assert_msg(567548916, recv_real == test_real, &
239 "MPI test failure: real recv " &
241 //
" not equal to " &
243 call assert_msg(653908509, recv_complex == test_complex, &
244 "MPI test failure: complex recv " &
246 //
" not equal to " &
248 call assert_msg(307746296, recv_logical .eqv. test_logical, &
249 "MPI test failure: logical recv " &
251 //
" not equal to " &
253 call assert_msg(155693492, recv_string == test_string, &
254 "MPI test failure: string recv '" &
255 // trim(recv_string) &
256 //
"' not equal to '" &
257 // trim(test_string) //
"'")
258 call assert_msg(875699427, recv_integer == test_integer, &
259 "MPI test failure: integer recv " &
261 //
" not equal to " &
263 call assert_msg(326982363,
size(recv_real_array) == 2, &
264 "MPI test failure: real array recv size " &
266 //
" not equal to 2")
268 recv_real_array(1) == real(test_complex), &
269 "MPI test failure: real array recv index 1 " &
271 //
" not equal to " &
274 recv_real_array(2) == aimag(test_complex), &
275 "MPI test failure: real array recv index 2 " &
277 //
" not equal to " &
290 integer,
intent(inout) :: val
293 integer :: root, ierr
296 call mpi_bcast(val, 1, mpi_integer, root, &
297 mpi_comm_world, ierr)
309 character(len=*),
intent(inout) :: val
312 integer :: root, ierr
315 call mpi_bcast(val, len(val), mpi_character, root, &
316 mpi_comm_world, ierr)
328 character,
intent(inout) :: val(:)
331 integer :: root, ierr
334 call mpi_bcast(val,
size(val), mpi_character, root, &
335 mpi_comm_world, ierr)
347 integer,
intent(in) :: val
352 call mpi_pack_size(1, mpi_integer, mpi_comm_world, &
367 integer(kind=8),
intent(in) :: val
372 call mpi_pack_size(1, mpi_integer8, mpi_comm_world, &
387 real(kind=
dp),
intent(in) :: val
392 call mpi_pack_size(1, mpi_double_precision, mpi_comm_world, &
407 character(len=*),
intent(in) :: val
412 call mpi_pack_size(len_trim(val), mpi_character, mpi_comm_world, &
429 logical,
intent(in) :: val
434 call mpi_pack_size(1, mpi_logical, mpi_comm_world, &
449 complex(kind=dc),
intent(in) :: val
454 call mpi_pack_size(1, mpi_double_complex, mpi_comm_world, &
469 complex(kind=dc),
allocatable,
intent(in) :: val(:)
471 integer :: ierr, total_size
474 logical :: is_allocated
477 is_allocated =
allocated(val)
478 if (is_allocated)
then
479 call mpi_pack_size(
size(val), mpi_double_complex, mpi_comm_world, &
499 integer,
allocatable,
intent(in) :: val(:)
501 integer :: total_size, ierr
504 logical :: is_allocated
507 is_allocated =
allocated(val)
508 if (is_allocated)
then
509 call mpi_pack_size(
size(val), mpi_integer, mpi_comm_world, &
529 real(kind=
dp),
allocatable,
intent(in) :: val(:)
531 integer :: total_size, ierr
534 logical :: is_allocated
537 is_allocated =
allocated(val)
538 if (is_allocated)
then
539 call mpi_pack_size(
size(val), mpi_double_precision, mpi_comm_world, &
559 character(len=*),
allocatable,
intent(in) :: val(:)
561 integer :: i, total_size
562 logical :: is_allocated
565 is_allocated =
allocated(val)
566 if (is_allocated)
then
583 real(kind=
dp),
allocatable,
intent(in) :: val(:,:)
585 integer :: total_size, ierr
588 logical :: is_allocated
591 is_allocated =
allocated(val)
592 if (is_allocated)
then
593 call mpi_pack_size(
size(val), mpi_double_precision, mpi_comm_world, &
614 real(kind=
dp),
allocatable,
intent(in) :: val(:,:,:)
616 integer :: ierr, total_size
619 logical :: is_allocated
622 is_allocated =
allocated(val)
623 if (is_allocated)
then
624 call mpi_pack_size(
size(val), mpi_double_precision, mpi_comm_world, &
646 real(kind=
dp),
allocatable,
intent(in) :: val(:,:,:,:)
648 integer :: ierr, total_size
651 logical :: is_allocated
654 is_allocated =
allocated(val)
655 if (is_allocated)
then
656 call mpi_pack_size(
size(val), mpi_double_precision, mpi_comm_world, &
679 real(kind=
dp),
allocatable,
intent(in) :: val(:,:,:,:,:)
681 integer :: ierr, total_size
684 logical :: is_allocated
687 is_allocated =
allocated(val)
688 if (is_allocated)
then
689 call mpi_pack_size(
size(val), mpi_double_precision, mpi_comm_world, &
713 character,
intent(inout) :: buffer(:)
715 integer,
intent(inout) :: position
717 integer,
intent(in) :: val
720 integer :: prev_position, ierr
722 prev_position = position
723 call mpi_pack(val, 1, mpi_integer, buffer,
size(buffer), &
724 position, mpi_comm_world, ierr)
738 character,
intent(inout) :: buffer(:)
740 integer,
intent(inout) :: position
742 integer(kind=8),
intent(in) :: val
745 integer :: prev_position, ierr
747 prev_position = position
748 call mpi_pack(val, 1, mpi_integer8, buffer,
size(buffer), &
749 position, mpi_comm_world, ierr)
763 character,
intent(inout) :: buffer(:)
765 integer,
intent(inout) :: position
767 real(kind=
dp),
intent(in) :: val
770 integer :: prev_position, ierr
772 prev_position = position
773 call mpi_pack(val, 1, mpi_double_precision, buffer,
size(buffer), &
774 position, mpi_comm_world, ierr)
788 character,
intent(inout) :: buffer(:)
790 integer,
intent(inout) :: position
792 character(len=*),
intent(in) :: val
795 integer :: prev_position, length, ierr
797 prev_position = position
798 length = len_trim(val)
800 call mpi_pack(val, length, mpi_character, buffer,
size(buffer), &
801 position, mpi_comm_world, ierr)
815 character,
intent(inout) :: buffer(:)
817 integer,
intent(inout) :: position
819 logical,
intent(in) :: val
822 integer :: prev_position, ierr
824 prev_position = position
825 call mpi_pack(val, 1, mpi_logical, buffer,
size(buffer), &
826 position, mpi_comm_world, ierr)
840 character,
intent(inout) :: buffer(:)
842 integer,
intent(inout) :: position
844 complex(kind=dc),
intent(in) :: val
847 integer :: prev_position, ierr
849 prev_position = position
850 call mpi_pack(val, 1, mpi_double_complex, buffer,
size(buffer), &
851 position, mpi_comm_world, ierr)
865 character,
intent(inout) :: buffer(:)
867 integer,
intent(inout) :: position
869 complex(kind=dc),
allocatable,
intent(in) :: val(:)
872 integer :: prev_position, ierr, n
873 logical :: is_allocated
875 prev_position = position
876 is_allocated =
allocated(val)
878 if (is_allocated)
then
881 call mpi_pack(val, n, mpi_double_complex, buffer,
size(buffer), &
882 position, mpi_comm_world, ierr)
897 character,
intent(inout) :: buffer(:)
899 integer,
intent(inout) :: position
901 integer,
allocatable,
intent(in) :: val(:)
904 integer :: prev_position, n, ierr
905 logical :: is_allocated
907 prev_position = position
908 is_allocated =
allocated(val)
910 if (is_allocated)
then
913 call mpi_pack(val, n, mpi_integer, buffer,
size(buffer), &
914 position, mpi_comm_world, ierr)
929 character,
intent(inout) :: buffer(:)
931 integer,
intent(inout) :: position
933 real(kind=
dp),
allocatable,
intent(in) :: val(:)
936 integer :: prev_position, n, ierr
937 logical :: is_allocated
939 prev_position = position
940 is_allocated =
allocated(val)
942 if (is_allocated)
then
945 call mpi_pack(val, n, mpi_double_precision, buffer,
size(buffer), &
946 position, mpi_comm_world, ierr)
961 character,
intent(inout) :: buffer(:)
963 integer,
intent(inout) :: position
965 character(len=*),
allocatable,
intent(in) :: val(:)
968 integer :: prev_position, i, n
969 logical :: is_allocated
971 prev_position = position
972 is_allocated =
allocated(val)
974 if (is_allocated)
then
993 character,
intent(inout) :: buffer(:)
995 integer,
intent(inout) :: position
997 real(kind=
dp),
allocatable,
intent(in) :: val(:,:)
1000 integer :: prev_position, n1, n2, ierr
1001 logical :: is_allocated
1003 prev_position = position
1004 is_allocated =
allocated(val)
1006 if (is_allocated)
then
1011 call mpi_pack(val, n1*n2, mpi_double_precision, buffer,
size(buffer), &
1012 position, mpi_comm_world, ierr)
1027 character,
intent(inout) :: buffer(:)
1029 integer,
intent(inout) :: position
1031 real(kind=
dp),
allocatable,
intent(in) :: val(:,:,:)
1034 integer :: prev_position, n1, n2, n3, ierr
1035 logical :: is_allocated
1037 prev_position = position
1038 is_allocated =
allocated(val)
1040 if (is_allocated)
then
1047 call mpi_pack(val, n1*n2*n3, mpi_double_precision, buffer, &
1048 size(buffer), position, mpi_comm_world, ierr)
1063 character,
intent(inout) :: buffer(:)
1065 integer,
intent(inout) :: position
1067 real(kind=
dp),
allocatable,
intent(in) :: val(:,:,:,:)
1070 integer :: prev_position, n1, n2, n3, n4, ierr
1071 logical :: is_allocated
1073 prev_position = position
1074 is_allocated =
allocated(val)
1076 if (is_allocated)
then
1085 call mpi_pack(val, n1*n2*n3*n4, mpi_double_precision, buffer, &
1086 size(buffer), position, mpi_comm_world, ierr)
1101 character,
intent(inout) :: buffer(:)
1103 integer,
intent(inout) :: position
1105 real(kind=
dp),
allocatable,
intent(in) :: val(:,:,:,:,:)
1108 integer :: prev_position, n1, n2, n3, n4, n5, ierr
1109 logical :: is_allocated
1111 prev_position = position
1112 is_allocated =
allocated(val)
1114 if (is_allocated)
then
1125 call mpi_pack(val, n1*n2*n3*n4*n5, mpi_double_precision, buffer, &
1126 size(buffer), position, mpi_comm_world, ierr)
1141 character,
intent(inout) :: buffer(:)
1143 integer,
intent(inout) :: position
1145 integer,
intent(out) :: val
1148 integer :: prev_position, ierr
1150 prev_position = position
1151 call mpi_unpack(buffer,
size(buffer), position, val, 1, mpi_integer, &
1152 mpi_comm_world, ierr)
1166 character,
intent(inout) :: buffer(:)
1168 integer,
intent(inout) :: position
1170 integer(kind=8),
intent(out) :: val
1173 integer :: prev_position, ierr
1175 prev_position = position
1176 call mpi_unpack(buffer,
size(buffer), position, val, 1, mpi_integer8, &
1177 mpi_comm_world, ierr)
1191 character,
intent(inout) :: buffer(:)
1193 integer,
intent(inout) :: position
1195 real(kind=
dp),
intent(out) :: val
1198 integer :: prev_position, ierr
1200 prev_position = position
1201 call mpi_unpack(buffer,
size(buffer), position, val, 1, &
1202 mpi_double_precision, mpi_comm_world, ierr)
1216 character,
intent(inout) :: buffer(:)
1218 integer,
intent(inout) :: position
1220 character(len=*),
intent(out) :: val
1223 integer :: prev_position, length, ierr
1225 prev_position = position
1227 call assert(946399479, length <= len(val))
1229 call mpi_unpack(buffer,
size(buffer), position, val, length, &
1230 mpi_character, mpi_comm_world, ierr)
1244 character,
intent(inout) :: buffer(:)
1246 integer,
intent(inout) :: position
1248 logical,
intent(out) :: val
1251 integer :: prev_position, ierr
1253 prev_position = position
1254 call mpi_unpack(buffer,
size(buffer), position, val, 1, mpi_logical, &
1255 mpi_comm_world, ierr)
1269 character,
intent(inout) :: buffer(:)
1271 integer,
intent(inout) :: position
1273 complex(kind=dc),
intent(out) :: val
1276 integer :: prev_position, ierr
1278 prev_position = position
1279 call mpi_unpack(buffer,
size(buffer), position, val, 1, &
1280 mpi_double_complex, mpi_comm_world, ierr)
1294 character,
intent(inout) :: buffer(:)
1296 integer,
intent(inout) :: position
1298 complex(kind=dc),
allocatable,
intent(out) :: val(:)
1301 integer :: prev_position, ierr, n
1302 logical :: is_allocated
1304 prev_position = position
1306 if (
allocated(val))
deallocate(val)
1307 if (is_allocated)
then
1310 call mpi_unpack(buffer,
size(buffer), position, val, n, &
1311 mpi_double_complex, mpi_comm_world, ierr)
1326 character,
intent(inout) :: buffer(:)
1328 integer,
intent(inout) :: position
1330 integer,
allocatable,
intent(inout) :: val(:)
1333 integer :: prev_position, n, ierr
1334 logical :: is_allocated
1336 prev_position = position
1338 if (
allocated(val))
deallocate(val)
1339 if (is_allocated)
then
1342 call mpi_unpack(buffer,
size(buffer), position, val, n, mpi_integer, &
1343 mpi_comm_world, ierr)
1358 character,
intent(inout) :: buffer(:)
1360 integer,
intent(inout) :: position
1362 real(kind=
dp),
allocatable,
intent(inout) :: val(:)
1365 integer :: prev_position, n, ierr
1366 logical :: is_allocated
1368 prev_position = position
1370 if (
allocated(val))
deallocate(val)
1371 if (is_allocated)
then
1374 call mpi_unpack(buffer,
size(buffer), position, val, n, &
1375 mpi_double_precision, mpi_comm_world, ierr)
1390 character,
intent(inout) :: buffer(:)
1392 integer,
intent(inout) :: position
1394 character(len=*),
allocatable,
intent(inout) :: val(:)
1397 integer :: prev_position, i, n
1398 logical :: is_allocated
1400 prev_position = position
1402 if (
allocated(val))
deallocate(val)
1403 if (is_allocated)
then
1422 character,
intent(inout) :: buffer(:)
1424 integer,
intent(inout) :: position
1426 real(kind=
dp),
allocatable,
intent(inout) :: val(:,:)
1429 integer :: prev_position, n1, n2, ierr
1430 logical :: is_allocated
1432 prev_position = position
1434 if (
allocated(val))
deallocate(val)
1435 if (is_allocated)
then
1438 allocate(val(n1,n2))
1439 call mpi_unpack(buffer,
size(buffer), position, val, n1*n2, &
1440 mpi_double_precision, mpi_comm_world, ierr)
1443 call assert(781681739, position - prev_position &
1455 character,
intent(inout) :: buffer(:)
1457 integer,
intent(inout) :: position
1459 real(kind=
dp),
allocatable,
intent(inout) :: val(:,:,:)
1462 integer :: prev_position, n1, n2, n3, ierr
1463 logical :: is_allocated
1465 prev_position = position
1467 if (
allocated(val))
deallocate(val)
1468 if (is_allocated)
then
1472 allocate(val(n1,n2,n3))
1473 call mpi_unpack(buffer,
size(buffer), position, val, n1*n2*n3, &
1474 mpi_double_precision, mpi_comm_world, ierr)
1477 call assert(116666533, position - prev_position &
1489 character,
intent(inout) :: buffer(:)
1491 integer,
intent(inout) :: position
1493 real(kind=
dp),
allocatable,
intent(inout) :: val(:,:,:,:)
1496 integer :: prev_position, n1, n2, n3, n4, ierr
1497 logical :: is_allocated
1499 prev_position = position
1501 if (
allocated(val))
deallocate(val)
1502 if (is_allocated)
then
1507 allocate(val(n1,n2,n3,n4))
1508 call mpi_unpack(buffer,
size(buffer), position, val, n1*n2*n3*n4, &
1509 mpi_double_precision, mpi_comm_world, ierr)
1512 call assert(392994260, position - prev_position &
1524 character,
intent(inout) :: buffer(:)
1526 integer,
intent(inout) :: position
1528 real(kind=
dp),
allocatable,
intent(inout) :: val(:,:,:,:,:)
1531 integer :: prev_position, n1, n2, n3, n4, n5, ierr
1532 logical :: is_allocated
1534 prev_position = position
1536 if (
allocated(val))
deallocate(val)
1537 if (is_allocated)
then
1543 allocate(val(n1,n2,n3,n4,n5))
1544 call mpi_unpack(buffer,
size(buffer), position, val, n1*n2*n3*n4*n5, &
1545 mpi_double_precision, mpi_comm_world, ierr)
1548 call assert(046688204, position - prev_position &
1561 real(kind=
dp),
intent(in) :: val
1563 real(kind=
dp),
intent(out) :: val_avg
1568 call mpi_reduce(val, val_avg, 1, mpi_double_precision, mpi_sum, 0, &
1569 mpi_comm_world, ierr)
1586 real(kind=
dp),
intent(in) :: from_val
1588 real(kind=
dp),
intent(out) :: to_val
1590 integer,
intent(in) :: from_proc
1592 integer,
intent(in) :: to_proc
1595 integer :: rank, ierr, status(MPI_STATUS_SIZE)
1598 if (from_proc == to_proc)
then
1599 if (rank == from_proc)
then
1603 if (rank == from_proc)
then
1604 call mpi_send(from_val, 1, mpi_double_precision, to_proc, &
1605 208020430, mpi_comm_world, ierr)
1607 elseif (rank == to_proc)
then
1608 call mpi_recv(to_val, 1, mpi_double_precision, from_proc, &
1609 208020430, mpi_comm_world, status, ierr)
1625 integer,
intent(in) :: from_val
1627 integer,
intent(out) :: to_val
1629 integer,
intent(in) :: from_proc
1631 integer,
intent(in) :: to_proc
1634 integer :: rank, ierr, status(MPI_STATUS_SIZE)
1637 if (from_proc == to_proc)
then
1638 if (rank == from_proc)
then
1642 if (rank == from_proc)
then
1643 call mpi_send(from_val, 1, mpi_integer, to_proc, &
1644 208020430, mpi_comm_world, ierr)
1646 elseif (rank == to_proc)
then
1647 call mpi_recv(to_val, 1, mpi_integer, from_proc, &
1648 208020430, mpi_comm_world, status, ierr)
1665 integer,
intent(in) :: val
1667 integer,
intent(out) :: val_sum
1672 call mpi_reduce(val, val_sum, 1, mpi_integer, mpi_sum, 0, &
1673 mpi_comm_world, ierr)
1688 integer,
intent(in) :: val
1690 integer,
intent(out) :: val_sum
1695 call mpi_allreduce(val, val_sum, 1, mpi_integer, mpi_sum, &
1696 mpi_comm_world, ierr)
1711 real(kind=
dp),
intent(in) :: val(:)
1713 real(kind=
dp),
intent(out) :: val_avg(:)
1718 call assert(915136121,
size(val) ==
size(val_avg))
1719 call mpi_reduce(val, val_avg,
size(val), mpi_double_precision, &
1720 mpi_sum, 0, mpi_comm_world, ierr)
1738 real(kind=
dp),
intent(in) :: val(:,:)
1740 real(kind=
dp),
intent(out) :: val_avg(:,:)
1745 call assert(131229046,
size(val,1) ==
size(val_avg,1))
1746 call assert(992122167,
size(val,2) ==
size(val_avg,2))
1747 call mpi_reduce(val, val_avg,
size(val), mpi_double_precision, &
1748 mpi_sum, 0, mpi_comm_world, ierr)
1766 real(kind=
dp),
intent(in) :: val
1768 real(kind=
dp),
intent(out) :: val_avg
1773 call mpi_allreduce(val, val_avg, 1, mpi_double_precision, mpi_sum, &
1774 mpi_comm_world, ierr)
1790 real(kind=
dp),
intent(in) :: val(:)
1792 real(kind=
dp),
intent(out) :: val_avg(:)
1797 call assert(948533359,
size(val) ==
size(val_avg))
1798 call mpi_allreduce(val, val_avg,
size(val), mpi_double_precision, &
1799 mpi_sum, mpi_comm_world, ierr)
1815 integer,
intent(in) :: val
1817 integer,
intent(out) :: val_min
1822 call mpi_allreduce(val, val_min, 1, mpi_integer, mpi_min, &
1823 mpi_comm_world, ierr)
1838 integer,
intent(in) :: val
1840 integer,
intent(out) :: val_max
1845 call mpi_allreduce(val, val_max, 1, mpi_integer, mpi_max, &
1846 mpi_comm_world, ierr)
1861 real(kind=
dp),
intent(in) :: val
1863 real(kind=
dp),
intent(out) :: val_min
1868 call mpi_allreduce(val, val_min, 1, mpi_double_precision, mpi_min, &
1869 mpi_comm_world, ierr)
1884 real(kind=
dp),
intent(in) :: val
1886 real(kind=
dp),
intent(out) :: val_max
1891 call mpi_allreduce(val, val_max, 1, mpi_double_precision, mpi_max, &
1892 mpi_comm_world, ierr)
1906 integer,
intent(in) :: val
1909 integer :: min_val, max_val
1913 if (min_val == max_val)
then
1930 real(kind=
dp),
intent(in) :: val
1933 real(kind=
dp) :: min_val, max_val
1937 if (min_val == max_val)
then
1954 integer,
intent(in) :: send(:)
1956 integer,
intent(out) :: recv(size(send))
1961 call mpi_alltoall(send, 1, mpi_integer, recv, 1, mpi_integer, &
1962 mpi_comm_world, ierr)
1977 integer,
intent(in) :: send(:)
1979 integer,
intent(out) :: recv(:,:)
1982 integer :: n_proc, n_bin, n_data, ierr
1983 integer,
allocatable :: send_buf(:), recv_buf(:)
1986 n_data =
size(send, 1)
1987 call assert(353005542, all(shape(recv) == (/n_data, n_proc/)))
1990 allocate(send_buf(n_data))
1991 allocate(recv_buf(n_data * n_proc))
1993 call mpi_allgather(send_buf, n_data, mpi_integer, &
1994 recv_buf, n_data, mpi_integer, mpi_comm_world, ierr)
1996 recv = reshape(recv_buf, (/n_data, n_proc/))
1997 deallocate(send_buf)
1998 deallocate(recv_buf)
2012 real(kind=
dp),
intent(in) :: send(:)
2014 real(kind=
dp),
intent(out) :: recv(:,:)
2017 integer :: n_proc, n_bin, n_data, ierr
2018 real(kind=
dp),
allocatable :: send_buf(:), recv_buf(:)
2021 n_data =
size(send, 1)
2022 call assert(291000580, all(shape(recv) == (/n_data, n_proc/)))
2025 allocate(send_buf(n_data))
2026 allocate(recv_buf(n_data * n_proc))
2028 call mpi_allgather(send_buf, n_data, mpi_double_precision, &
2029 recv_buf, n_data, mpi_double_precision, mpi_comm_world, ierr)
2031 recv = reshape(recv_buf, (/n_data, n_proc/))
2032 deallocate(send_buf)
2033 deallocate(recv_buf)