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 real(kind=dp),
intent(in) :: val
372 call mpi_pack_size(1, mpi_double_precision, mpi_comm_world, &
387 character(len=*),
intent(in) :: val
392 call mpi_pack_size(len_trim(val), mpi_character, mpi_comm_world, &
409 logical,
intent(in) :: val
414 call mpi_pack_size(1, mpi_logical, mpi_comm_world, &
429 complex(kind=dc),
intent(in) :: val
434 call mpi_pack_size(1, mpi_double_complex, mpi_comm_world, &
449 integer,
allocatable,
intent(in) :: val(:)
451 integer :: total_size, ierr
454 logical :: is_allocated
457 is_allocated =
allocated(val)
458 if (is_allocated)
then 459 call mpi_pack_size(
size(val), mpi_integer, mpi_comm_world, &
479 real(kind=dp),
allocatable,
intent(in) :: val(:)
481 integer :: total_size, ierr
484 logical :: is_allocated
487 is_allocated =
allocated(val)
488 if (is_allocated)
then 489 call mpi_pack_size(
size(val), mpi_double_precision, mpi_comm_world, &
509 character(len=*),
allocatable,
intent(in) :: val(:)
511 integer :: i, total_size
512 logical :: is_allocated
514 is_allocated =
allocated(val)
515 if (is_allocated)
then 532 real(kind=dp),
allocatable,
intent(in) :: val(:,:)
534 integer :: total_size, ierr
537 logical :: is_allocated
540 is_allocated =
allocated(val)
541 if (is_allocated)
then 542 call mpi_pack_size(
size(val), mpi_double_precision, mpi_comm_world, &
563 character,
intent(inout) :: buffer(:)
565 integer,
intent(inout) :: position
567 integer,
intent(in) :: val
570 integer :: prev_position, ierr
572 prev_position = position
573 call mpi_pack(val, 1, mpi_integer, buffer,
size(buffer), &
574 position, mpi_comm_world, ierr)
588 character,
intent(inout) :: buffer(:)
590 integer,
intent(inout) :: position
592 real(kind=dp),
intent(in) :: val
595 integer :: prev_position, ierr
597 prev_position = position
598 call mpi_pack(val, 1, mpi_double_precision, buffer,
size(buffer), &
599 position, mpi_comm_world, ierr)
613 character,
intent(inout) :: buffer(:)
615 integer,
intent(inout) :: position
617 character(len=*),
intent(in) :: val
620 integer :: prev_position, length, ierr
622 prev_position = position
623 length = len_trim(val)
625 call mpi_pack(val, length, mpi_character, buffer,
size(buffer), &
626 position, mpi_comm_world, ierr)
640 character,
intent(inout) :: buffer(:)
642 integer,
intent(inout) :: position
644 logical,
intent(in) :: val
647 integer :: prev_position, ierr
649 prev_position = position
650 call mpi_pack(val, 1, mpi_logical, buffer,
size(buffer), &
651 position, mpi_comm_world, ierr)
665 character,
intent(inout) :: buffer(:)
667 integer,
intent(inout) :: position
669 complex(kind=dc),
intent(in) :: val
672 integer :: prev_position, ierr
674 prev_position = position
675 call mpi_pack(val, 1, mpi_double_complex, buffer,
size(buffer), &
676 position, mpi_comm_world, ierr)
690 character,
intent(inout) :: buffer(:)
692 integer,
intent(inout) :: position
694 integer,
allocatable,
intent(in) :: val(:)
697 integer :: prev_position, n, ierr
698 logical :: is_allocated
700 prev_position = position
701 is_allocated =
allocated(val)
703 if (is_allocated)
then 706 call mpi_pack(val, n, mpi_integer, buffer,
size(buffer), &
707 position, mpi_comm_world, ierr)
722 character,
intent(inout) :: buffer(:)
724 integer,
intent(inout) :: position
726 real(kind=dp),
allocatable,
intent(in) :: val(:)
729 integer :: prev_position, n, ierr
730 logical :: is_allocated
732 prev_position = position
733 is_allocated =
allocated(val)
735 if (is_allocated)
then 738 call mpi_pack(val, n, mpi_double_precision, buffer,
size(buffer), &
739 position, mpi_comm_world, ierr)
754 character,
intent(inout) :: buffer(:)
756 integer,
intent(inout) :: position
758 character(len=*),
allocatable,
intent(in) :: val(:)
761 integer :: prev_position, i, n
762 logical :: is_allocated
764 prev_position = position
765 is_allocated =
allocated(val)
767 if (is_allocated)
then 786 character,
intent(inout) :: buffer(:)
788 integer,
intent(inout) :: position
790 real(kind=dp),
allocatable,
intent(in) :: val(:,:)
793 integer :: prev_position, n1, n2, ierr
794 logical :: is_allocated
796 prev_position = position
797 is_allocated =
allocated(val)
799 if (is_allocated)
then 804 call mpi_pack(val, n1*n2, mpi_double_precision, buffer,
size(buffer), &
805 position, mpi_comm_world, ierr)
820 character,
intent(inout) :: buffer(:)
822 integer,
intent(inout) :: position
824 integer,
intent(out) :: val
827 integer :: prev_position, ierr
829 prev_position = position
830 call mpi_unpack(buffer,
size(buffer), position, val, 1, mpi_integer, &
831 mpi_comm_world, ierr)
845 character,
intent(inout) :: buffer(:)
847 integer,
intent(inout) :: position
849 real(kind=dp),
intent(out) :: val
852 integer :: prev_position, ierr
854 prev_position = position
855 call mpi_unpack(buffer,
size(buffer), position, val, 1, &
856 mpi_double_precision, mpi_comm_world, ierr)
870 character,
intent(inout) :: buffer(:)
872 integer,
intent(inout) :: position
874 character(len=*),
intent(out) :: val
877 integer :: prev_position, length, ierr
879 prev_position = position
881 call assert(946399479, length <= len(val))
883 call mpi_unpack(buffer,
size(buffer), position, val, length, &
884 mpi_character, mpi_comm_world, ierr)
898 character,
intent(inout) :: buffer(:)
900 integer,
intent(inout) :: position
902 logical,
intent(out) :: val
905 integer :: prev_position, ierr
907 prev_position = position
908 call mpi_unpack(buffer,
size(buffer), position, val, 1, mpi_logical, &
909 mpi_comm_world, ierr)
923 character,
intent(inout) :: buffer(:)
925 integer,
intent(inout) :: position
927 complex(kind=dc),
intent(out) :: val
930 integer :: prev_position, ierr
932 prev_position = position
933 call mpi_unpack(buffer,
size(buffer), position, val, 1, &
934 mpi_double_complex, mpi_comm_world, ierr)
948 character,
intent(inout) :: buffer(:)
950 integer,
intent(inout) :: position
952 integer,
allocatable,
intent(inout) :: val(:)
955 integer :: prev_position, n, ierr
956 logical :: is_allocated
958 prev_position = position
960 if (
allocated(val))
deallocate(val)
961 if (is_allocated)
then 964 call mpi_unpack(buffer,
size(buffer), position, val, n, mpi_integer, &
965 mpi_comm_world, ierr)
980 character,
intent(inout) :: buffer(:)
982 integer,
intent(inout) :: position
984 real(kind=dp),
allocatable,
intent(inout) :: val(:)
987 integer :: prev_position, n, ierr
988 logical :: is_allocated
990 prev_position = position
992 if (
allocated(val))
deallocate(val)
993 if (is_allocated)
then 996 call mpi_unpack(buffer,
size(buffer), position, val, n, &
997 mpi_double_precision, mpi_comm_world, ierr)
1012 character,
intent(inout) :: buffer(:)
1014 integer,
intent(inout) :: position
1016 character(len=*),
allocatable,
intent(inout) :: val(:)
1019 integer :: prev_position, i, n
1020 logical :: is_allocated
1022 prev_position = position
1024 if (
allocated(val))
deallocate(val)
1025 if (is_allocated)
then 1044 character,
intent(inout) :: buffer(:)
1046 integer,
intent(inout) :: position
1048 real(kind=dp),
allocatable,
intent(inout) :: val(:,:)
1051 integer :: prev_position, n1, n2, ierr
1052 logical :: is_allocated
1054 prev_position = position
1056 if (
allocated(val))
deallocate(val)
1057 if (is_allocated)
then 1060 allocate(val(n1,n2))
1061 call mpi_unpack(buffer,
size(buffer), position, val, n1*n2, &
1062 mpi_double_precision, mpi_comm_world, ierr)
1065 call assert(781681739, position - prev_position &
1078 real(kind=dp),
intent(in) :: val
1080 real(kind=dp),
intent(out) :: val_avg
1085 call mpi_reduce(val, val_avg, 1, mpi_double_precision, mpi_sum, 0, &
1086 mpi_comm_world, ierr)
1089 val_avg = val_avg /
real(pmc_mpi_size(), kind=
dp)
1103 real(kind=dp),
intent(in) :: from_val
1105 real(kind=dp),
intent(out) :: to_val
1107 integer,
intent(in) :: from_proc
1109 integer,
intent(in) :: to_proc
1112 integer :: rank, ierr, status(mpi_status_size)
1115 if (from_proc == to_proc)
then 1116 if (rank == from_proc)
then 1120 if (rank == from_proc)
then 1121 call mpi_send(from_val, 1, mpi_double_precision, to_proc, &
1122 208020430, mpi_comm_world, ierr)
1124 elseif (rank == to_proc)
then 1125 call mpi_recv(to_val, 1, mpi_double_precision, from_proc, &
1126 208020430, mpi_comm_world, status, ierr)
1142 integer,
intent(in) :: from_val
1144 integer,
intent(out) :: to_val
1146 integer,
intent(in) :: from_proc
1148 integer,
intent(in) :: to_proc
1151 integer :: rank, ierr, status(mpi_status_size)
1154 if (from_proc == to_proc)
then 1155 if (rank == from_proc)
then 1159 if (rank == from_proc)
then 1160 call mpi_send(from_val, 1, mpi_integer, to_proc, &
1161 208020430, mpi_comm_world, ierr)
1163 elseif (rank == to_proc)
then 1164 call mpi_recv(to_val, 1, mpi_integer, from_proc, &
1165 208020430, mpi_comm_world, status, ierr)
1182 integer,
intent(in) :: val
1184 integer,
intent(out) :: val_sum
1189 call mpi_reduce(val, val_sum, 1, mpi_integer, mpi_sum, 0, &
1190 mpi_comm_world, ierr)
1205 integer,
intent(in) :: val
1207 integer,
intent(out) :: val_sum
1212 call mpi_allreduce(val, val_sum, 1, mpi_integer, mpi_sum, &
1213 mpi_comm_world, ierr)
1228 real(kind=dp),
intent(in) :: val(:)
1230 real(kind=dp),
intent(out) :: val_avg(:)
1235 call assert(915136121,
size(val) ==
size(val_avg))
1236 call mpi_reduce(val, val_avg,
size(val), mpi_double_precision, &
1237 mpi_sum, 0, mpi_comm_world, ierr)
1240 val_avg = val_avg /
real(pmc_mpi_size(), kind=
dp)
1255 real(kind=dp),
intent(in) :: val(:,:)
1257 real(kind=dp),
intent(out) :: val_avg(:,:)
1262 call assert(131229046,
size(val,1) ==
size(val_avg,1))
1263 call assert(992122167,
size(val,2) ==
size(val_avg,2))
1264 call mpi_reduce(val, val_avg,
size(val), mpi_double_precision, &
1265 mpi_sum, 0, mpi_comm_world, ierr)
1268 val_avg = val_avg /
real(pmc_mpi_size(), kind=
dp)
1283 real(kind=dp),
intent(in) :: val
1285 real(kind=dp),
intent(out) :: val_avg
1290 call mpi_allreduce(val, val_avg, 1, mpi_double_precision, mpi_sum, &
1291 mpi_comm_world, ierr)
1293 val_avg = val_avg /
real(pmc_mpi_size(), kind=
dp)
1307 real(kind=dp),
intent(in) :: val(:)
1309 real(kind=dp),
intent(out) :: val_avg(:)
1314 call assert(948533359,
size(val) ==
size(val_avg))
1315 call mpi_allreduce(val, val_avg,
size(val), mpi_double_precision, &
1316 mpi_sum, mpi_comm_world, ierr)
1318 val_avg = val_avg /
real(pmc_mpi_size(), kind=
dp)
1332 integer,
intent(in) :: val
1334 integer,
intent(out) :: val_min
1339 call mpi_allreduce(val, val_min, 1, mpi_integer, mpi_min, &
1340 mpi_comm_world, ierr)
1355 integer,
intent(in) :: val
1357 integer,
intent(out) :: val_max
1362 call mpi_allreduce(val, val_max, 1, mpi_integer, mpi_max, &
1363 mpi_comm_world, ierr)
1378 real(kind=dp),
intent(in) :: val
1380 real(kind=dp),
intent(out) :: val_min
1385 call mpi_allreduce(val, val_min, 1, mpi_double_precision, mpi_min, &
1386 mpi_comm_world, ierr)
1401 real(kind=dp),
intent(in) :: val
1403 real(kind=dp),
intent(out) :: val_max
1408 call mpi_allreduce(val, val_max, 1, mpi_double_precision, mpi_max, &
1409 mpi_comm_world, ierr)
1423 integer,
intent(in) :: val
1426 integer :: min_val, max_val
1430 if (min_val == max_val)
then 1447 real(kind=dp),
intent(in) :: val
1450 real(kind=dp) :: min_val, max_val
1454 if (min_val == max_val)
then 1471 integer,
intent(in) :: send(:)
1473 integer,
intent(out) :: recv(size(send))
1478 call mpi_alltoall(send, 1, mpi_integer, recv, 1, mpi_integer, &
1479 mpi_comm_world, ierr)
1494 integer,
intent(in) :: send(:)
1496 integer,
intent(out) :: recv(:,:)
1499 integer :: n_proc, n_bin, n_data, ierr
1500 integer,
allocatable :: send_buf(:), recv_buf(:)
1503 n_data =
size(send, 1)
1504 call assert(353005542, all(shape(recv) == (/n_data, n_proc/)))
1507 allocate(send_buf(n_data))
1508 allocate(recv_buf(n_data * n_proc))
1510 call mpi_allgather(send_buf, n_data, mpi_integer, &
1511 recv_buf, n_data, mpi_integer, mpi_comm_world, ierr)
1513 recv = reshape(recv_buf, (/n_data, n_proc/))
1514 deallocate(send_buf)
1515 deallocate(recv_buf)
1529 real(kind=dp),
intent(in) :: send(:)
1531 real(kind=dp),
intent(out) :: recv(:,:)
1534 integer :: n_proc, n_bin, n_data, ierr
1535 real(kind=dp),
allocatable :: send_buf(:), recv_buf(:)
1538 n_data =
size(send, 1)
1539 call assert(291000580, all(shape(recv) == (/n_data, n_proc/)))
1542 allocate(send_buf(n_data))
1543 allocate(recv_buf(n_data * n_proc))
1545 call mpi_allgather(send_buf, n_data, mpi_double_precision, &
1546 recv_buf, n_data, mpi_double_precision, mpi_comm_world, ierr)
1548 recv = reshape(recv_buf, (/n_data, n_proc/))
1549 deallocate(send_buf)
1550 deallocate(recv_buf)
subroutine pmc_mpi_pack_integer_array(buffer, position, val)
Packs the given value into the buffer, advancing position.
subroutine assert_msg(code, condition_ok, error_msg)
Errors unless condition_ok is true.
subroutine die(code)
Error immediately.
integer function pmc_mpi_pack_size_integer_array(val)
Determines the number of bytes required to pack the given value.
subroutine pmc_mpi_transfer_integer(from_val, to_val, from_proc, to_proc)
Transfer the value between the given processes.
integer function pmc_mpi_pack_size_string(val)
Determines the number of bytes required to pack the given value.
integer function pmc_mpi_rank()
Returns the rank of the current process.
subroutine pmc_mpi_allgather_integer_array(send, recv)
Does an allgather of integer arrays (must be the same size on all processes).
subroutine pmc_mpi_alltoall_integer(send, recv)
Does an all-to-all transfer of integers.
subroutine pmc_mpi_unpack_string(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
subroutine pmc_mpi_unpack_integer_array(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
subroutine pmc_mpi_pack_string_array(buffer, position, val)
Packs the given value into the buffer, advancing position.
integer function pmc_mpi_pack_size_real_array(val)
Determines the number of bytes required to pack the given value.
subroutine pmc_mpi_transfer_real(from_val, to_val, from_proc, to_proc)
Transfer the value between the given processes.
subroutine pmc_mpi_pack_complex(buffer, position, val)
Packs the given value into the buffer, advancing position.
subroutine assert(code, condition_ok)
Errors unless condition_ok is true.
subroutine pmc_mpi_barrier()
Synchronize all processes.
integer function pmc_mpi_pack_size_real_array_2d(val)
Determines the number of bytes required to pack the given value.
subroutine pmc_mpi_allreduce_average_real_array(val, val_avg)
Computes the average of val across all processes, storing the result in val_avg on all processes...
logical function pmc_mpi_allequal_integer(val)
Returns whether all processors have the same value.
integer function pmc_mpi_pack_size_real(val)
Determines the number of bytes required to pack the given value.
subroutine pmc_mpi_pack_logical(buffer, position, val)
Packs the given value into the buffer, advancing position.
subroutine pmc_mpi_reduce_avg_real_array(val, val_avg)
Computes the average of val across all processes, storing the result in val_avg on the root process...
subroutine pmc_mpi_unpack_complex(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
subroutine pmc_mpi_reduce_avg_real_array_2d(val, val_avg)
Computes the average of val across all processes, storing the result in val_avg on the root process...
subroutine pmc_mpi_pack_real(buffer, position, val)
Packs the given value into the buffer, advancing position.
subroutine pmc_mpi_allreduce_min_integer(val, val_min)
Computes the minimum of val across all processes, storing the result in val_min on all processes...
logical function pmc_mpi_allequal_real(val)
Returns whether all processors have the same value.
character(len=pmc_util_convert_string_len) function real_to_string(val)
Convert a real to a string format.
subroutine pmc_mpi_reduce_sum_integer(val, val_sum)
Computes the sum of val across all processes, storing the result in val_sum on the root process...
subroutine pmc_mpi_pack_integer(buffer, position, val)
Packs the given value into the buffer, advancing position.
subroutine pmc_mpi_allreduce_max_real(val, val_max)
Computes the maximum of val across all processes, storing the result in val_max on all processes...
character(len=pmc_util_convert_string_len) function complex_to_string(val)
Convert a complex to a string format.
subroutine pmc_mpi_unpack_string_array(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
subroutine pmc_mpi_abort(status)
Abort the program.
integer function pmc_mpi_pack_size_logical(val)
Determines the number of bytes required to pack the given value.
subroutine pmc_mpi_pack_string(buffer, position, val)
Packs the given value into the buffer, advancing position.
subroutine pmc_mpi_unpack_real(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
subroutine pmc_mpi_check_ierr(ierr)
Dies if ierr is not ok.
subroutine pmc_mpi_pack_real_array(buffer, position, val)
Packs the given value into the buffer, advancing position.
logical function pmc_mpi_support()
Whether MPI support is compiled in.
subroutine pmc_mpi_unpack_real_array(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
subroutine pmc_mpi_test()
Perform basic sanity checks on send/receive.
subroutine pmc_mpi_allreduce_min_real(val, val_min)
Computes the minimum of val across all processes, storing the result in val_min on all processes...
integer, parameter dp
Kind of a double precision real number.
subroutine pmc_mpi_unpack_real_array_2d(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
subroutine pmc_mpi_unpack_logical(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
integer function pmc_mpi_pack_size_complex(val)
Determines the number of bytes required to pack the given value.
subroutine pmc_mpi_bcast_integer(val)
Broadcast the given value from process 0 to all other processes.
integer function pmc_mpi_pack_size_integer(val)
Determines the number of bytes required to pack the given value.
subroutine pmc_mpi_allreduce_average_real(val, val_avg)
Computes the average of val across all processes, storing the result in val_avg on all processes...
subroutine pmc_mpi_allreduce_max_integer(val, val_max)
Computes the maximum of val across all processes, storing the result in val_max on all processes...
subroutine pmc_mpi_unpack_integer(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
subroutine pmc_mpi_reduce_avg_real(val, val_avg)
Computes the average of val across all processes, storing the result in val_avg on the root process...
subroutine pmc_mpi_bcast_packed(val)
Broadcast the given value from process 0 to all other processes.
character(len=pmc_util_convert_string_len) function logical_to_string(val)
Convert a logical to a string format.
subroutine pmc_mpi_pack_real_array_2d(buffer, position, val)
Packs the given value into the buffer, advancing position.
subroutine pmc_mpi_finalize()
Shut down MPI.
character(len=pmc_util_convert_string_len) function integer_to_string(val)
Convert an integer to a string format.
subroutine pmc_mpi_init()
Initialize MPI.
integer function pmc_mpi_size()
Returns the total number of processes.
subroutine pmc_mpi_bcast_string(val)
Broadcast the given value from process 0 to all other processes.
Common utility subroutines.
Wrapper functions for MPI.
subroutine pmc_mpi_allreduce_sum_integer(val, val_sum)
Computes the sum of val across all processes, storing the result in val_sum on all processes...
integer function pmc_mpi_pack_size_string_array(val)
Determines the number of bytes required to pack the given value.
subroutine pmc_mpi_allgather_real_array(send, recv)
Does an allgather of real arrays (must be the same size on all processes).