63 & mp_exchange2d_xtr, &
76# ifdef SINGLE_PRECISION
115# ifdef SINGLE_PRECISION
142 integer,
intent(in) :: ng, model
144 integer,
intent(in),
optional :: InpComm
148 integer :: MyCOMM, MyError
150 character (len=*),
parameter :: MyFile = &
151 & __FILE__//
", mp_barrier"
159 CALL wclock_on (ng, model, 72, __line__, myfile)
167 IF (
PRESENT(inpcomm))
THEN
179 CALL mpi_barrier (mycomm, myerror)
187 CALL wclock_off (ng, model, 72, __line__, myfile)
193# ifdef SINGLE_PRECISION
218 integer,
intent(in) :: ng, model
220 integer,
intent(in),
optional :: InpComm
222 real(dp),
intent(inout) :: A
226 integer :: Lstr, MyCOMM, MyError, Npts, Serror
228 character (len=MPI_MAX_ERROR_STRING) :: string
230 character (len=*),
parameter :: MyFile = &
231 & __FILE__//
", mp_bcastf_0dp"
239 CALL wclock_on (ng, model, 64, __line__, myfile)
247 IF (
PRESENT(inpcomm))
THEN
261 IF (myerror.ne.mpi_success)
THEN
262 CALL mpi_error_string (myerror, string, lstr, serror)
263 lstr=len_trim(string)
264 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
265 10
FORMAT (/,
' MP_BCASTF_0DP - error during ',a,
' call, Task = ', &
266 & i3.3,
' Error = ',i3,/,13x,a)
277 CALL wclock_off (ng, model, 64, __line__, myfile)
306 integer,
intent(in) :: ng, model
308 integer,
intent(in),
optional :: InpComm
310 real(dp),
intent(inout) :: A(:)
314 integer :: Lstr, MyCOMM, MyError, Npts, Serror
316 character (len=MPI_MAX_ERROR_STRING) :: string
318 character (len=*),
parameter :: MyFile = &
319 & __FILE__//
", mp_bcastf_1dp"
327 CALL wclock_on (ng, model, 64, __line__, myfile)
335 IF (
PRESENT(inpcomm))
THEN
346 npts=ubound(a, dim=1)
350 IF (myerror.ne.mpi_success)
THEN
351 CALL mpi_error_string (myerror, string, lstr, serror)
352 lstr=len_trim(string)
353 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
354 10
FORMAT (/,
' MP_BCASTF_1DP - error during ',a,
' call, Task = ', &
355 & i3.3,
' Error = ',i3,/,13x,a)
366 CALL wclock_off (ng, model, 64, __line__, myfile)
395 integer,
intent(in) :: ng, model
397 integer,
intent(in),
optional :: InpComm
399 real(dp),
intent(inout) :: A(:,:)
403 integer :: Lstr, MyCOMM, MyError, Npts, Serror
407 character (len=MPI_MAX_ERROR_STRING) :: string
409 character (len=*),
parameter :: MyFile = &
410 & __FILE__//
", mp_bcastf_2dp"
418 CALL wclock_on (ng, model, 64, __line__, myfile)
426 IF (
PRESENT(inpcomm))
THEN
437 asize(1)=ubound(a, dim=1)
438 asize(2)=ubound(a, dim=2)
439 npts=asize(1)*asize(2)
443 IF (myerror.ne.mpi_success)
THEN
444 CALL mpi_error_string (myerror, string, lstr, serror)
445 lstr=len_trim(string)
446 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
447 10
FORMAT (/,
' MP_BCASTF_2DP - error during ',a,
' call, Task = ', &
448 & i3.3,
' Error = ',i3,/,13x,a)
459 CALL wclock_off (ng, model, 64, __line__, myfile)
488 integer,
intent(in) :: ng, model
490 integer,
intent(in),
optional :: InpComm
492 real(dp),
intent(inout) :: A(:,:,:)
496 integer :: Lstr, MyCOMM, MyError, Npts, Serror
500 character (len=MPI_MAX_ERROR_STRING) :: string
502 character (len=*),
parameter :: MyFile = &
503 & __FILE__//
", mp_bcastf_3d"
511 CALL wclock_on (ng, model, 64, __line__, myfile)
519 IF (
PRESENT(inpcomm))
THEN
530 asize(1)=ubound(a, dim=1)
531 asize(2)=ubound(a, dim=2)
532 asize(3)=ubound(a, dim=3)
533 npts=asize(1)*asize(2)*asize(3)
537 IF (myerror.ne.mpi_success)
THEN
538 CALL mpi_error_string (myerror, string, lstr, serror)
539 lstr=len_trim(string)
540 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
541 10
FORMAT (/,
' MP_BCASTF_3DP - error during ',a,
' call, Task = ', &
542 & i3.3,
' Error = ',i3,/,13x,a)
553 CALL wclock_off (ng, model, 64, __line__, myfile)
583 integer,
intent(in) :: ng, model
585 integer,
intent(in),
optional :: InpComm
587 real(r8),
intent(inout) :: A
591 integer :: Lstr, MyCOMM, MyError, Npts, Serror
593 character (len=MPI_MAX_ERROR_STRING) :: string
595 character (len=*),
parameter :: MyFile = &
596 & __FILE__//
", mp_bcastf_0d"
604 CALL wclock_on (ng, model, 64, __line__, myfile)
612 IF (
PRESENT(inpcomm))
THEN
626 IF (myerror.ne.mpi_success)
THEN
627 CALL mpi_error_string (myerror, string, lstr, serror)
628 lstr=len_trim(string)
629 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
630 10
FORMAT (/,
' MP_BCASTF_0D - error during ',a,
' call, Task = ', &
631 & i3.3,
' Error = ',i3,/,13x,a)
642 CALL wclock_off (ng, model, 64, __line__, myfile)
671 integer,
intent(in) :: ng, model
673 integer,
intent(in),
optional :: InpComm
675 real(r8),
intent(inout) :: A(:)
679 integer :: Lstr, MyCOMM, MyError, Npts, Serror
681 character (len=MPI_MAX_ERROR_STRING) :: string
683 character (len=*),
parameter :: MyFile = &
684 & __FILE__//
", mp_bcastf_1d"
692 CALL wclock_on (ng, model, 64, __line__, myfile)
700 IF (
PRESENT(inpcomm))
THEN
711 npts=ubound(a, dim=1)
715 IF (myerror.ne.mpi_success)
THEN
716 CALL mpi_error_string (myerror, string, lstr, serror)
717 lstr=len_trim(string)
718 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
719 10
FORMAT (/,
' MP_BCASTF_1D - error during ',a,
' call, Task = ', &
720 & i3.3,
' Error = ',i3,/,13x,a)
731 CALL wclock_off (ng, model, 64, __line__, myfile)
760 integer,
intent(in) :: ng, model
762 integer,
intent(in),
optional :: InpComm
764 real(r8),
intent(inout) :: A(:,:)
768 integer :: Lstr, MyCOMM, MyError, Npts, Serror
772 character (len=MPI_MAX_ERROR_STRING) :: string
774 character (len=*),
parameter :: MyFile = &
775 & __FILE__//
", mp_bcastf_2d"
783 CALL wclock_on (ng, model, 64, __line__, myfile)
791 IF (
PRESENT(inpcomm))
THEN
802 asize(1)=ubound(a, dim=1)
803 asize(2)=ubound(a, dim=2)
804 npts=asize(1)*asize(2)
808 IF (myerror.ne.mpi_success)
THEN
809 CALL mpi_error_string (myerror, string, lstr, serror)
810 lstr=len_trim(string)
811 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
812 10
FORMAT (/,
' MP_BCASTF_2D - error during ',a,
' call, Task = ', &
813 & i3.3,
' Error = ',i3,/,13x,a)
824 CALL wclock_off (ng, model, 64, __line__, myfile)
853 integer,
intent(in) :: ng, model
855 integer,
intent(in),
optional :: InpComm
857 real(r8),
intent(inout) :: A(:,:,:)
861 integer :: Lstr, MyCOMM, MyError, Npts, Serror
865 character (len=MPI_MAX_ERROR_STRING) :: string
867 character (len=*),
parameter :: MyFile = &
868 & __FILE__//
", mp_bcastf_3d"
876 CALL wclock_on (ng, model, 64, __line__, myfile)
884 IF (
PRESENT(inpcomm))
THEN
895 asize(1)=ubound(a, dim=1)
896 asize(2)=ubound(a, dim=2)
897 asize(3)=ubound(a, dim=3)
898 npts=asize(1)*asize(2)*asize(3)
902 IF (myerror.ne.mpi_success)
THEN
903 CALL mpi_error_string (myerror, string, lstr, serror)
904 lstr=len_trim(string)
905 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
906 10
FORMAT (/,
' MP_BCASTF_3D - error during ',a,
' call, Task = ', &
907 & i3.3,
' Error = ',i3,/,13x,a)
918 CALL wclock_off (ng, model, 64, __line__, myfile)
946 integer,
intent(in) :: ng, model
948 integer,
intent(in),
optional :: InpComm
950 real(r8),
intent(inout) :: A(:,:,:,:)
954 integer :: Lstr, MyCOMM, MyError, Npts, Serror
958 character (len=MPI_MAX_ERROR_STRING) :: string
960 character (len=*),
parameter :: MyFile = &
961 & __FILE__//
", mp_bcastf_4d"
969 CALL wclock_on (ng, model, 64, __line__, myfile)
977 IF (
PRESENT(inpcomm))
THEN
988 asize(1)=ubound(a, dim=1)
989 asize(2)=ubound(a, dim=2)
990 asize(3)=ubound(a, dim=3)
991 asize(4)=ubound(a, dim=4)
992 npts=asize(1)*asize(2)*asize(3)*asize(4)
996 IF (myerror.ne.mpi_success)
THEN
997 CALL mpi_error_string (myerror, string, lstr, serror)
998 lstr=len_trim(string)
999 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
1000 10
FORMAT (/,
' MP_BCASTF_4D - error during ',a,
' call, Task = ', &
1001 & i3.3,
' Error = ',i3,/,13x,a)
1012 CALL wclock_off (ng, model, 64, __line__, myfile)
1041 integer,
intent(in) :: ng, model
1043 integer,
intent(in),
optional :: InpComm
1045 integer,
intent(inout) :: A
1049 integer :: Lstr, MyCOMM, MyError, Npts, Serror
1051 character (len=MPI_MAX_ERROR_STRING) :: string
1053 character (len=*),
parameter :: MyFile = &
1054 & __FILE__//
", mp_bcasti_0d"
1063 CALL wclock_on (ng, model, 64, __line__, myfile)
1072 IF (
PRESENT(inpcomm))
THEN
1087 IF (myerror.ne.mpi_success)
THEN
1088 CALL mpi_error_string (myerror, string, lstr, serror)
1089 lstr=len_trim(string)
1090 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
1091 10
FORMAT (/,
' MP_BCASTI_0D - error during ',a,
' call, Task = ', &
1092 & i3.3,
' Error = ',i3,/,13x,a)
1103 CALL wclock_off (ng, model, 64, __line__, myfile)
1133 integer,
intent(in) :: ng, model
1135 integer,
intent(in),
optional :: InpComm
1137 integer,
intent(inout) :: A(:)
1141 integer :: Lstr, MyCOMM, MyError, Npts, Serror
1143 character (len=MPI_MAX_ERROR_STRING) :: string
1145 character (len=*),
parameter :: MyFile = &
1146 & __FILE__//
", mp_bcasti_1d"
1154 CALL wclock_on (ng, model, 64, __line__, myfile)
1162 IF (
PRESENT(inpcomm))
THEN
1173 npts=ubound(a, dim=1)
1176 CALL mpi_bcast (a, npts, mpi_integer,
mymaster, mycomm, myerror)
1177 IF (myerror.ne.mpi_success)
THEN
1178 CALL mpi_error_string (myerror, string, lstr, serror)
1179 lstr=len_trim(string)
1180 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
1181 10
FORMAT (/,
' MP_BCASTI_1D - error during ',a,
' call, Task = ', &
1182 & i3.3,
' Error = ',i3,/,13x,a)
1193 CALL wclock_off (ng, model, 64, __line__, myfile)
1222 integer,
intent(in) :: ng, model
1224 integer,
intent(in),
optional :: InpComm
1226 integer,
intent(inout) :: A(:,:)
1230 integer :: Lstr, MyCOMM, MyError, Npts, Serror
1233 character (len=MPI_MAX_ERROR_STRING) :: string
1235 character (len=*),
parameter :: MyFile = &
1236 & __FILE__//
", mp_bcasti_2d"
1244 CALL wclock_on (ng, model, 64, __line__, myfile)
1252 IF (
PRESENT(inpcomm))
THEN
1263 asize(1)=ubound(a, dim=1)
1264 asize(2)=ubound(a, dim=2)
1265 npts=asize(1)*asize(2)
1268 CALL mpi_bcast (a, npts, mpi_integer,
mymaster, mycomm, myerror)
1269 IF (myerror.ne.mpi_success)
THEN
1270 CALL mpi_error_string (myerror, string, lstr, serror)
1271 lstr=len_trim(string)
1272 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
1273 10
FORMAT (/,
' MP_BCASTI_2D - error during ',a,
' call, Task = ', &
1274 & i3.3,
' Error = ',i3,/,13x,a)
1285 CALL wclock_off (ng, model, 64, __line__, myfile)
1314 integer,
intent(in) :: ng, model
1316 integer,
intent(in),
optional :: InpComm
1318 logical,
intent(inout) :: A
1322 integer :: Lstr, MyCOMM, MyError, Npts, Serror
1324 character (len=MPI_MAX_ERROR_STRING) :: string
1326 character (len=*),
parameter :: MyFile = &
1327 & __FILE__//
", mp_bcastl_0d"
1335 CALL wclock_on (ng, model, 64, __line__, myfile)
1343 IF (
PRESENT(inpcomm))
THEN
1356 CALL mpi_bcast (a, npts, mpi_logical,
mymaster, mycomm, myerror)
1357 IF (myerror.ne.mpi_success)
THEN
1358 CALL mpi_error_string (myerror, string, lstr, serror)
1359 lstr=len_trim(string)
1360 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
1361 10
FORMAT (/,
' MP_BCASTL_0D - error during ',a,
' call, Task = ', &
1362 & i3.3,
' Error = ',i3,/,13x,a)
1373 CALL wclock_off (ng, model, 64, __line__, myfile)
1402 integer,
intent(in) :: ng, model
1404 integer,
intent(in),
optional :: InpComm
1406 logical,
intent(inout) :: A(:)
1410 integer :: Lstr, MyCOMM, MyError, Npts, Serror
1412 character (len=MPI_MAX_ERROR_STRING) :: string
1414 character (len=*),
parameter :: MyFile = &
1415 & __FILE__//
", mp_bcastl_1d"
1423 CALL wclock_on (ng, model, 64, __line__, myfile)
1431 IF (
PRESENT(inpcomm))
THEN
1442 npts=ubound(a, dim=1)
1445 CALL mpi_bcast (a, npts, mpi_logical,
mymaster, mycomm, myerror)
1446 IF (myerror.ne.mpi_success)
THEN
1447 CALL mpi_error_string (myerror, string, lstr, serror)
1448 lstr=len_trim(string)
1449 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
1450 10
FORMAT (/,
' MP_BCASTL_1D - error during ',a,
' call, Task = ', &
1451 & i3.3,
' Error = ',i3,/,13x,a)
1462 CALL wclock_off (ng, model, 64, __line__, myfile)
1491 integer,
intent(in) :: ng, model
1493 integer,
intent(in),
optional :: InpComm
1495 logical,
intent(inout) :: A(:,:)
1499 integer :: Lstr, MyCOMM, MyError, Npts, Serror
1502 character (len=MPI_MAX_ERROR_STRING) :: string
1504 character (len=*),
parameter :: MyFile = &
1505 & __FILE__//
", mp_bcastl_2d"
1513 CALL wclock_on (ng, model, 64, __line__, myfile)
1521 IF (
PRESENT(inpcomm))
THEN
1532 asize(1)=ubound(a, dim=1)
1533 asize(2)=ubound(a, dim=2)
1534 npts=asize(1)*asize(2)
1537 CALL mpi_bcast (a, npts, mpi_logical,
mymaster, mycomm, myerror)
1538 IF (myerror.ne.mpi_success)
THEN
1539 CALL mpi_error_string (myerror, string, lstr, serror)
1540 lstr=len_trim(string)
1541 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
1542 10
FORMAT (/,
' MP_BCASTL_2D - error during ',a,
' call, Task = ', &
1543 & i3.3,
' Error = ',i3,/,13x,a)
1554 CALL wclock_off (ng, model, 64, __line__, myfile)
1582 integer,
intent(in) :: ng, model
1584 integer,
intent(in),
optional :: InpComm
1586 character (len=*),
intent(inout) :: A
1590 integer :: Lstr, MyCOMM, MyError, Nchars, Serror
1592 character (len=MPI_MAX_ERROR_STRING) :: string
1594 character (len=*),
parameter :: MyFile = &
1595 & __FILE__//
", mp_bcasts_0d"
1604 CALL wclock_on (ng, model, 64, __line__, myfile)
1613 IF (
PRESENT(inpcomm))
THEN
1626 CALL mpi_bcast (a, nchars, mpi_byte,
mymaster, mycomm, myerror)
1627 IF (myerror.ne.mpi_success)
THEN
1628 CALL mpi_error_string (myerror, string, lstr, serror)
1629 lstr=len_trim(string)
1630 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
1631 10
FORMAT (/,
' MP_BCASTS_0D - error during ',a,
' call, Task = ', &
1632 & i3.3,
' Error = ',i3,/,13x,a)
1644 CALL wclock_off (ng, model, 64, __line__, myfile)
1673 integer,
intent(in) :: ng, model
1675 integer,
intent(in),
optional :: InpComm
1677 character (len=*),
intent(inout) :: A(:)
1681 integer :: Asize, Lstr, MyCOMM, MyError, Nchars, Serror
1683 character (len=MPI_MAX_ERROR_STRING) :: string
1685 character (len=*),
parameter :: MyFile = &
1686 & __FILE__//
", mp_bcasts_1d"
1694 CALL wclock_on (ng, model, 64, __line__, myfile)
1702 IF (
PRESENT(inpcomm))
THEN
1713 asize=ubound(a, dim=1)
1714 nchars=len(a(1))*asize
1717 CALL mpi_bcast (a, nchars, mpi_byte,
mymaster, mycomm, myerror)
1718 IF (myerror.ne.mpi_success)
THEN
1719 CALL mpi_error_string (myerror, string, lstr, serror)
1720 lstr=len_trim(string)
1721 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
1722 10
FORMAT (/,
' MP_BCASTS_1D - error during ',a,
' call, Task = ', &
1723 & i3.3,
' Error = ',i3,/,13x,a)
1734 CALL wclock_off (ng, model, 64, __line__, myfile)
1762 integer,
intent(in) :: ng, model
1764 integer,
intent(in),
optional :: InpComm
1766 character (len=*),
intent(inout) :: A(:,:)
1770 integer :: Lstr, MyCOMM, MyError, Nchars, Serror
1773 character (len=MPI_MAX_ERROR_STRING) :: string
1775 character (len=*),
parameter :: MyFile = &
1776 & __FILE__//
", mp_bcasts_2d"
1784 CALL wclock_on (ng, model, 64, __line__, myfile)
1792 IF (
PRESENT(inpcomm))
THEN
1803 asize(1)=ubound(a, dim=1)
1804 asize(2)=ubound(a, dim=2)
1805 nchars=len(a(1,1))*asize(1)*asize(2)
1808 CALL mpi_bcast (a, nchars, mpi_byte,
mymaster, mycomm, myerror)
1809 IF (myerror.ne.mpi_success)
THEN
1810 CALL mpi_error_string (myerror, string, lstr, serror)
1811 lstr=len_trim(string)
1812 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
1813 10
FORMAT (/,
' MP_BCASTS_2D - error during ',a,
' call, Task = ', &
1814 & i3.3,
' Error = ',i3,/,13x,a)
1825 CALL wclock_off (ng, model, 64, __line__, myfile)
1853 integer,
intent(in) :: ng, model
1855 integer,
intent(in),
optional :: InpComm
1857 character (len=*),
intent(inout) :: A(:,:,:)
1861 integer :: Lstr, MyCOMM, MyError, Nchars, Serror
1864 character (len=MPI_MAX_ERROR_STRING) :: string
1866 character (len=*),
parameter :: MyFile = &
1867 & __FILE__//
", mp_bcasts_3d"
1875 CALL wclock_on (ng, model, 64, __line__, myfile)
1883 IF (
PRESENT(inpcomm))
THEN
1894 asize(1)=ubound(a, dim=1)
1895 asize(2)=ubound(a, dim=2)
1896 asize(3)=ubound(a, dim=3)
1897 nchars=len(a(1,1,1))*asize(1)*asize(2)*asize(3)
1900 CALL mpi_bcast (a, nchars, mpi_byte,
mymaster, mycomm, myerror)
1901 IF (myerror.ne.mpi_success)
THEN
1902 CALL mpi_error_string (myerror, string, lstr, serror)
1903 lstr=len_trim(string)
1904 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
1905 10
FORMAT (/,
' MP_BCASTS_3D - error during ',a,
' call, Task = ', &
1906 & i3.3,
' Error = ',i3,/,13x,a)
1917 CALL wclock_off (ng, model, 64, __line__, myfile)
1946 integer,
intent(in) :: ng, model
1948 integer,
intent(in),
optional :: InpComm
1950 TYPE(
t_io),
intent(inout) :: S(:)
1954 integer :: Lstr, MyCOMM, MyError, Nchars, Npts, Serror
1955 integer :: ibuffer(5)
1957 character (len=MPI_MAX_ERROR_STRING) :: string
1959 character (len=*),
parameter :: MyFile = &
1960 & __FILE__//
", mp_bcast_struc"
1968 CALL wclock_on (ng, model, 64, __line__, myfile)
1976 IF (
PRESENT(inpcomm))
THEN
1991 ibuffer(1)=s(ng)%Nfiles
1992 ibuffer(2)=s(ng)%Fcount
1993 ibuffer(3)=s(ng)%load
1994 ibuffer(4)=s(ng)%Rindex
1995 ibuffer(5)=s(ng)%ncid
1998 CALL mpi_bcast (ibuffer, npts, mpi_integer,
mymaster, &
2000 IF (myerror.ne.mpi_success)
THEN
2001 CALL mpi_error_string (myerror, string, lstr, serror)
2002 lstr=len_trim(string)
2003 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
2004 10
FORMAT (/,
' MP_BCAST_STRUC - error during ',a,
' call, Task = ', &
2005 & i3.3,
' Error = ',i3,/,13x,a)
2009 s(ng)%Nfiles=ibuffer(1)
2010 s(ng)%Fcount=ibuffer(2)
2011 s(ng)%load =ibuffer(3)
2012 s(ng)%Rindex=ibuffer(4)
2013 s(ng)%ncid =ibuffer(5)
2018 npts=ubound(s(ng)%Vid, dim=1)
2019 CALL mpi_bcast (s(ng)%Vid, npts, mpi_integer,
mymaster, &
2021 IF (myerror.ne.mpi_success)
THEN
2022 CALL mpi_error_string (myerror, string, lstr, serror)
2023 lstr=len_trim(string)
2024 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
2033 npts=ubound(s(ng)%Tid, dim=1)
2034 CALL mpi_bcast (s(ng)%Tid, npts, mpi_integer,
mymaster, &
2036 IF (myerror.ne.mpi_success)
THEN
2037 CALL mpi_error_string (myerror, string, lstr, serror)
2038 lstr=len_trim(string)
2039 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
2047 nchars=len(s(ng)%head)
2048 CALL mpi_bcast (s(ng)%head, nchars, mpi_byte,
mymaster, &
2050 IF (myerror.ne.mpi_success)
THEN
2051 CALL mpi_error_string (myerror, string, lstr, serror)
2052 lstr=len_trim(string)
2053 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
2058 nchars=len(s(ng)%base)
2059 CALL mpi_bcast (s(ng)%base, nchars, mpi_byte,
mymaster, &
2061 IF (myerror.ne.mpi_success)
THEN
2062 CALL mpi_error_string (myerror, string, lstr, serror)
2063 lstr=len_trim(string)
2064 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
2069 nchars=len(s(ng)%name)
2070 CALL mpi_bcast (s(ng)%name, nchars, mpi_byte,
mymaster, &
2072 IF (myerror.ne.mpi_success)
THEN
2073 CALL mpi_error_string (myerror, string, lstr, serror)
2074 lstr=len_trim(string)
2075 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
2080 nchars=len(s(ng)%files(1))*s(ng)%Nfiles
2081 CALL mpi_bcast (s(ng)%files, nchars, mpi_byte,
mymaster, &
2083 IF (myerror.ne.mpi_success)
THEN
2084 CALL mpi_error_string (myerror, string, lstr, serror)
2085 lstr=len_trim(string)
2086 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
2097 CALL wclock_off (ng, model, 64, __line__, myfile)
2104 & LBi, UBi, LBk, UBk, &
2138 logical,
intent(in) :: update
2140 integer,
intent(in) :: ng, model, Imin, Imax
2141 integer,
intent(in) :: LBi, UBi, LBk, UBk
2143 real(r8),
intent(inout) :: A(LBi:UBi,LBk:UBk)
2147 integer :: Ilen, Ioff, Lstr, MyError, Nnodes, Npts, Serror
2148 integer :: i, ik, k, kc, rank
2150 real(r8),
dimension((UBi-LBi+1)*(UBk-LBk+1)) :: Asend
2152# if defined BOUNDARY_ALLGATHER
2153 real(r8),
dimension((UBi-LBi+1)*(UBk-LBk+1), &
& 0:NtileI(ng)*NtileJ(ng)-1) :: Arecv
2154# elif defined BOUNDARY_ALLREDUCE
2155 real(r8),
dimension((UBi-LBi+1)*(UBk-LBk+1)) :: Arecv
2158 character (len=MPI_MAX_ERROR_STRING) :: string
2160 character (len=*),
parameter :: MyFile = &
2161 & __FILE__//
", mp_boundary"
2169 CALL wclock_on (ng, model, 68, __line__, myfile)
2181 &
SIZE(arecv))*kind(a),r8))
2189 npts=ilen*(ubk-lbk+1)
2211# if defined BOUNDARY_ALLGATHER
2214 IF (myerror.ne.mpi_success)
THEN
2215 CALL mpi_error_string (myerror, string, lstr, serror)
2216 lstr=len_trim(string)
2219 10
FORMAT (/,
' MP_BOUNDARY - error during ',a,
' call, Task = ', &
2220 & i3.3,
' Error = ',i3,/,15x,a)
2224# elif defined BOUNDARY_ALLREDUCE
2225 CALL mpi_allreduce (asend, arecv, npts,
mp_float, mpi_sum, &
2227 IF (myerror.ne.mpi_success)
THEN
2228 CALL mpi_error_string (myerror, string, lstr, serror)
2229 lstr=len_trim(string)
2232 10
FORMAT (/,
' MP_BOUNDARY - error during ',a,
' call, Task = ', &
2233 & i3.3,
' Error = ',i3,/,15x,a)
2244# if defined BOUNDARY_ALLGATHER
2252 a(i,k)=a(i,k)+arecv(ik,rank)
2256# elif defined BOUNDARY_ALLREDUCE
2271 CALL wclock_off (ng, model, 68, __line__, myfile)
2304 integer,
intent(in) :: ng, model, Npts
2306 integer,
intent(in),
optional :: InpComm
2308 real(r8),
intent(in) :: Aspv
2310 real(r8),
intent(inout) :: A(:)
2314 integer :: Lstr, MyCOMM, MyError, MyNpts, Nnodes, Serror
2315 integer :: i, rank, request
2317 integer,
dimension(MPI_STATUS_SIZE) :: status
2319# if defined ASSEMBLE_ALLGATHER
2320 real(r8),
dimension(Npts,0:NtileI(ng)*NtileJ(ng)-1) :: Arecv
2321# elif defined ASSEMBLE_ALLREDUCE
2322 real(r8),
dimension(Npts) :: Asend
2323# elif defined ASSEMBLE_SENDRECV
2324 real(r8),
allocatable :: Arecv(:)
2327 character (len=MPI_MAX_ERROR_STRING) :: string
2329 character (len=*),
parameter :: MyFile = &
2330 & __FILE__//
", mp_assemblef_1d"
2338 CALL wclock_on (ng, model, 70, __line__, myfile)
2346 IF (
PRESENT(inpcomm))
THEN
2359# if defined ASSEMBLE_ALLGATHER
2365 mynpts=ubound(a, dim=1)
2366 IF (npts.ne.mynpts)
THEN
2368 WRITE (
stdout,10) npts, mynpts
2373 IF (aspv.ne.0.0_r8)
THEN
2384# if defined ASSEMBLE_ALLGATHER
2387 IF (myerror.ne.mpi_success)
THEN
2388 CALL mpi_error_string (myerror, string, lstr, serror)
2389 lstr=len_trim(string)
2399 IF (aspv.eq.0.0_r8)
THEN
2403 a(i)=a(i)+arecv(i,rank)
2409 IF (arecv(i,rank).ne.aspv)
THEN
2416# elif defined ASSEMBLE_ALLREDUCE
2426 CALL mpi_allreduce (asend, a, npts,
mp_float, mpi_sum, &
2428 IF (myerror.ne.mpi_success)
THEN
2429 CALL mpi_error_string (myerror, string, lstr, serror)
2430 lstr=len_trim(string)
2437# elif defined ASSEMBLE_SENDRECV
2443 IF (.not.
allocated(arecv))
THEN
2444 allocate (arecv(npts))
2451 CALL mpi_irecv (arecv, npts,
mp_float, rank, rank+5, &
2452 & mycomm, request, myerror)
2453 CALL mpi_wait (request, status, myerror)
2454 IF (myerror.ne.mpi_success)
THEN
2455 CALL mpi_error_string (myerror, string, lstr, serror)
2456 lstr=len_trim(string)
2457 WRITE (
stdout,30)
'MPI_IRECV', rank, myerror, string(1:lstr)
2471 & mycomm, request, myerror)
2472 CALL mpi_wait (request, status, myerror)
2473 IF (myerror.ne.mpi_success)
THEN
2474 CALL mpi_error_string (myerror, string, lstr, serror)
2475 lstr=len_trim(string)
2476 WRITE (
stdout,30)
'MPI_ISEND',
myrank, myerror, string(1:lstr)
2485 IF (myerror.ne.mpi_success)
THEN
2486 CALL mpi_error_string (myerror, string, lstr, serror)
2487 lstr=len_trim(string)
2488 WRITE (
stdout,30)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
2500 CALL wclock_off (ng, model, 70, __line__, myfile)
2503 10
FORMAT (/,
' MP_ASSEMBLEF_1D - inconsistent array size, Npts = ', &
2504 & i10,2x,i10,/,19x,
'number of addressed array elements ', &
2506 20
FORMAT (/,
' MP_ASSEMBLEF_1D - illegal special value, Aspv = ', &
2507 & 1p,e17.10,/,19x,
'a zero value is needed for global ', &
2509 30
FORMAT (/,
' MP_ASSEMBLEF_1D - error during ',a,
' call, Task = ', &
2510 & i3.3,
' Error = ',i3,/,19x,a)
2542 integer,
intent(in) :: ng, model, Npts
2544 integer,
intent(in),
optional :: InpComm
2546 real(r8),
intent(in) :: Aspv
2548 real(r8),
intent(inout) :: A(:,:)
2552 integer :: Lstr, MyCOMM, MyError, MyNpts, Nnodes, Serror
2553 integer :: i, rank, request
2557 integer,
dimension(MPI_STATUS_SIZE) :: status
2559# if defined ASSEMBLE_ALLGATHER
2560 real(r8),
dimension(Npts,0:NtileI(ng)*NtileJ(ng)-1) :: Arecv
2561 real(r8),
dimension(Npts) :: Asend
2562# elif defined ASSEMBLE_ALLREDUCE
2563 real(r8),
dimension(Npts) :: Arecv, Asend
2564# elif defined ASSEMBLE_SENDRECV
2565 real(r8),
allocatable :: Arecv(:)
2566 real(r8),
dimension(Npts) :: Asend
2569 character (len=MPI_MAX_ERROR_STRING) :: string
2571 character (len=*),
parameter :: MyFile = &
2572 & __FILE__//
", mp_assemblef_2d"
2580 CALL wclock_on (ng, model, 70, __line__, myfile)
2588 IF (
PRESENT(inpcomm))
THEN
2601# if defined ASSEMBLE_ALLGATHER
2602 bmemmax(ng)=max(
bmemmax(ng), real((npts+
SIZE(arecv))*kind(a),r8))
2607 asize(1)=ubound(a, dim=1)
2608 asize(2)=ubound(a, dim=2)
2609 mynpts=asize(1)*asize(2)
2610 IF (npts.ne.mynpts)
THEN
2612 WRITE (
stdout,10) npts, mynpts
2617 IF (aspv.ne.0.0_r8)
THEN
2630 asend=reshape(a, (/npts/))
2632# if defined ASSEMBLE_ALLGATHER
2638 IF (myerror.ne.mpi_success)
THEN
2639 CALL mpi_error_string (myerror, string, lstr, serror)
2640 lstr=len_trim(string)
2650 IF (aspv.eq.0.0_r8)
THEN
2654 asend(i)=asend(i)+arecv(i,rank)
2660 IF (arecv(i,rank).ne.aspv)
THEN
2661 asend(i)=arecv(i,rank)
2669 a=reshape(asend, asize)
2671# elif defined ASSEMBLE_ALLREDUCE
2675 CALL mpi_allreduce (asend, arecv, npts,
mp_float, mpi_sum, &
2677 IF (myerror.ne.mpi_success)
THEN
2678 CALL mpi_error_string (myerror, string, lstr, serror)
2679 lstr=len_trim(string)
2688 a=reshape(arecv, asize)
2690# elif defined ASSEMBLE_SENDRECV
2696 IF (.not.
allocated(arecv))
THEN
2697 allocate (arecv(npts))
2704 CALL mpi_irecv (arecv, npts,
mp_float, rank, rank+5, &
2705 & mycomm, request, myerror)
2706 CALL mpi_wait (request, status, myerror)
2707 IF (myerror.ne.mpi_success)
THEN
2708 CALL mpi_error_string (myerror, string, lstr, serror)
2709 lstr=len_trim(string)
2710 WRITE (
stdout,30)
'MPI_IRECV', rank, myerror, string(1:lstr)
2715 asend(i)=asend(i)+arecv(i)
2722 a=reshape(asend, asize)
2728 & mycomm, request, myerror)
2729 CALL mpi_wait (request, status, myerror)
2730 IF (myerror.ne.mpi_success)
THEN
2731 CALL mpi_error_string (myerror, string, lstr, serror)
2732 lstr=len_trim(string)
2733 WRITE (
stdout,30)
'MPI_ISEND',
myrank, myerror, string(1:lstr)
2742 IF (myerror.ne.mpi_success)
THEN
2743 CALL mpi_error_string (myerror, string, lstr, serror)
2744 lstr=len_trim(string)
2745 WRITE (
stdout,30)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
2756 CALL wclock_off (ng, model, 70, __line__, myfile)
2759 10
FORMAT (/,
' MP_ASSEMBLEF_2D - inconsistent array size, Npts = ', &
2760 & i10,2x,i10,/,19x,
'number of addressed array elements ', &
2762 20
FORMAT (/,
' MP_ASSEMBLEF_2D - illegal special value, Aspv = ', &
2763 & 1p,e17.10,/,19x,
'a zero value is needed for global ', &
2765 30
FORMAT (/,
' MP_ASSEMBLEF_2D - error during ',a,
' call, Task = ', &
2766 & i3.3,
' Error = ',i3,/,19x,a)
2798 integer,
intent(in) :: ng, model, Npts
2800 integer,
intent(in),
optional :: InpComm
2802 real(r8),
intent(in) :: Aspv
2804 real(r8),
intent(inout) :: A(:,:,:)
2808 integer :: Lstr, MyCOMM, MyError, MyNpts, Nnodes, Serror
2809 integer :: i, rank, request
2813 integer,
dimension(MPI_STATUS_SIZE) :: status
2815# if defined ASSEMBLE_ALLGATHER
2816 real(r8),
dimension(Npts,0:NtileI(ng)*NtileJ(ng)-1) :: Arecv
2817 real(r8),
dimension(Npts) :: Asend
2818# elif defined ASSEMBLE_ALLREDUCE
2819 real(r8),
dimension(Npts) :: Arecv, Asend
2820# elif defined ASSEMBLE_SENDRECV
2821 real(r8),
allocatable :: Arecv(:)
2822 real(r8),
dimension(Npts) :: Asend
2825 character (len=MPI_MAX_ERROR_STRING) :: string
2827 character (len=*),
parameter :: MyFile = &
2828 & __FILE__//
", mp_assemblef_3d"
2836 CALL wclock_on (ng, model, 70, __line__, myfile)
2844 IF (
PRESENT(inpcomm))
THEN
2857# if defined ASSEMBLE_ALLGATHER
2858 bmemmax(ng)=max(
bmemmax(ng), real((npts+
SIZE(arecv))*kind(a),r8))
2863 asize(1)=ubound(a, dim=1)
2864 asize(2)=ubound(a, dim=2)
2865 asize(3)=ubound(a, dim=3)
2866 mynpts=asize(1)*asize(2)*asize(3)
2867 IF (npts.ne.mynpts)
THEN
2869 WRITE (
stdout,10) npts, mynpts
2874 IF (aspv.ne.0.0_r8)
THEN
2887 asend=reshape(a, (/npts/))
2889# if defined ASSEMBLE_ALLGATHER
2895 IF (myerror.ne.mpi_success)
THEN
2896 CALL mpi_error_string (myerror, string, lstr, serror)
2897 lstr=len_trim(string)
2907 IF (aspv.eq.0.0_r8)
THEN
2911 asend(i)=asend(i)+arecv(i,rank)
2917 IF (arecv(i,rank).ne.aspv)
THEN
2918 asend(i)=arecv(i,rank)
2926 a=reshape(asend, asize)
2928# elif defined ASSEMBLE_ALLREDUCE
2932 CALL mpi_allreduce (asend, arecv, npts,
mp_float, mpi_sum, &
2934 IF (myerror.ne.mpi_success)
THEN
2935 CALL mpi_error_string (myerror, string, lstr, serror)
2936 lstr=len_trim(string)
2945 a=reshape(arecv, asize)
2947# elif defined ASSEMBLE_SENDRECV
2953 IF (.not.
allocated(arecv))
THEN
2954 allocate (arecv(npts))
2961 CALL mpi_irecv (arecv, npts,
mp_float, rank, rank+5, &
2962 & mycomm, request, myerror)
2963 CALL mpi_wait (request, status, myerror)
2964 IF (myerror.ne.mpi_success)
THEN
2965 CALL mpi_error_string (myerror, string, lstr, serror)
2966 lstr=len_trim(string)
2967 WRITE (
stdout,30)
'MPI_IRECV', rank, myerror, string(1:lstr)
2972 asend(i)=asend(i)+arecv(i)
2979 a=reshape(asend, asize)
2985 & mycomm, request, myerror)
2986 CALL mpi_wait (request, status, myerror)
2987 IF (myerror.ne.mpi_success)
THEN
2988 CALL mpi_error_string (myerror, string, lstr, serror)
2989 lstr=len_trim(string)
2990 WRITE (
stdout,30)
'MPI_ISEND',
myrank, myerror, string(1:lstr)
2999 IF (myerror.ne.mpi_success)
THEN
3000 CALL mpi_error_string (myerror, string, lstr, serror)
3001 lstr=len_trim(string)
3002 WRITE (
stdout,30)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
3013 CALL wclock_off (ng, model, 70, __line__, myfile)
3016 10
FORMAT (/,
' MP_ASSEMBLEF_3D - inconsistent array size, Npts = ', &
3017 & i10,2x,i10,/,19x,
'number of addressed array elements ', &
3019 20
FORMAT (/,
' MP_ASSEMBLEF_3D - illegal special value, Aspv = ', &
3020 & 1p,e17.10,/,19x,
'a zero value is needed for global ', &
3022 30
FORMAT (/,
' MP_ASSEMBLEF_3D - error during ',a,
' call, Task = ', &
3023 & i3.3,
' Error = ',i3,/,19x,a)
3055 integer,
intent(in) :: ng, model, Npts
3057 integer,
intent(in),
optional :: InpComm
3059 integer,
intent(in) :: Aspv
3061 integer,
intent(inout) :: A(:)
3065 integer :: Lstr, MyCOMM, MyError, MyNpts, Nnodes, Serror
3066 integer :: i, rank, request
3068 integer,
dimension(MPI_STATUS_SIZE) :: status
3070# if defined ASSEMBLE_ALLGATHER
3071 integer,
dimension(Npts,0:NtileI(ng)*NtileJ(ng)-1) :: Arecv
3072# elif defined ASSEMBLE_ALLREDUCE
3073 integer,
dimension(Npts) :: Asend
3074# elif defined ASSEMBLE_SENDRECV
3075 integer,
allocatable :: Arecv(:)
3078 character (len=MPI_MAX_ERROR_STRING) :: string
3080 character (len=*),
parameter :: MyFile = &
3081 & __FILE__//
", mp_assemblei_1d"
3089 CALL wclock_on (ng, model, 70, __line__, myfile)
3097 IF (
PRESENT(inpcomm))
THEN
3110# if defined ASSEMBLE_ALLGATHER
3116 mynpts=ubound(a, dim=1)
3117 IF (npts.ne.mynpts)
THEN
3119 WRITE (
stdout,10) npts, mynpts
3135# if defined ASSEMBLE_ALLGATHER
3136 CALL mpi_allgather (a, npts, mpi_integer, &
3137 & arecv, npts, mpi_integer, &
3139 IF (myerror.ne.mpi_success)
THEN
3140 CALL mpi_error_string (myerror, string, lstr, serror)
3141 lstr=len_trim(string)
3151 IF (aspv.eq.0.0_r8)
THEN
3155 a(i)=a(i)+arecv(i,rank)
3161 IF (arecv(i,rank).ne.aspv)
THEN
3168# elif defined ASSEMBLE_ALLREDUCE
3178 CALL mpi_allreduce (asend, a, npts, mpi_integer, mpi_sum, &
3180 IF (myerror.ne.mpi_success)
THEN
3181 CALL mpi_error_string (myerror, string, lstr, serror)
3182 lstr=len_trim(string)
3189# elif defined ASSEMBLE_SENDRECV
3195 IF (.not.
allocated(arecv))
THEN
3196 allocate (arecv(npts))
3203 CALL mpi_irecv (arecv, npts, mpi_integer, rank, rank+5, &
3204 & mycomm, request, myerror)
3205 CALL mpi_wait (request, status, myerror)
3206 IF (myerror.ne.mpi_success)
THEN
3207 CALL mpi_error_string (myerror, string, lstr, serror)
3208 lstr=len_trim(string)
3209 WRITE (
stdout,30)
'MPI_IRECV', rank, myerror, string(1:lstr)
3223 & mycomm, request, myerror)
3224 CALL mpi_wait (request, status, myerror)
3225 IF (myerror.ne.mpi_success)
THEN
3226 CALL mpi_error_string (myerror, string, lstr, serror)
3227 lstr=len_trim(string)
3228 WRITE (
stdout,30)
'MPI_ISEND',
myrank, myerror, string(1:lstr)
3236 CALL mpi_bcast (a, npts, mpi_integer,
mymaster, mycomm, myerror)
3237 IF (myerror.ne.mpi_success)
THEN
3238 CALL mpi_error_string (myerror, string, lstr, serror)
3239 lstr=len_trim(string)
3240 WRITE (
stdout,30)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
3251 CALL wclock_off (ng, model, 70, __line__, myfile)
3254 10
FORMAT (/,
' MP_ASSEMBLEI_1D - inconsistent array size, Npts = ', &
3255 & i10,2x,i10,/,19x,
'number of addressed array elements ', &
3257 20
FORMAT (/,
' MP_ASSEMBLEI_1D - illegal special value, Aspv = ',i4, &
3258 & /,19x,
'a zero value is needed for global reduction.')
3259 30
FORMAT (/,
' MP_ASSEMBLEI_1D - error during ',a,
' call, Task = ', &
3260 & i3.3,
' Error = ',i3,/,19x,a)
3292 integer,
intent(in) :: ng, model, Npts
3294 integer,
intent(in),
optional :: InpComm
3296 integer,
intent(in) :: Aspv
3298 integer,
intent(inout) :: A(:,:)
3302 integer :: Lstr, MyCOMM, MyError, MyNpts, Nnodes, Serror
3303 integer :: i, rank, request
3307 integer,
dimension(MPI_STATUS_SIZE) :: status
3309# if defined ASSEMBLE_ALLGATHER
3310 integer,
dimension(Npts,0:NtileI(ng)*NtileJ(ng)-1) :: Arecv
3311 integer,
dimension(Npts) :: Asend
3312# elif defined ASSEMBLE_ALLREDUCE
3313 integer,
dimension(Npts) :: Arecv, Asend
3314# elif defined ASSEMBLE_SENDRECV
3315 integer,
allocatable :: Arecv(:)
3316 integer,
dimension(Npts) :: Asend
3319 character (len=MPI_MAX_ERROR_STRING) :: string
3321 character (len=*),
parameter :: MyFile = &
3322 & __FILE__//
", mp_assemblei_2d"
3330 CALL wclock_on (ng, model, 70, __line__, myfile)
3338 IF (
PRESENT(inpcomm))
THEN
3351# if defined ASSEMBLE_ALLGATHER
3352 bmemmax(ng)=max(
bmemmax(ng), real((npts+
SIZE(arecv))*kind(a),r8))
3357 asize(1)=ubound(a, dim=1)
3358 asize(2)=ubound(a, dim=2)
3359 mynpts=asize(1)*asize(2)
3360 IF (npts.ne.mynpts)
THEN
3362 WRITE (
stdout,10) npts, mynpts
3380 asend=reshape(a, (/npts/))
3382# if defined ASSEMBLE_ALLGATHER
3386 CALL mpi_allgather (asend, npts, mpi_integer, &
3387 & arecv, npts, mpi_integer, &
3389 IF (myerror.ne.mpi_success)
THEN
3390 CALL mpi_error_string (myerror, string, lstr, serror)
3391 lstr=len_trim(string)
3401 IF (aspv.eq.0.0_r8)
THEN
3405 asend(i)=asend(i)+arecv(i,rank)
3411 IF (arecv(i,rank).ne.aspv)
THEN
3412 asend(i)=arecv(i,rank)
3420 a=reshape(asend, asize)
3422# elif defined ASSEMBLE_ALLREDUCE
3426 CALL mpi_allreduce (asend, arecv, npts, mpi_integer, mpi_sum, &
3428 IF (myerror.ne.mpi_success)
THEN
3429 CALL mpi_error_string (myerror, string, lstr, serror)
3430 lstr=len_trim(string)
3439 a=reshape(arecv, asize)
3441# elif defined ASSEMBLE_SENDRECV
3447 IF (.not.
allocated(arecv))
THEN
3448 allocate (arecv(npts))
3455 CALL mpi_irecv (arecv, npts, mpi_integer, rank, rank+5, &
3456 & mycomm, request, myerror)
3457 CALL mpi_wait (request, status, myerror)
3458 IF (myerror.ne.mpi_success)
THEN
3459 CALL mpi_error_string (myerror, string, lstr, serror)
3460 lstr=len_trim(string)
3461 WRITE (
stdout,30)
'MPI_IRECV', rank, myerror, string(1:lstr)
3466 asend(i)=asend(i)+arecv(i)
3473 a=reshape(asend, asize)
3479 & mycomm, request, myerror)
3480 CALL mpi_wait (request, status, myerror)
3481 IF (myerror.ne.mpi_success)
THEN
3482 CALL mpi_error_string (myerror, string, lstr, serror)
3483 lstr=len_trim(string)
3484 WRITE (
stdout,30)
'MPI_ISEND',
myrank, myerror, string(1:lstr)
3492 CALL mpi_bcast (a, npts, mpi_integer,
mymaster, mycomm, myerror)
3493 IF (myerror.ne.mpi_success)
THEN
3494 CALL mpi_error_string (myerror, string, lstr, serror)
3495 lstr=len_trim(string)
3496 WRITE (
stdout,30)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
3507 CALL wclock_off (ng, model, 70, __line__, myfile)
3510 10
FORMAT (/,
' MP_ASSEMBLEI_2D - inconsistent array size, Npts = ', &
3511 & i10,2x,i10,/,19x,
'number of addressed array elements ', &
3513 20
FORMAT (/,
' MP_ASSEMBLEI_2D - illegal special value, Aspv = ',i4, &
3514 & /,19x,
'a zero value is needed for global reduction.')
3515 30
FORMAT (/,
' MP_ASSEMBLEI_2D - error during ',a,
' call, Task = ', &
3516 & i3.3,
' Error = ',i3,/,19x,a)
3521 SUBROUTINE mp_collect_f (ng, model, Npts, Aspv, A, InpComm)
3548 integer,
intent(in) :: ng, model, Npts
3550 integer,
intent(in),
optional :: InpComm
3552 real(r8),
intent(in) :: Aspv
3554 real(r8),
intent(inout) :: A(Npts)
3558 integer :: Lstr, MyCOMM, MyError, Nnodes, Serror
3559 integer :: i, rank, request
3561 integer,
dimension(MPI_STATUS_SIZE) :: status
3563# if defined COLLECT_ALLGATHER
3564 real(r8),
dimension(Npts,0:NtileI(ng)*NtileJ(ng)-1) :: Arecv
3565# elif defined COLLECT_ALLREDUCE
3566 real(r8),
dimension(Npts) :: Asend
3568 real(r8),
allocatable :: Arecv(:)
3571 character (len=MPI_MAX_ERROR_STRING) :: string
3573 character (len=*),
parameter :: MyFile = &
3574 & __FILE__//
", mp_collect_f"
3582 CALL wclock_on (ng, model, 69, __line__, myfile)
3590 IF (
PRESENT(inpcomm))
THEN
3603# if defined COLLECT_ALLGATHER
3609# if defined COLLECT_ALLGATHER
3613 IF (myerror.ne.mpi_success)
THEN
3614 CALL mpi_error_string (myerror, string, lstr, serror)
3615 lstr=len_trim(string)
3625 IF (aspv.eq.0.0_r8)
THEN
3629 a(i)=a(i)+arecv(i,rank)
3635 IF (arecv(i,rank).ne.aspv)
THEN
3641# elif defined COLLECT_ALLREDUCE
3651 CALL mpi_allreduce (asend, a, npts,
mp_float, mpi_sum, &
3653 IF (myerror.ne.mpi_success)
THEN
3654 CALL mpi_error_string (myerror, string, lstr, serror)
3655 lstr=len_trim(string)
3667 IF (.not.
allocated(arecv))
THEN
3668 allocate (arecv(npts))
3675 CALL mpi_irecv (arecv, npts,
mp_float, rank, rank+5, &
3676 & mycomm, request, myerror)
3677 CALL mpi_wait (request, status, myerror)
3678 IF (myerror.ne.mpi_success)
THEN
3679 CALL mpi_error_string (myerror, string, lstr, serror)
3680 lstr=len_trim(string)
3681 WRITE (
stdout,10)
'MPI_IRECV', rank, myerror, string(1:lstr)
3695 & mycomm, request, myerror)
3696 CALL mpi_wait (request, status, myerror)
3697 IF (myerror.ne.mpi_success)
THEN
3698 CALL mpi_error_string (myerror, string, lstr, serror)
3699 lstr=len_trim(string)
3700 WRITE (
stdout,10)
'MPI_ISEND',
myrank, myerror, string(1:lstr)
3709 IF (myerror.ne.mpi_success)
THEN
3710 CALL mpi_error_string (myerror, string, lstr, serror)
3711 lstr=len_trim(string)
3712 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
3717 10
FORMAT (/,
' MP_COLLECT_F - error during ',a,
' call, Task = ', &
3718 & i3.3,
' Error = ',i3,/,14x,a)
3726 CALL wclock_off (ng, model, 69, __line__, myfile)
3732 SUBROUTINE mp_collect_i (ng, model, Npts, Aspv, A, InpComm)
3759 integer,
intent(in) :: ng, model, Npts
3761 integer,
intent(in) :: Aspv
3763 integer,
intent(in),
optional :: InpComm
3765 integer,
intent(inout) :: A(Npts)
3769 integer :: Lstr, MyCOMM, MyError, Nnodes, Serror
3770 integer :: i, rank, request
3772 integer,
dimension(MPI_STATUS_SIZE) :: status
3774# if defined COLLECT_ALLGATHER
3775 integer,
dimension(Npts,0:NtileI(ng)*NtileJ(ng)-1) :: Arecv
3776# elif defined COLLECT_ALLREDUCE
3777 integer,
dimension(Npts) :: Asend
3779 integer,
allocatable :: Arecv(:)
3782 character (len=MPI_MAX_ERROR_STRING) :: string
3784 character (len=*),
parameter :: MyFile = &
3785 & __FILE__//
", mp_collect_i"
3793 CALL wclock_on (ng, model, 69, __line__, myfile)
3801 IF (
PRESENT(inpcomm))
THEN
3814# if defined COLLECT_ALLGATHER
3820# if defined COLLECT_ALLGATHER
3822 CALL mpi_allgather (a, npts, mpi_integer, arecv, npts, &
3823 & mpi_integer, mycomm, myerror)
3824 IF (myerror.ne.mpi_success)
THEN
3825 CALL mpi_error_string (myerror, string, lstr, serror)
3826 lstr=len_trim(string)
3840 a(i)=a(i)+arecv(i,rank)
3846 IF (arecv(i,rank).ne.aspv)
THEN
3852# elif defined COLLECT_ALLREDUCE
3862 CALL mpi_allreduce (asend, a, npts, mpi_integer, mpi_sum, &
3864 IF (myerror.ne.mpi_success)
THEN
3865 CALL mpi_error_string (myerror, string, lstr, serror)
3866 lstr=len_trim(string)
3878 IF (.not.
allocated(arecv))
THEN
3879 allocate (arecv(npts))
3886 CALL mpi_irecv (arecv, npts, mpi_integer, rank, rank+5, &
3887 & mycomm, request, myerror)
3888 CALL mpi_wait (request, status, myerror)
3889 IF (myerror.ne.mpi_success)
THEN
3890 CALL mpi_error_string (myerror, string, lstr, serror)
3891 lstr=len_trim(string)
3892 WRITE (
stdout,10)
'MPI_IRECV', rank, myerror, string(1:lstr)
3906 & mycomm, request, myerror)
3907 CALL mpi_wait (request, status, myerror)
3908 IF (myerror.ne.mpi_success)
THEN
3909 CALL mpi_error_string (myerror, string, lstr, serror)
3910 lstr=len_trim(string)
3911 WRITE (
stdout,10)
'MPI_ISEND',
myrank, myerror, string(1:lstr)
3919 CALL mpi_bcast (a, npts, mpi_integer,
mymaster, mycomm, myerror)
3920 IF (myerror.ne.mpi_success)
THEN
3921 CALL mpi_error_string (myerror, string, lstr, serror)
3922 lstr=len_trim(string)
3923 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
3928 10
FORMAT (/,
' MP_COLLECT_I - error during ',a,
' call, Task = ', &
3929 & i3.3,
' Error = ',i3,/,14x,a)
3937 CALL wclock_off (ng, model, 69, __line__, myfile)
3943 SUBROUTINE mp_gather2d (ng, model, LBi, UBi, LBj, UBj, &
3944 & tindex, gtype, Ascl, &
3948 & A, Npts, Awrk, SetFillVal)
3985 logical,
intent(in),
optional :: SetFillVal
3987 integer,
intent(in) :: ng, model, tindex, gtype
3988 integer,
intent(in) :: LBi, UBi, LBj, UBj
3989 integer,
intent(out) :: Npts
3991 real(dp),
intent(in) :: Ascl
3994 real(r8),
intent(in) :: Amask(LBi:UBi,LBj:UBj)
3996 real(r8),
intent(in) :: A(LBi:UBi,LBj:UBj)
3997 real(r8),
intent(out) :: Awrk(:)
4004 integer :: Cgrid, Ntasks, ghost, rank
4005 integer :: Io, Ie, Jo, Je, Ioff, Joff
4006 integer :: Imin, Imax, Jmin, Jmax
4007 integer :: iLB, iUB, jLB, jUB
4008 integer :: Asize, Isize, Jsize, IJsize
4009 integer :: Lstr, MyError, MyType, Serror, Srequest
4010 integer :: i, ic, ij, j, jc, nc
4012 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: counts, displs
4013# ifdef GATHER_SENDRECV
4014 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: MySize
4015 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: Rrequest
4017 integer,
dimension(MPI_STATUS_SIZE) :: Rstatus
4018 integer,
dimension(MPI_STATUS_SIZE) :: Sstatus
4020 real(r8),
allocatable :: Arecv(:,:)
4022 real(r8),
allocatable :: Arecv(:)
4024 real(r8),
allocatable :: Asend(:)
4026 character (len=MPI_MAX_ERROR_STRING) :: string
4028 character (len=*),
parameter :: MyFile = &
4029 & __FILE__//
", mp_gather2d"
4037 CALL wclock_on (ng, model, 66, __line__, myfile)
4055 SELECT CASE (mytype)
4103 SELECT CASE (mytype)
4119 ilb=
bounds(ng) % Imin(cgrid,ghost,rank)
4120 iub=
bounds(ng) % Imax(cgrid,ghost,rank)
4121 jlb=
bounds(ng) % Jmin(cgrid,ghost,rank)
4122 jub=
bounds(ng) % Jmax(cgrid,ghost,rank)
4123# ifdef GATHER_SENDRECV
4124 mysize(rank)=(iub-ilb+1)*(jub-jlb+1)
4132 counts(rank)=nc-displs(rank)
4144 asize=(imax-imin+1)*(jmax-jmin+1)
4145 allocate ( asend(asize) )
4152 asend(nc)=a(i,j)*ascl
4161 IF (
PRESENT(setfillval))
THEN
4164 landfill=tindex.gt.0
4166 IF (gtype.lt.0)
THEN
4171 IF (amask(i,j).eq.0.0_r8)
THEN
4176 ELSE IF (landfill)
THEN
4181 IF (amask(i,j).eq.0.0_r8)
THEN
4193# ifdef GATHER_SENDRECV
4195 allocate ( arecv(ijsize, ntasks-1) )
4217 CALL mpi_irecv (arecv(1,rank), mysize(rank),
mp_float, rank, &
4222 CALL mpi_wait (rrequest(rank), rstatus, myerror)
4223 IF (myerror.ne.mpi_success)
THEN
4224 CALL mpi_error_string (myerror, string, lstr, serror)
4225 lstr=len_trim(string)
4226 WRITE (
stdout,10)
'MPI_IRECV', rank, myerror, string(1:lstr)
4227 10
FORMAT (/,
' MP_GATHER2D - error during ',a, &
4228 &
' call, Task = ',i3.3,
' Error = ',i3,/,13x,a)
4233 imin=
bounds(ng) % Imin(cgrid,ghost,rank)
4234 imax=
bounds(ng) % Imax(cgrid,ghost,rank)
4235 jmin=
bounds(ng) % Jmin(cgrid,ghost,rank)
4236 jmax=
bounds(ng) % Jmax(cgrid,ghost,rank)
4244 awrk(ic)=arecv(nc,rank)
4251 CALL mpi_wait (srequest, sstatus, myerror)
4252 IF (myerror.ne.mpi_success)
THEN
4253 CALL mpi_error_string (myerror, string, lstr, serror)
4254 lstr=len_trim(string)
4255 WRITE (
stdout,10)
'MPI_ISEND',
myrank, myerror, string(1:lstr)
4265 allocate ( arecv(ijsize) )
4268 CALL mpi_gatherv (asend, asize,
mp_float, &
4269 & arecv, counts, displs,
mp_float, &
4271 IF (myerror.ne.mpi_success)
THEN
4272 CALL mpi_error_string (myerror, string, lstr, serror)
4273 WRITE (
stdout,10)
'MPI_GATHERV',
myrank, myerror, trim(string)
4274 10
FORMAT (/,
' MP_GATHER2D - error during ',a,
' call, Task = ', &
4275 & i3.3,
' Error = ',i3,/,15x,a)
4285 ilb=
bounds(ng) % Imin(cgrid,ghost,rank)
4286 iub=
bounds(ng) % Imax(cgrid,ghost,rank)
4287 jlb=
bounds(ng) % Jmin(cgrid,ghost,rank)
4288 jub=
bounds(ng) % Jmax(cgrid,ghost,rank)
4306 IF (awrk(i).lt.
spval)
THEN
4326 CALL wclock_off (ng, model, 66, __line__, myfile)
4334 SUBROUTINE mp_gather2d_xtr (ng, model, LBi, UBi, LBj, UBj, &
4335 & tindex, gtype, Ascl, &
4339 & A, Npts, Awrk, SetFillVal)
4376 logical,
intent(in),
optional :: SetFillVal
4378 integer,
intent(in) :: ng, model, tindex, gtype
4379 integer,
intent(in) :: LBi, UBi, LBj, UBj
4380 integer,
intent(out) :: Npts
4382 real(dp),
intent(in) :: Ascl
4385 real(r8),
intent(in) :: Amask(LBi:UBi,LBj:UBj)
4387 real(r8),
intent(in) :: A(LBi:UBi,LBj:UBj)
4388 real(r8),
intent(out) :: Awrk(:)
4395 integer :: Cgrid, Ntasks, ghost, rank
4396 integer :: Io, Ie, Jo, Je, Ioff, Joff
4397 integer :: Imin, Imax, Jmin, Jmax
4398 integer :: iLB, iUB, jLB, jUB
4399 integer :: Asize, Isize, Jsize, IJsize
4400 integer :: Lstr, MyError, MyType, Serror, Srequest
4401 integer :: i, ic, ij, j, jc, nc
4403 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: counts, displs
4404# ifdef GATHER_SENDRECV
4405 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: MySize
4406 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: Rrequest
4408 integer,
dimension(MPI_STATUS_SIZE) :: Rstatus
4409 integer,
dimension(MPI_STATUS_SIZE) :: Sstatus
4411 real(r8),
allocatable :: Arecv(:,:)
4413 real(r8),
allocatable :: Arecv(:)
4415 real(r8),
allocatable :: Asend(:)
4417 character (len=MPI_MAX_ERROR_STRING) :: string
4419 character (len=*),
parameter :: MyFile = &
4420 & __FILE__//
", mp_gather2d_xtr"
4428 CALL wclock_on (ng, model, 66, __line__, myfile)
4446 SELECT CASE (mytype)
4448 io=xtr_iobounds(ng) % ILB_psi
4449 ie=xtr_iobounds(ng) % IUB_psi
4450 jo=xtr_iobounds(ng) % JLB_psi
4451 je=xtr_iobounds(ng) % JUB_psi
4455 io=xtr_iobounds(ng) % ILB_rho
4456 ie=xtr_iobounds(ng) % IUB_rho
4457 jo=xtr_iobounds(ng) % JLB_rho
4458 je=xtr_iobounds(ng) % JUB_rho
4462 io=xtr_iobounds(ng) % ILB_u
4463 ie=xtr_iobounds(ng) % IUB_u
4464 jo=xtr_iobounds(ng) % JLB_u
4465 je=xtr_iobounds(ng) % JUB_u
4469 io=xtr_iobounds(ng) % ILB_v
4470 ie=xtr_iobounds(ng) % IUB_v
4471 jo=xtr_iobounds(ng) % JLB_v
4472 je=xtr_iobounds(ng) % JUB_v
4476 io=xtr_iobounds(ng) % ILB_rho
4477 ie=xtr_iobounds(ng) % IUB_rho
4478 jo=xtr_iobounds(ng) % JLB_rho
4479 je=xtr_iobounds(ng) % JUB_rho
4494 SELECT CASE (mytype)
4510 ilb=xtr_bounds(ng) % Imin(cgrid,ghost,rank)
4511 iub=xtr_bounds(ng) % Imax(cgrid,ghost,rank)
4512 jlb=xtr_bounds(ng) % Jmin(cgrid,ghost,rank)
4513 jub=xtr_bounds(ng) % Jmax(cgrid,ghost,rank)
4514# ifdef GATHER_SENDRECV
4515 mysize(rank)=(iub-ilb+1)*(jub-jlb+1)
4523 counts(rank)=nc-displs(rank)
4530 imin=xtr_bounds(ng) % Imin(cgrid,ghost,
myrank)
4531 imax=xtr_bounds(ng) % Imax(cgrid,ghost,
myrank)
4532 jmin=xtr_bounds(ng) % Jmin(cgrid,ghost,
myrank)
4533 jmax=xtr_bounds(ng) % Jmax(cgrid,ghost,
myrank)
4535 asize=(imax-imin+1)*(jmax-jmin+1)
4536 allocate ( asend(asize) )
4543 asend(nc)=a(i,j)*ascl
4552 IF (
PRESENT(setfillval))
THEN
4555 landfill=tindex.gt.0
4557 IF (gtype.lt.0)
THEN
4562 IF (amask(i,j).eq.0.0_r8)
THEN
4567 ELSE IF (landfill)
THEN
4572 IF (amask(i,j).eq.0.0_r8)
THEN
4584# ifdef GATHER_SENDRECV
4586 allocate ( arecv(ijsize, ntasks-1) )
4608 CALL mpi_irecv (arecv(1,rank), mysize(rank),
mp_float, rank, &
4613 CALL mpi_wait (rrequest(rank), rstatus, myerror)
4614 IF (myerror.ne.mpi_success)
THEN
4615 CALL mpi_error_string (myerror, string, lstr, serror)
4616 lstr=len_trim(string)
4617 WRITE (
stdout,10)
'MPI_IRECV', rank, myerror, string(1:lstr)
4618 10
FORMAT (/,
' MP_GATHER2D_XTR - error during ',a, &
4619 &
' call, Task = ',i3.3,
' Error = ',i3,/,13x,a)
4624 imin=xtr_bounds(ng) % Imin(cgrid,ghost,rank)
4625 imax=xtr_bounds(ng) % Imax(cgrid,ghost,rank)
4626 jmin=xtr_bounds(ng) % Jmin(cgrid,ghost,rank)
4627 jmax=xtr_bounds(ng) % Jmax(cgrid,ghost,rank)
4635 awrk(ic)=arecv(nc,rank)
4642 CALL mpi_wait (srequest, sstatus, myerror)
4643 IF (myerror.ne.mpi_success)
THEN
4644 CALL mpi_error_string (myerror, string, lstr, serror)
4645 lstr=len_trim(string)
4646 WRITE (
stdout,10)
'MPI_ISEND',
myrank, myerror, string(1:lstr)
4656 allocate ( arecv(ijsize) )
4659 CALL mpi_gatherv (asend, asize,
mp_float, &
4660 & arecv, counts, displs,
mp_float, &
4662 IF (myerror.ne.mpi_success)
THEN
4663 WRITE (
stdout,10)
'MPI_GATHERV',
myrank, myerror, trim(string)
4664 CALL mpi_error_string (myerror, string, lstr, serror)
4665 10
FORMAT (/,
' MP_GATHER2D_XTR - error during ',a,
' call, Task = ',&
4666 & i3.3,
' Error = ',i3,/,15x,a)
4676 ilb=xtr_bounds(ng) % Imin(cgrid,ghost,rank)
4677 iub=xtr_bounds(ng) % Imax(cgrid,ghost,rank)
4678 jlb=xtr_bounds(ng) % Jmin(cgrid,ghost,rank)
4679 jub=xtr_bounds(ng) % Jmax(cgrid,ghost,rank)
4697 IF (awrk(i).lt.
spval)
THEN
4717 CALL wclock_off (ng, model, 66, __line__, myfile)
4721 END SUBROUTINE mp_gather2d_xtr
4724 SUBROUTINE mp_gather3d (ng, model, LBi, UBi, LBj, UBj, LBk, UBk, &
4725 & tindex, gtype, Ascl, &
4729 & A, Npts, Awrk, SetFillVal)
4768 logical,
intent(in),
optional :: SetFillVal
4770 integer,
intent(in) :: ng, model, tindex, gtype
4771 integer,
intent(in) :: LBi, UBi, LBj, UBj, LBk, UBk
4772 integer,
intent(out) :: Npts
4774 real(dp),
intent(in) :: Ascl
4777 real(r8),
intent(in) :: Amask(LBi:UBi,LBj:UBj)
4779 real(r8),
intent(in) :: A(LBi:UBi,LBj:UBj,LBk:UBk)
4780 real(r8),
intent(out) :: Awrk(:)
4788 integer :: Cgrid, ghost, rank
4789 integer :: Io, Ie, Jo, Je, Ioff, Joff, Koff
4790 integer :: Imin, Imax, Jmin, Jmax
4791 integer :: iLB, iUB, jLB, jUB
4792 integer :: Asize, Isize, Jsize, Ksize, IJsize
4793 integer :: Lstr, MyError, MyType, Serror, Srequest
4794 integer :: i, ic, ijk, j, jc, k, kc, nc
4796 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: counts, displs
4797# ifdef GATHER_SENDRECV
4798 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: MySize
4799 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: Rrequest
4801 integer,
dimension(MPI_STATUS_SIZE) :: Rstatus
4802 integer,
dimension(MPI_STATUS_SIZE) :: Sstatus
4804 real(r8),
allocatable :: Arecv(:,:)
4806 real(r8),
allocatable :: Arecv(:)
4808 real(r8),
allocatable :: Asend(:)
4810 character (len=MPI_MAX_ERROR_STRING) :: string
4812 character (len=*),
parameter :: MyFile = &
4813 & __FILE__//
", mp_gather3d"
4821 CALL wclock_on (ng, model, 66, __line__, myfile)
4839 SELECT CASE (mytype)
4894 SELECT CASE (mytype)
4910 ilb=
bounds(ng) % Imin(cgrid,ghost,rank)
4911 iub=
bounds(ng) % Imax(cgrid,ghost,rank)
4912 jlb=
bounds(ng) % Jmin(cgrid,ghost,rank)
4913 jub=
bounds(ng) % Jmax(cgrid,ghost,rank)
4914# ifdef GATHER_SENDRECV
4915 mysize(rank)=(iub-ilb+1)*(jub-jlb+1)*(ubk-lbk+1)
4925 counts(rank)=nc-displs(rank)
4937 asize=(imax-imin+1)*(jmax-jmin+1)*(ubk-lbk+1)
4938 allocate ( asend(asize) )
4946 asend(nc)=a(i,j,k)*ascl
4956 IF (
PRESENT(setfillval))
THEN
4959 landfill=tindex.gt.0
4961 IF (gtype.lt.0)
THEN
4967 IF (amask(i,j).eq.0.0_r8)
THEN
4973 ELSE IF (landfill)
THEN
4979 IF (amask(i,j).eq.0.0_r8)
THEN
4992# ifdef GATHER_SENDRECV
4994 allocate ( arecv(ijsize*ksize, ntasks-1) )
5019 CALL mpi_irecv (arecv(1,rank), mysize(rank),
mp_float, rank, &
5024 CALL mpi_wait (rrequest(rank), rstatus, myerror)
5025 IF (myerror.ne.mpi_success)
THEN
5026 CALL mpi_error_string (myerror, string, lstr, serror)
5027 lstr=len_trim(string)
5028 WRITE (
stdout,10)
'MPI_IRECV', rank, myerror, string(1:lstr)
5029 10
FORMAT (/,
' MP_GATHER3D - error during ',a,
' call, Task = ',&
5030 & i3.3,
' Error = ',i3,/,13x,a)
5035 imin=
bounds(ng) % Imin(cgrid,ghost,rank)
5036 imax=
bounds(ng) % Imax(cgrid,ghost,rank)
5037 jmin=
bounds(ng) % Jmin(cgrid,ghost,rank)
5038 jmax=
bounds(ng) % Jmax(cgrid,ghost,rank)
5048 awrk(ic)=arecv(nc,rank)
5056 CALL mpi_wait (srequest, sstatus, myerror)
5057 IF (myerror.ne.mpi_success)
THEN
5058 CALL mpi_error_string (myerror, string, lstr, serror)
5059 lstr=len_trim(string)
5060 WRITE (
stdout,10)
'MPI_ISEND',
myrank, myerror, string(1:lstr)
5070 allocate ( arecv(ijsize*ksize) )
5073 CALL mpi_gatherv (asend, asize,
mp_float, &
5074 & arecv, counts, displs,
mp_float, &
5076 IF (myerror.ne.mpi_success)
THEN
5077 CALL mpi_error_string (myerror, string, lstr, serror)
5078 WRITE (
stdout,10)
'MPI_GATHERV',
myrank, myerror, trim(string)
5079 10
FORMAT (/,
' MP_GATHER3D - error during ',a,
' call, Task = ', &
5080 & i3.3,
' Error = ',i3,/,15x,a)
5090 ilb=
bounds(ng) % Imin(cgrid,ghost,rank)
5091 iub=
bounds(ng) % Imax(cgrid,ghost,rank)
5092 jlb=
bounds(ng) % Jmin(cgrid,ghost,rank)
5093 jub=
bounds(ng) % Jmax(cgrid,ghost,rank)
5114 IF (awrk(i).lt.
spval)
THEN
5134 CALL wclock_off (ng, model, 66, __line__, myfile)
5167 integer,
intent(in) :: ng, model
5168 integer,
intent(in) :: Mstr, Mend, Asize
5170 real(r8),
intent(in) :: A(Mstr:Mend)
5171 real(r8),
intent(out) :: Awrk(Asize)
5175 integer :: LB, Lstr, MyError, Serror
5176 integer :: i, np, rank, request
5178 integer :: my_bounds(2)
5179 integer,
dimension(MPI_STATUS_SIZE) :: status
5180 integer,
dimension(2,0:NtileI(ng)*NtileJ(ng)-1) :: Abounds
5182 character (len=MPI_MAX_ERROR_STRING) :: string
5184 character (len=*),
parameter :: MyFile = &
5185 & __FILE__//
", mp_gather_state"
5193 CALL wclock_on (ng, model, 66, __line__, myfile)
5205 CALL mpi_allgather (my_bounds, np, mpi_integer, abounds, np, &
5207 IF (myerror.ne.mpi_success)
THEN
5208 CALL mpi_error_string (myerror, string, lstr, serror)
5209 lstr=len_trim(string)
5212 10
FORMAT (/,
' MP_GATHER_STATE - error during ',a, &
5213 &
' call, Task = ',i3.3,
' Error = ',i3,/,13x,a)
5222 np=abounds(2,rank)-abounds(1,rank)+1
5224 CALL mpi_irecv (awrk(lb:), np,
mp_float, rank, rank+5, &
5226 CALL mpi_wait (request, status, myerror)
5227 IF (myerror.ne.mpi_success)
THEN
5228 CALL mpi_error_string (myerror, string, lstr, serror)
5229 lstr=len_trim(string)
5230 WRITE (
stdout,10)
'MPI_IRECV', rank, myerror, string(1:lstr)
5248 CALL mpi_wait (request, status, myerror)
5249 IF (myerror.ne.mpi_success)
THEN
5250 CALL mpi_error_string (myerror, string, lstr, serror)
5251 lstr=len_trim(string)
5252 WRITE (
stdout,10)
'MPI_ISEND',
myrank, myerror, string(1:lstr)
5262 IF (myerror.ne.mpi_success)
THEN
5263 CALL mpi_error_string (myerror, string, lstr, serror)
5264 lstr=len_trim(string)
5265 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
5276 CALL wclock_off (ng, model, 66, __line__, myfile)
5282 FUNCTION mp_ncread1d (ng, model, ncid, ncvname, ncname, &
5283 & ncrec, LB1, UB1, Ascale, A) &
5319 integer,
intent(in) :: ng, model, ncid, ncrec
5320 integer,
intent(in) :: lb1, ub1
5322 real(r8),
intent(in) :: ascale
5324 real(r8),
intent(out) :: a(lb1:ub1)
5326 character (len=*),
intent(in) :: ncvname
5327 character (len=*),
intent(in) :: ncname
5331 integer :: lstr, myerror, npts, serror
5332 integer :: i, j, np, rank, request, varid
5334 integer :: ibuffer(2), my_bounds(2), start(1), total(1)
5336 integer,
dimension(MPI_STATUS_SIZE) :: status
5337 integer,
dimension(4,0:NtileI(ng)*NtileJ(ng)-1) :: asize
5339 real(r8),
allocatable :: asend(:)
5341 character (len=MPI_MAX_ERROR_STRING) :: string
5343 character (len=*),
parameter :: myfile = &
5344 & __FILE__//
", mp_ncread1d_nf90"
5352 CALL wclock_on (ng, model, 67, __line__, myfile)
5366 CALL mpi_allgather (my_bounds, np, mpi_integer, &
5367 & asize, np, mpi_integer, &
5369 IF (myerror.ne.mpi_success)
THEN
5370 CALL mpi_error_string (myerror, string, lstr, serror)
5371 lstr=len_trim(string)
5384 CALL mpi_wait (request, status, myerror)
5385 IF (myerror.ne.mpi_success)
THEN
5386 CALL mpi_error_string (myerror, string, lstr, serror)
5387 lstr=len_trim(string)
5388 WRITE (
stdout,10)
'MPI_IRECV',
myrank, myerror, string(1:lstr)
5404 np=asize(2,rank)-asize(1,rank)+1
5407 IF (.not.
allocated(asend))
THEN
5408 allocate (asend(npts))
5413 io_error=nf90_inq_varid(ncid, trim(ncvname), varid)
5414 IF (io_error.ne.nf90_noerr)
THEN
5415 WRITE (
stdout,20) trim(ncvname), trim(ncname)
5421 start(1)=asize(1,rank)
5422 total(1)=asize(2,rank)-asize(1,rank)+1
5423 io_error=nf90_get_var(ncid, varid, asend, start, total)
5424 IF (io_error.ne.nf90_noerr)
THEN
5425 WRITE (
stdout,30) trim(ncvname), trim(ncname)
5437 a(i)=asend(np)*ascale
5440 np=asize(2,rank)-asize(1,rank)+1
5441 CALL mpi_isend (asend, np,
mp_float, rank, rank+5, &
5443 CALL mpi_wait (request, status, myerror)
5444 IF (myerror.ne.mpi_success)
THEN
5445 CALL mpi_error_string (myerror, string, lstr, serror)
5446 lstr=len_trim(string)
5447 WRITE (
stdout,10)
'MPI_ISEND', rank, myerror, &
5481 CALL wclock_off (ng, model, 67, __line__, myfile)
5484 10
FORMAT (/,
' MP_NCREAD1D - error during ',a,
' call, Task = ',i0, &
5485 &
' Error = ',i0,/,15x,a)
5486 20
FORMAT (/,
' MP_NCREAD1D - error while inquiring ID for', &
5487 &
' variable: ',a,/,15x,
'in file: ',a)
5488 30
FORMAT (/,
' MP_NCREAD1D - error while reading variable: ',a, &
5489 & /,15x,
'in file: ',a)
5494 FUNCTION mp_ncread2d (ng, model, ncid, ncvname, ncname, &
5495 & ncrec, LB1, UB1, LB2, UB2, Ascale, A) &
5533 integer,
intent(in) :: ng, model, ncid, ncrec
5534 integer,
intent(in) :: lb1, ub1, lb2, ub2
5536 real(r8),
intent(in) :: ascale
5538 real(r8),
intent(out) :: a(lb1:ub1,lb2:ub2)
5540 character (len=*),
intent(in) :: ncvname
5541 character (len=*),
intent(in) :: ncname
5545 integer :: lstr, myerror, npts, serror
5546 integer :: i, j, np, rank, request, varid
5548 integer :: ibuffer(2), my_bounds(4), start(2), total(2)
5550 integer,
dimension(MPI_STATUS_SIZE) :: status
5551 integer,
dimension(4,0:NtileI(ng)*NtileJ(ng)-1) :: asize
5553 real(r8),
allocatable :: asend(:)
5555 character (len=MPI_MAX_ERROR_STRING) :: string
5557 character (len=*),
parameter :: myfile = &
5558 & __FILE__//
", mp_ncread2d_nf90"
5566 CALL wclock_on (ng, model, 67, __line__, myfile)
5582 CALL mpi_allgather (my_bounds, np, mpi_integer, &
5583 & asize, np, mpi_integer, &
5585 IF (myerror.ne.mpi_success)
THEN
5586 CALL mpi_error_string (myerror, string, lstr, serror)
5587 lstr=len_trim(string)
5597 np=(ub1-lb1+1)*(ub2-lb2+1)
5600 CALL mpi_wait (request, status, myerror)
5601 IF (myerror.ne.mpi_success)
THEN
5602 CALL mpi_error_string (myerror, string, lstr, serror)
5603 lstr=len_trim(string)
5604 WRITE (
stdout,10)
'MPI_IRECV',
myrank, myerror, string(1:lstr)
5613 a(i,j)=a(i,j)*ascale
5622 np=(asize(2,rank)-asize(1,rank)+1)* &
5623 & (asize(4,rank)-asize(3,rank)+1)
5626 IF (.not.
allocated(asend))
THEN
5627 allocate (asend(npts))
5632 io_error=nf90_inq_varid(ncid, trim(ncvname), varid)
5633 IF (io_error.ne.nf90_noerr)
THEN
5634 WRITE (
stdout,20) trim(ncvname), trim(ncname)
5640 start(1)=asize(1,rank)
5641 total(1)=asize(2,rank)-asize(1,rank)+1
5642 start(2)=asize(3,rank)
5643 total(2)=asize(4,rank)-asize(3,rank)+1
5644 io_error=nf90_get_var(ncid, varid, asend, start, total)
5645 IF (io_error.ne.nf90_noerr)
THEN
5646 WRITE (
stdout,30) trim(ncvname), trim(ncname)
5659 a(i,j)=asend(np)*ascale
5663 np=(asize(2,rank)-asize(1,rank)+1)* &
5664 & (asize(4,rank)-asize(3,rank)+1)
5665 CALL mpi_isend (asend, np,
mp_float, rank, rank+5, &
5667 CALL mpi_wait (request, status, myerror)
5668 IF (myerror.ne.mpi_success)
THEN
5669 CALL mpi_error_string (myerror, string, lstr, serror)
5670 lstr=len_trim(string)
5671 WRITE (
stdout,10)
'MPI_ISEND', rank, myerror, &
5705 CALL wclock_off (ng, model, 67, __line__, myfile)
5708 10
FORMAT (/,
' MP_NCREAD2D - error during ',a,
' call, Task = ',i0, &
5709 &
' Error = ',i0,/,15x,a)
5710 20
FORMAT (/,
' MP_NCREAD2D - error while inquiring ID for', &
5711 &
' variable: ',a,/,15x,
'in file: ',a)
5712 30
FORMAT (/,
' MP_NCREAD2D - error while reading variable: ',a, &
5713 & /,15x,
'in file: ',a)
5718 FUNCTION mp_ncwrite1d (ng, model, ncid, ncvname, ncname, &
5719 & ncrec, LB1, UB1, Ascale, A) &
5755 integer,
intent(in) :: ng, model, ncid, ncrec
5756 integer,
intent(in) :: lb1, ub1
5758 real(r8),
intent(in) :: ascale
5760 real(r8),
intent(in) :: a(lb1:ub1)
5762 character (len=*),
intent(in) :: ncvname
5763 character (len=*),
intent(in) :: ncname
5767 integer :: lstr, myerror, npts, serror
5768 integer :: i, j, np, rank, request, varid
5770 integer :: ibuffer(2), my_bounds(2), start(1), total(1)
5772 integer,
dimension(MPI_STATUS_SIZE) :: status
5773 integer,
dimension(2,0:NtileI(ng)*NtileJ(ng)-1) :: asize
5775 real(r8),
allocatable :: arecv(:)
5777 character (len=MPI_MAX_ERROR_STRING) :: string
5779 character (len=*),
parameter :: myfile = &
5780 & __FILE__//
", mp_ncwrite1d"
5788 CALL wclock_on (ng, model, 66, __line__, myfile)
5802 CALL mpi_allgather (my_bounds, np, mpi_integer, &
5803 & asize, np, mpi_integer, &
5805 IF (myerror.ne.mpi_success)
THEN
5806 CALL mpi_error_string (myerror, string, lstr, serror)
5807 lstr=len_trim(string)
5819 np=(asize(2,rank)-asize(1,rank)+1)
5822 IF (.not.
allocated(arecv))
THEN
5823 allocate (arecv(npts))
5835 io_error=nf90_inq_varid(ncid, trim(ncvname), varid)
5836 IF (io_error.eq.nf90_noerr)
THEN
5837 io_error=nf90_put_var(ncid, varid, arecv, start, total)
5838 IF (io_error.ne.nf90_noerr)
THEN
5839 WRITE (
stdout,20) trim(ncvname), trim(ncname)
5844 WRITE (
stdout,30) trim(ncvname), trim(ncname)
5853 np=asize(2,rank)-asize(1,rank)+1
5854 CALL mpi_irecv (arecv, np,
mp_float, rank, rank+5, &
5856 CALL mpi_wait (request, status, myerror)
5857 IF (myerror.ne.mpi_success)
THEN
5858 CALL mpi_error_string (myerror, string, lstr, serror)
5859 lstr=len_trim(string)
5860 WRITE (
stdout,10)
'MPI_IRECV', rank, myerror, &
5868 start(1)=asize(1,rank)
5869 total(1)=asize(2,rank)-asize(1,rank)+1
5871 arecv(i)=arecv(i)*ascale
5873 io_error=nf90_put_var(ncid, varid, arecv, start, total)
5874 IF (io_error.ne.nf90_noerr)
THEN
5875 WRITE (
stdout,20) trim(ncvname), trim(ncname)
5889 CALL mpi_wait (request, status, myerror)
5890 IF (myerror.ne.mpi_success)
THEN
5891 CALL mpi_error_string (myerror, string, lstr, serror)
5892 lstr=len_trim(string)
5893 WRITE (
stdout,10)
'MPI_ISEND',
myrank, myerror, string(1:lstr)
5923 CALL wclock_off (ng, model, 66, __line__, myfile)
5926 10
FORMAT (/,
' MP_NCWRITE1D - error during ',a,
' call, Task = ',i0, &
5927 &
' Error = ',i0,/,21x,a)
5928 20
FORMAT (/,
' MP_NCWRITE1D - error while writing variable: ',a, &
5929 & /,16x,
'in file: ',a)
5930 30
FORMAT (/,
' MP_NCWRITE1D - error while inquiring ID for', &
5931 &
' variable: ',a,/,16x,
'in file: ',a)
5936 FUNCTION mp_ncwrite2d (ng, model, ncid, ncvname, ncname, &
5937 & ncrec, LB1, UB1, LB2, UB2, Ascale, A) &
5975 integer,
intent(in) :: ng, model, ncid, ncrec
5976 integer,
intent(in) :: lb1, ub1, lb2, ub2
5978 real(r8),
intent(in) :: ascale
5980 real(r8),
intent(in) :: a(lb1:ub1,lb2:ub2)
5982 character (len=*),
intent(in) :: ncvname
5983 character (len=*),
intent(in) :: ncname
5987 integer :: lstr, myerror, npts, serror
5988 integer :: i, j, np, rank, request, varid
5990 integer :: ibuffer(2), my_bounds(4), start(2), total(2)
5992 integer,
dimension(MPI_STATUS_SIZE) :: status
5993 integer,
dimension(4,0:NtileI(ng)*NtileJ(ng)-1) :: asize
5995 real(r8),
allocatable :: arecv(:)
5997 character (len=MPI_MAX_ERROR_STRING) :: string
5999 character (len=*),
parameter :: myfile = &
6000 & __FILE__//
", mp_ncwrite2d_nf90"
6008 CALL wclock_on (ng, model, 66, __line__, myfile)
6024 CALL mpi_allgather (my_bounds, np, mpi_integer, &
6025 & asize, np, mpi_integer, &
6027 IF (myerror.ne.mpi_success)
THEN
6028 CALL mpi_error_string (myerror, string, lstr, serror)
6029 lstr=len_trim(string)
6041 np=(asize(2,rank)-asize(1,rank)+1)* &
6042 & (asize(4,rank)-asize(3,rank)+1)
6045 IF (.not.
allocated(arecv))
THEN
6046 allocate (arecv(npts))
6062 io_error=nf90_inq_varid(ncid, trim(ncvname), varid)
6063 IF (io_error.eq.nf90_noerr)
THEN
6064 io_error=nf90_put_var(ncid, varid, arecv, start, total)
6065 IF (io_error.ne.nf90_noerr)
THEN
6066 WRITE (
stdout,20) trim(ncvname), trim(ncname)
6071 WRITE (
stdout,30) trim(ncvname), trim(ncname)
6080 np=(asize(2,rank)-asize(1,rank)+1)* &
6081 & (asize(4,rank)-asize(3,rank)+1)
6082 CALL mpi_irecv (arecv, np,
mp_float, rank, rank+5, &
6084 CALL mpi_wait (request, status, myerror)
6085 IF (myerror.ne.mpi_success)
THEN
6086 CALL mpi_error_string (myerror, string, lstr, serror)
6087 lstr=len_trim(string)
6088 WRITE (
stdout,10)
'MPI_IRECV', rank, myerror, &
6096 start(1)=asize(1,rank)
6097 total(1)=asize(2,rank)-asize(1,rank)+1
6098 start(2)=asize(3,rank)
6099 total(2)=asize(4,rank)-asize(3,rank)+1
6101 arecv(i)=arecv(i)*ascale
6103 io_error=nf90_put_var(ncid, varid, arecv, start, total)
6104 IF (io_error.ne.nf90_noerr)
THEN
6105 WRITE (
stdout,20) trim(ncvname), trim(ncname)
6116 np=(ub1-lb1+1)*(ub2-lb2+1)
6119 CALL mpi_wait (request, status, myerror)
6120 IF (myerror.ne.mpi_success)
THEN
6121 CALL mpi_error_string (myerror, string, lstr, serror)
6122 lstr=len_trim(string)
6123 WRITE (
stdout,10)
'MPI_ISEND',
myrank, myerror, string(1:lstr)
6153 CALL wclock_off (ng, model, 66, __line__, myfile)
6156 10
FORMAT (/,
' MP_NCWRITE2D - error during ',a,
' call, Task = ',i0, &
6157 &
' Error = ',i0,/,21x,a)
6158 20
FORMAT (/,
' MP_NCWRITE2D - error while writing variable: ',a, &
6159 & /,16x,
'in file: ',a)
6160 30
FORMAT (/,
' MP_NCWRITE2D - error while inquiring ID for', &
6161 &
' variable: ',a,/,16x,
'in file: ',a)
6166 SUBROUTINE mp_reduce_i8 (ng, model, Asize, A, handle_op, InpComm)
6192 integer,
intent(in) :: ng, model, Asize
6194 integer,
intent(in),
optional :: InpComm
6196 character (len=*),
intent(in) :: handle_op(Asize)
6198 integer(i8b),
intent(inout) :: A(Asize)
6202 integer :: Lstr, MyCOMM, MyError, Serror
6203 integer :: handle, i, rank, request
6205 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: Rrequest
6207 integer,
dimension(MPI_STATUS_SIZE) :: Rstatus
6208 integer,
dimension(MPI_STATUS_SIZE) :: Sstatus
6210 integer(i8b),
dimension(Asize,0:NtileI(ng)*NtileJ(ng)-1) :: Arecv
6211 integer(i8b),
dimension(Asize) :: Areduce
6212 integer(i8b),
dimension(Asize) :: Asend
6214 character (len=MPI_MAX_ERROR_STRING) :: string
6216 character (len=*),
parameter :: MyFile = &
6217 & __FILE__//
", mp_reduce_1di"
6225 CALL wclock_on (ng, model, 65, __line__, myfile)
6233 IF (
PRESENT(inpcomm))
THEN
6247 & 2*asize)*kind(a),r8))
6257# if defined REDUCE_ALLREDUCE
6259 IF (handle_op(i)(1:3).eq.
'MIN')
THEN
6261 ELSE IF (handle_op(i)(1:3).eq.
'MAX')
THEN
6263 ELSE IF (handle_op(i)(1:3).eq.
'SUM')
THEN
6266 CALL mpi_allreduce (asend(i), areduce(i), 1, mpi_integer, &
6267 & handle, mycomm, myerror)
6268 IF (myerror.ne.mpi_success)
THEN
6269 CALL mpi_error_string (myerror, string, lstr, serror)
6270 lstr=len_trim(string)
6277# elif defined REDUCE_ALLGATHER
6278 CALL mpi_allgather (asend, asize, mpi_integer, &
6279 & arecv, asize, mpi_integer, &
6281 IF (myerror.ne.mpi_success)
THEN
6282 CALL mpi_error_string (myerror, string, lstr, serror)
6283 lstr=len_trim(string)
6290 areduce(i)=arecv(i,0)
6292 IF (handle_op(i)(1:3).eq.
'MIN')
THEN
6293 areduce(i)=min(areduce(i),arecv(i,rank))
6294 ELSE IF (handle_op(i)(1:3).eq.
'MAX')
THEN
6295 areduce(i)=max(areduce(i),arecv(i,rank))
6296 ELSE IF (handle_op(i)(1:3).eq.
'SUM')
THEN
6297 areduce(i)=areduce(i)+arecv(i,rank)
6301# elif defined REDUCE_SENDRECV
6304 CALL mpi_irecv (arecv(1,rank), asize, mpi_integer, rank, &
6305 & rank+500, mycomm, rrequest(rank), &
6312 CALL mpi_wait (rrequest(rank), rstatus, myerror)
6313 IF (myerror.ne.mpi_success)
THEN
6314 CALL mpi_error_string (myerror, string, lstr, serror)
6315 lstr=len_trim(string)
6316 WRITE (
stdout,10)
'MPI_IRECV', rank,
rerror, string(1:lstr)
6321 IF (handle_op(i)(1:3).eq.
'MIN')
THEN
6322 areduce(i)=min(areduce(i),arecv(i,rank))
6323 ELSE IF (handle_op(i)(1:3).eq.
'MAX')
THEN
6324 areduce(i)=max(areduce(i),arecv(i,rank))
6325 ELSE IF (handle_op(i)(1:3).eq.
'SUM')
THEN
6326 areduce(i)=areduce(i)+arecv(i,rank)
6331 CALL mpi_isend (asend, asize, mpi_integer,
mymaster, &
6332 &
myrank+500, mycomm, request, myerror)
6333 CALL mpi_wait (request, sstatus, myerror)
6334 IF (myerror.ne.mpi_success)
THEN
6335 CALL mpi_error_string (myerror, string, lstr, serror)
6336 lstr=len_trim(string)
6337 WRITE (
stdout,10)
'MPI_ISEND',
myrank, serror, string(1:lstr)
6346 CALL mpi_bcast (areduce, asize, mpi_integer,
mymaster, &
6348 IF (myerror.ne.mpi_success)
THEN
6349 CALL mpi_error_string (myerror, string, lstr, serror)
6350 lstr=len_trim(string)
6351 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
6356 10
FORMAT (/,
' MP_REDUCE_I8 - error during ',a,
' call, Task = ', &
6357 & i3.3,
' Error = ',i3,/,16x,a)
6370 CALL wclock_off (ng, model, 65, __line__, myfile)
6376# ifdef SINGLE_PRECISION
6378 SUBROUTINE mp_reduce_0dp (ng, model, Asize, A, handle_op, InpComm)
6405 integer,
intent(in) :: ng, model, Asize
6407 integer,
intent(in),
optional :: InpComm
6409 character (len=*),
intent(in) :: handle_op
6411 real(dp),
intent(inout) :: A
6415 integer :: Lstr, MyCOMM, MyError, Npts, Serror
6416 integer :: handle, i, rank, request
6418 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: Rrequest
6420 integer,
dimension(MPI_STATUS_SIZE) :: Rstatus
6421 integer,
dimension(MPI_STATUS_SIZE) :: Sstatus
6425 real(dp),
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: Arecv
6427 character (len=MPI_MAX_ERROR_STRING) :: string
6429 character (len=*),
parameter :: MyFile = &
6430 & __FILE__//
", mp_reduce_0dp"
6438 CALL wclock_on (ng, model, 65, __line__, myfile)
6446 IF (
PRESENT(inpcomm))
THEN
6464# if defined REDUCE_ALLREDUCE
6465 IF (handle_op(1:3).eq.
'MIN')
THEN
6467 ELSE IF (handle_op(1:3).eq.
'MAX')
THEN
6469 ELSE IF (handle_op(1:3).eq.
'SUM')
THEN
6472 CALL mpi_allreduce (asend, areduce, npts,
mp_double, handle, &
6474 IF (myerror.ne.mpi_success)
THEN
6475 CALL mpi_error_string (myerror, string, lstr, serror)
6476 lstr=len_trim(string)
6482# elif defined REDUCE_ALLGATHER
6483 CALL mpi_allgather (asend, npts,
mp_double, &
6486 IF (myerror.ne.mpi_success)
THEN
6487 CALL mpi_error_string (myerror, string, lstr, serror)
6488 lstr=len_trim(string)
6496 IF (handle_op(1:3).eq.
'MIN')
THEN
6497 areduce=min(areduce,arecv(rank))
6498 ELSE IF (handle_op(1:3).eq.
'MAX')
THEN
6499 areduce=max(areduce,arecv(rank))
6500 ELSE IF (handle_op(1:3).eq.
'SUM')
THEN
6501 areduce=areduce+arecv(rank)
6504# elif defined REDUCE_SENDRECV
6507 CALL mpi_irecv (arecv(rank), npts,
mp_double, rank, &
6508 & rank+500, mycomm, rrequest(rank), &
6513 CALL mpi_wait (rrequest(rank), rstatus, myerror)
6514 IF (myerror.ne.mpi_success)
THEN
6515 CALL mpi_error_string (myerror, string, lstr, serror)
6516 lstr=len_trim(string)
6517 WRITE (
stdout,10)
'MPI_IRECV', rank,
rerror, string(1:lstr)
6521 IF (handle_op(1:3).eq.
'MIN')
THEN
6522 areduce=min(areduce,arecv(rank))
6523 ELSE IF (handle_op(1:3).eq.
'MAX')
THEN
6524 areduce=max(areduce,arecv(rank))
6525 ELSE IF (handle_op(1:3).eq.
'SUM')
THEN
6526 areduce=areduce+arecv(rank)
6531 & mycomm, request, myerror)
6532 CALL mpi_wait (request, sstatus, myerror)
6533 IF (myerror.ne.mpi_success)
THEN
6534 CALL mpi_error_string (myerror, string, lstr, serror)
6535 lstr=len_trim(string)
6536 WRITE (
stdout,10)
'MPI_ISEND',
myrank, serror, string(1:lstr)
6547 IF (myerror.ne.mpi_success)
THEN
6548 CALL mpi_error_string (myerror, string, lstr, serror)
6549 lstr=len_trim(string)
6550 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
6555 10
FORMAT (/,
' MP_REDUCE_0DP - error during ',a,
' call, Task = ', &
6556 & i3.3,
' Error = ',i3,/,16x,a)
6567 CALL wclock_off (ng, model, 65, __line__, myfile)
6573 SUBROUTINE mp_reduce_1dp (ng, model, Asize, A, handle_op, InpComm)
6600 integer,
intent(in) :: ng, model, Asize
6602 integer,
intent(in),
optional :: InpComm
6604 character (len=*),
intent(in) :: handle_op(Asize)
6606 real(dp),
intent(inout) :: A(Asize)
6610 integer :: Lstr, MyCOMM, MyError, Serror
6611 integer :: handle, i, rank, request
6613 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: Rrequest
6615 integer,
dimension(MPI_STATUS_SIZE) :: Rstatus
6616 integer,
dimension(MPI_STATUS_SIZE) :: Sstatus
6618 real(dp),
dimension(Asize,0:NtileI(ng)*NtileJ(ng)-1) :: Arecv
6619 real(dp),
dimension(Asize) :: Areduce
6620 real(dp),
dimension(Asize) :: Asend
6622 character (len=MPI_MAX_ERROR_STRING) :: string
6624 character (len=*),
parameter :: MyFile = &
6625 & __FILE__//
", mp_reduce_1dp"
6633 CALL wclock_on (ng, model, 65, __line__, myfile)
6641 IF (
PRESENT(inpcomm))
THEN
6655 & 2*asize)*kind(a),r8))
6665# if defined REDUCE_ALLREDUCE
6667 IF (handle_op(i)(1:3).eq.
'MIN')
THEN
6669 ELSE IF (handle_op(i)(1:3).eq.
'MAX')
THEN
6671 ELSE IF (handle_op(i)(1:3).eq.
'SUM')
THEN
6674 CALL mpi_allreduce (asend(i), areduce(i), 1,
mp_double, handle, &
6676 IF (myerror.ne.mpi_success)
THEN
6677 CALL mpi_error_string (myerror, string, lstr, serror)
6678 lstr=len_trim(string)
6685# elif defined REDUCE_ALLGATHER
6686 CALL mpi_allgather (asend, asize,
mp_double, &
6689 IF (myerror.ne.mpi_success)
THEN
6690 CALL mpi_error_string (myerror, string, lstr, serror)
6691 lstr=len_trim(string)
6698 areduce(i)=arecv(i,0)
6700 IF (handle_op(i)(1:3).eq.
'MIN')
THEN
6701 areduce(i)=min(areduce(i),arecv(i,rank))
6702 ELSE IF (handle_op(i)(1:3).eq.
'MAX')
THEN
6703 areduce(i)=max(areduce(i),arecv(i,rank))
6704 ELSE IF (handle_op(i)(1:3).eq.
'SUM')
THEN
6705 areduce(i)=areduce(i)+arecv(i,rank)
6709# elif defined REDUCE_SENDRECV
6712 CALL mpi_irecv (arecv(1,rank), asize,
mp_double, rank, &
6713 & rank+500, mycomm, rrequest(rank), &
6720 CALL mpi_wait (rrequest(rank), rstatus, myerror)
6721 IF (myerror.ne.mpi_success)
THEN
6722 CALL mpi_error_string (myerror, string, lstr, serror)
6723 lstr=len_trim(string)
6724 WRITE (
stdout,10)
'MPI_IRECV', rank,
rerror, string(1:lstr)
6729 IF (handle_op(i)(1:3).eq.
'MIN')
THEN
6730 areduce(i)=min(areduce(i),arecv(i,rank))
6731 ELSE IF (handle_op(i)(1:3).eq.
'MAX')
THEN
6732 areduce(i)=max(areduce(i),arecv(i,rank))
6733 ELSE IF (handle_op(i)(1:3).eq.
'SUM')
THEN
6734 areduce(i)=areduce(i)+arecv(i,rank)
6740 & mycomm, request, myerror)
6741 CALL mpi_wait (request, sstatus, myerror)
6742 IF (myerror.ne.mpi_success)
THEN
6743 CALL mpi_error_string (myerror, string, lstr, serror)
6744 lstr=len_trim(string)
6745 WRITE (
stdout,10)
'MPI_ISEND',
myrank, serror, string(1:lstr)
6756 IF (myerror.ne.mpi_success)
THEN
6757 CALL mpi_error_string (myerror, string, lstr, serror)
6758 lstr=len_trim(string)
6759 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
6764 10
FORMAT (/,
' MP_REDUCE_1DP - error during ',a,
' call, Task = ', &
6765 & i3.3,
' Error = ',i3,/,16x,a)
6778 CALL wclock_off (ng, model, 65, __line__, myfile)
6785 SUBROUTINE mp_reduce_0d (ng, model, Asize, A, handle_op, InpComm)
6812 integer,
intent(in) :: ng, model, Asize
6814 integer,
intent(in),
optional :: InpComm
6816 character (len=*),
intent(in) :: handle_op
6818 real(r8),
intent(inout) :: A
6822 integer :: Lstr, MyCOMM, MyError, Npts, Serror
6823 integer :: handle, i, rank, request
6825 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: Rrequest
6827 integer,
dimension(MPI_STATUS_SIZE) :: Rstatus
6828 integer,
dimension(MPI_STATUS_SIZE) :: Sstatus
6832 real(r8),
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: Arecv
6834 character (len=MPI_MAX_ERROR_STRING) :: string
6836 character (len=*),
parameter :: MyFile = &
6837 & __FILE__//
", mp_reduce_0d"
6845 CALL wclock_on (ng, model, 65, __line__, myfile)
6853 IF (
PRESENT(inpcomm))
THEN
6871# if defined REDUCE_ALLREDUCE
6872 IF (handle_op(1:3).eq.
'MIN')
THEN
6874 ELSE IF (handle_op(1:3).eq.
'MAX')
THEN
6876 ELSE IF (handle_op(1:3).eq.
'SUM')
THEN
6879 CALL mpi_allreduce (asend, areduce, npts,
mp_float, handle, &
6881 IF (myerror.ne.mpi_success)
THEN
6882 CALL mpi_error_string (myerror, string, lstr, serror)
6883 lstr=len_trim(string)
6889# elif defined REDUCE_ALLGATHER
6890 CALL mpi_allgather (asend, npts,
mp_float, &
6893 IF (myerror.ne.mpi_success)
THEN
6894 CALL mpi_error_string (myerror, string, lstr, serror)
6895 lstr=len_trim(string)
6903 IF (handle_op(1:3).eq.
'MIN')
THEN
6904 areduce=min(areduce,arecv(rank))
6905 ELSE IF (handle_op(1:3).eq.
'MAX')
THEN
6906 areduce=max(areduce,arecv(rank))
6907 ELSE IF (handle_op(1:3).eq.
'SUM')
THEN
6908 areduce=areduce+arecv(rank)
6911# elif defined REDUCE_SENDRECV
6914 CALL mpi_irecv (arecv(rank), npts,
mp_float, rank, &
6915 & rank+500, mycomm, rrequest(rank), &
6920 CALL mpi_wait (rrequest(rank), rstatus, myerror)
6921 IF (myerror.ne.mpi_success)
THEN
6922 CALL mpi_error_string (myerror, string, lstr, serror)
6923 lstr=len_trim(string)
6924 WRITE (
stdout,10)
'MPI_IRECV', rank,
rerror, string(1:lstr)
6928 IF (handle_op(1:3).eq.
'MIN')
THEN
6929 areduce=min(areduce,arecv(rank))
6930 ELSE IF (handle_op(1:3).eq.
'MAX')
THEN
6931 areduce=max(areduce,arecv(rank))
6932 ELSE IF (handle_op(1:3).eq.
'SUM')
THEN
6933 areduce=areduce+arecv(rank)
6938 & mycomm, request, myerror)
6939 CALL mpi_wait (request, sstatus, myerror)
6940 IF (myerror.ne.mpi_success)
THEN
6941 CALL mpi_error_string (myerror, string, lstr, serror)
6942 lstr=len_trim(string)
6943 WRITE (
stdout,10)
'MPI_ISEND',
myrank, serror, string(1:lstr)
6954 IF (myerror.ne.mpi_success)
THEN
6955 CALL mpi_error_string (myerror, string, lstr, serror)
6956 lstr=len_trim(string)
6957 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
6962 10
FORMAT (/,
' MP_REDUCE_0D - error during ',a,
' call, Task = ', &
6963 & i3.3,
' Error = ',i3,/,16x,a)
6974 CALL wclock_off (ng, model, 65, __line__, myfile)
6980 SUBROUTINE mp_reduce_1d (ng, model, Asize, A, handle_op, InpComm)
7007 integer,
intent(in) :: ng, model, Asize
7009 integer,
intent(in),
optional :: InpComm
7011 character (len=*),
intent(in) :: handle_op(Asize)
7013 real(r8),
intent(inout) :: A(Asize)
7017 integer :: Lstr, MyCOMM, MyError, Serror
7018 integer :: handle, i, rank, request
7020 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: Rrequest
7022 integer,
dimension(MPI_STATUS_SIZE) :: Rstatus
7023 integer,
dimension(MPI_STATUS_SIZE) :: Sstatus
7025 real(r8),
dimension(Asize,0:NtileI(ng)*NtileJ(ng)-1) :: Arecv
7026 real(r8),
dimension(Asize) :: Areduce
7027 real(r8),
dimension(Asize) :: Asend
7029 character (len=MPI_MAX_ERROR_STRING) :: string
7031 character (len=*),
parameter :: MyFile = &
7032 & __FILE__//
", mp_reduce_1d"
7040 CALL wclock_on (ng, model, 65, __line__, myfile)
7048 IF (
PRESENT(inpcomm))
THEN
7062 & 2*asize)*kind(a),r8))
7072# if defined REDUCE_ALLREDUCE
7074 IF (handle_op(i)(1:3).eq.
'MIN')
THEN
7076 ELSE IF (handle_op(i)(1:3).eq.
'MAX')
THEN
7078 ELSE IF (handle_op(i)(1:3).eq.
'SUM')
THEN
7081 CALL mpi_allreduce (asend(i), areduce(i), 1,
mp_float, handle, &
7083 IF (myerror.ne.mpi_success)
THEN
7084 CALL mpi_error_string (myerror, string, lstr, serror)
7085 lstr=len_trim(string)
7092# elif defined REDUCE_ALLGATHER
7093 CALL mpi_allgather (asend, asize,
mp_float, &
7096 IF (myerror.ne.mpi_success)
THEN
7097 CALL mpi_error_string (myerror, string, lstr, serror)
7098 lstr=len_trim(string)
7105 areduce(i)=arecv(i,0)
7107 IF (handle_op(i)(1:3).eq.
'MIN')
THEN
7108 areduce(i)=min(areduce(i),arecv(i,rank))
7109 ELSE IF (handle_op(i)(1:3).eq.
'MAX')
THEN
7110 areduce(i)=max(areduce(i),arecv(i,rank))
7111 ELSE IF (handle_op(i)(1:3).eq.
'SUM')
THEN
7112 areduce(i)=areduce(i)+arecv(i,rank)
7116# elif defined REDUCE_SENDRECV
7119 CALL mpi_irecv (arecv(1,rank), asize,
mp_float, rank, &
7120 & rank+500, mycomm, rrequest(rank), myerror)
7126 CALL mpi_wait (rrequest(rank), rstatus, myerror)
7127 IF (myerror.ne.mpi_success)
THEN
7128 CALL mpi_error_string (myerror, string, lstr, serror)
7129 lstr=len_trim(string)
7130 WRITE (
stdout,10)
'MPI_IRECV', rank,
rerror, string(1:lstr)
7135 IF (handle_op(i)(1:3).eq.
'MIN')
THEN
7136 areduce(i)=min(areduce(i),arecv(i,rank))
7137 ELSE IF (handle_op(i)(1:3).eq.
'MAX')
THEN
7138 areduce(i)=max(areduce(i),arecv(i,rank))
7139 ELSE IF (handle_op(i)(1:3).eq.
'SUM')
THEN
7140 areduce(i)=areduce(i)+arecv(i,rank)
7146 & mycomm, request, myerror)
7147 CALL mpi_wait (request, sstatus, myerror)
7148 IF (myerror.ne.mpi_success)
THEN
7149 CALL mpi_error_string (myerror, string, lstr, serror)
7150 lstr=len_trim(string)
7151 WRITE (
stdout,10)
'MPI_ISEND',
myrank, serror, string(1:lstr)
7162 IF (myerror.ne.mpi_success)
THEN
7163 CALL mpi_error_string (myerror, string, lstr, serror)
7164 lstr=len_trim(string)
7165 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
7170 10
FORMAT (/,
' MP_REDUCE_1D - error during ',a,
' call, Task = ', &
7171 & i3.3,
' Error = ',i3,/,16x,a)
7184 CALL wclock_off (ng, model, 65, __line__, myfile)
7190 SUBROUTINE mp_reduce2 (ng, model, Isize, Jsize, A, handle_op, &
7221 integer,
intent(in) :: ng, model, Isize, Jsize
7223 integer,
intent(in),
optional :: InpComm
7225 character (len=*),
intent(in) :: handle_op(Jsize)
7227 real(r8),
intent(inout) :: A(Isize,Jsize)
7231 integer :: Lstr, MyCOMM, MyError, Serror
7232 integer :: handle, i, j
7234 real(r8),
dimension(2,Isize) :: Areduce
7235 real(r8),
dimension(2,Isize) :: Asend
7237 character (len=MPI_MAX_ERROR_STRING) :: string
7239 character (len=*),
parameter :: MyFile = &
7240 & __FILE__//
", mp_reduce2"
7248 CALL wclock_on (ng, model, 65, __line__, myfile)
7256 IF (
PRESENT(inpcomm))
THEN
7270 &
SIZE(asend))*kind(a),r8))
7279 IF (handle_op(j)(1:6).eq.
'MINLOC')
THEN
7281 ELSE IF (handle_op(j)(1:6).eq.
'MAXLOC')
THEN
7284 CALL mpi_allreduce (asend, areduce, isize, &
7285# ifdef DOUBLE_PRECISION
7286 & mpi_2double_precision, &
7290 & handle, mycomm, myerror)
7291 IF (myerror.ne.mpi_success)
THEN
7292 CALL mpi_error_string (myerror, string, lstr, serror)
7293 lstr=len_trim(string)
7296 10
FORMAT (/,
' MP_REDUCE2 - error during ',a,
' call, Task = ', &
7297 & i3.3,
' Error = ',i3,/,16x,a)
7316 CALL wclock_off (ng, model, 65, __line__, myfile)
7322 SUBROUTINE mp_scatter2d (ng, model, LBi, UBi, LBj, UBj, &
7323 & Nghost, gtype, Amin, Amax, &
7324# if defined READ_WATER && defined MASKING
7325 & NWpts, IJ_water, &
7367 integer,
intent(in) :: ng, model
7368 integer,
intent(in) :: LBi, UBi, LBj, UBj
7369 integer,
intent(in) :: Nghost, gtype, Npts
7371# if defined READ_WATER && defined MASKING
7372 integer,
intent(in) :: NWpts
7373 integer,
intent(in) :: IJ_water(NWpts)
7376 real(r8),
intent(inout) :: Amin, Amax
7377 real(r8),
intent(inout) :: A(Npts+2)
7378 real(r8),
intent(out) :: Awrk(LBi:UBi,LBj:UBj)
7382 integer :: Io, Ie, Jo, Je, Ioff, Joff
7383 integer :: Imin, Imax, Jmin, Jmax
7384 integer :: iLB, iUB, jLB, jUB
7385 integer :: Isize, Jsize, IJsize, Vsize
7386 integer :: Lstr, MyError, MySize, MyType, Ntasks, Serror, ghost
7387 integer :: Cgrid, i, ic, ij, j, jc, mc, nc, rank
7389 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: counts, displs
7391# ifndef SCATTER_BCAST
7392 integer,
allocatable :: ij_global(:,:)
7394 real(r8) :: Astats(2)
7395 real(r8),
allocatable :: Vrecv(:)
7396 real(r8),
dimension(Npts) :: Vreset
7398 real(r8),
dimension(Npts+2) :: Vglobal
7400 character (len=10) :: MyMethod
7401 character (len=MPI_MAX_ERROR_STRING) :: string
7403 character (len=*),
parameter :: MyFile = &
7404 & __FILE__//
", mp_scatter2d"
7412 CALL wclock_on (ng, model, 67, __line__, myfile)
7430 SELECT CASE (mytype)
7478 SELECT CASE (mytype)
7494 ilb=
bounds(ng) % Imin(cgrid,ghost,rank)
7495 iub=
bounds(ng) % Imax(cgrid,ghost,rank)
7496 jlb=
bounds(ng) % Jmin(cgrid,ghost,rank)
7497 jub=
bounds(ng) % Jmax(cgrid,ghost,rank)
7504 counts(rank)=nc-displs(rank)
7515 IF (gtype.gt.0)
THEN
7516 vglobal(1:vsize)=a(1:vsize)
7517# if defined READ_WATER && defined MASKING
7527 IF (ij_water(mc+1).eq.ij)
THEN
7545# ifdef SCATTER_BCAST
7549 IF (nghost.eq.0)
THEN
7562 vglobal(vsize+1)=amin
7563 vglobal(vsize+2)=amax
7571 IF (myerror.ne.mpi_success)
THEN
7572 CALL mpi_error_string (myerror, string, lstr, serror)
7573 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, trim(string)
7574 10
FORMAT (/,
' ROMS_SCATTER2D - error during ',a, &
7575 &
' call, Task = ', i3.3,
' Error = ',i3,/,15x,a)
7586 awrk(i,j)=vglobal(ic)
7589 amin=vglobal(vsize-1)
7605 allocate ( ij_global(io:ie,jo:je) )
7621 ilb=
bounds(ng) % Imin(cgrid,ghost,rank)
7622 iub=
bounds(ng) % Imax(cgrid,ghost,rank)
7623 jlb=
bounds(ng) % Jmin(cgrid,ghost,rank)
7624 jub=
bounds(ng) % Jmax(cgrid,ghost,rank)
7629 vreset(nc)=vglobal(ij)
7633 deallocate (ij_global)
7638 mysize=(imax-imin+1)*(jmax-jmin+1)
7639 allocate ( vrecv(mysize) )
7642 CALL mpi_scatterv (vreset, counts, displs,
mp_float, &
7645 IF (myerror.ne.mpi_success)
THEN
7646 CALL mpi_error_string (myerror, string, lstr, serror)
7649 20
FORMAT (/,
' MP_SCATTER2D - error during ',a, &
7650 &
' call, Task = ', i3.3,
' Error = ',i3,/,15x,a)
7664 deallocate ( vrecv )
7668 IF (nghost.gt.0)
THEN
7670 & lbi, ubi, lbj, ubj, &
7685 IF (myerror.ne.mpi_success)
THEN
7686 CALL mpi_error_string (myerror, string, lstr, serror)
7687 WRITE (
stdout,30)
'MPI_BCAST',
myrank, myerror, trim(string)
7688 30
FORMAT (/,
' MP_SCATTER2D - error during ',a,
' call, Task = ', &
7689 & i3.3,
' Error = ',i3,/,15x,a)
7703 CALL wclock_off (ng, model, 67, __line__, myfile)
7711 SUBROUTINE mp_scatter2d_xtr (ng, model, LBi, UBi, LBj, UBj, &
7712 & Nghost, gtype, Amin, Amax, &
7713# if defined READ_WATER && defined MASKING
7714 & NWpts, IJ_water, &
7756 integer,
intent(in) :: ng, model
7757 integer,
intent(in) :: LBi, UBi, LBj, UBj
7758 integer,
intent(in) :: Nghost, gtype, Npts
7760# if defined READ_WATER && defined MASKING
7761 integer,
intent(in) :: NWpts
7762 integer,
intent(in) :: IJ_water(NWpts)
7765 real(r8),
intent(inout) :: Amin, Amax
7766 real(r8),
intent(inout) :: A(Npts+2)
7767 real(r8),
intent(out) :: Awrk(LBi:UBi,LBj:UBj)
7771 integer :: Io, Ie, Jo, Je, Ioff, Joff
7772 integer :: Imin, Imax, Jmin, Jmax
7773 integer :: iLB, iUB, jLB, jUB
7774 integer :: Isize, Jsize, IJsize, Vsize
7775 integer :: Lstr, MyError, MySize, MyType, Ntasks, Serror, ghost
7776 integer :: Cgrid, i, ic, ij, j, jc, mc, nc, rank
7778 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: counts, displs
7780# ifndef SCATTER_BCAST
7781 integer,
allocatable :: ij_global(:,:)
7783 real(r8) :: Astats(2)
7784 real(r8),
allocatable :: Vrecv(:)
7785 real(r8),
dimension(Npts) :: Vreset
7787 real(r8),
dimension(Npts+2) :: Vglobal
7789 character (len=MPI_MAX_ERROR_STRING) :: string
7791 character (len=*),
parameter :: MyFile = &
7792 & __FILE__//
", mp_scatter2d_xtr"
7800 CALL wclock_on (ng, model, 67, __line__, myfile)
7818 SELECT CASE (mytype)
7820 io=xtr_iobounds(ng) % ILB_psi
7821 ie=xtr_iobounds(ng) % IUB_psi
7822 jo=xtr_iobounds(ng) % JLB_psi
7823 je=xtr_iobounds(ng) % JUB_psi
7827 io=xtr_iobounds(ng) % ILB_rho
7828 ie=xtr_iobounds(ng) % IUB_rho
7829 jo=xtr_iobounds(ng) % JLB_rho
7830 je=xtr_iobounds(ng) % JUB_rho
7834 io=xtr_iobounds(ng) % ILB_u
7835 ie=xtr_iobounds(ng) % IUB_u
7836 jo=xtr_iobounds(ng) % JLB_u
7837 je=xtr_iobounds(ng) % JUB_u
7841 io=xtr_iobounds(ng) % ILB_v
7842 ie=xtr_iobounds(ng) % IUB_v
7843 jo=xtr_iobounds(ng) % JLB_v
7844 je=xtr_iobounds(ng) % JUB_v
7848 io=xtr_iobounds(ng) % ILB_rho
7849 ie=xtr_iobounds(ng) % IUB_rho
7850 jo=xtr_iobounds(ng) % JLB_rho
7851 je=xtr_iobounds(ng) % JUB_rho
7865 SELECT CASE (mytype)
7881 ilb=xtr_bounds(ng) % Imin(cgrid,ghost,rank)
7882 iub=xtr_bounds(ng) % Imax(cgrid,ghost,rank)
7883 jlb=xtr_bounds(ng) % Jmin(cgrid,ghost,rank)
7884 jub=xtr_bounds(ng) % Jmax(cgrid,ghost,rank)
7891 counts(rank)=nc-displs(rank)
7902 IF (gtype.gt.0)
THEN
7903 vglobal(1:vsize)=a(1:vsize)
7904# if defined READ_WATER && defined MASKING
7914 IF (ij_water(mc+1).eq.ij)
THEN
7932# ifdef SCATTER_BCAST
7936 IF (nghost.eq.0)
THEN
7941 imin=xtr_bounds(ng) % Imin(cgrid,ghost,
myrank)
7942 imax=xtr_bounds(ng) % Imax(cgrid,ghost,
myrank)
7943 jmin=xtr_bounds(ng) % Jmin(cgrid,ghost,
myrank)
7944 jmax=xtr_bounds(ng) % Jmax(cgrid,ghost,
myrank)
7949 vglobal(vsize+1)=amin
7950 vglobal(vsize+2)=amax
7958 IF (myerror.ne.mpi_success)
THEN
7959 CALL mpi_error_string (myerror, string, lstr, serror)
7960 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, trim(string)
7961 10
FORMAT (/,
' MP_SCATTER2D_XTR - error during ',a, &
7962 &
' call, Task = ',i3.3,
' Error = ',i3,/,15x,a)
7973 awrk(i,j)=vglobal(ic)
7976 amin=vglobal(vsize-1)
7984 imin=xtr_bounds(ng) % Imin(cgrid,ghost,
myrank)
7985 imax=xtr_bounds(ng) % Imax(cgrid,ghost,
myrank)
7986 jmin=xtr_bounds(ng) % Jmin(cgrid,ghost,
myrank)
7987 jmax=xtr_bounds(ng) % Jmax(cgrid,ghost,
myrank)
7992 allocate ( ij_global(io:ie,jo:je) )
8008 ilb=xtr_bounds(ng) % Imin(cgrid,ghost,rank)
8009 iub=xtr_bounds(ng) % Imax(cgrid,ghost,rank)
8010 jlb=xtr_bounds(ng) % Jmin(cgrid,ghost,rank)
8011 jub=xtr_bounds(ng) % Jmax(cgrid,ghost,rank)
8016 vreset(nc)=vglobal(ij)
8020 deallocate (ij_global)
8025 mysize=(imax-imin+1)*(jmax-jmin+1)
8026 allocate ( vrecv(mysize) )
8029 CALL mpi_scatterv (vreset, counts, displs,
mp_float, &
8032 IF (myerror.ne.mpi_success)
THEN
8033 CALL mpi_error_string (myerror, string, lstr, serror)
8036 20
FORMAT (/,
' MP_SCATTER2D_XTR - error during ',a, &
8037 &
' call, Task = ', i3.3,
' Error = ',i3,/,15x,a)
8051 deallocate ( vrecv )
8062 IF (myerror.ne.mpi_success)
THEN
8063 CALL mpi_error_string (myerror, string, lstr, serror)
8064 WRITE (
stdout,30)
'MPI_BCAST',
myrank, myerror, trim(string)
8065 30
FORMAT (/,
' MP_SCATTER2D_XTR - error during ',a, &
8066 &
' call, Task = ', i3.3,
' Error = ',i3,/,15x,a)
8080 CALL wclock_off (ng, model, 67, __line__, myfile)
8084 END SUBROUTINE mp_scatter2d_xtr
8087 SUBROUTINE mp_scatter3d (ng, model, LBi, UBi, LBj, UBj, LBk, UBk, &
8088 & Nghost, gtype, Amin, Amax, &
8089# if defined READ_WATER && defined MASKING
8090 & NWpts, IJ_water, &
8134 integer,
intent(in) :: ng, model
8135 integer,
intent(in) :: LBi, UBi, LBj, UBj, LBk, UBk
8136 integer,
intent(in) :: Nghost, gtype, Npts
8138# if defined READ_WATER && defined MASKING
8139 integer,
intent(in) :: NWpts
8140 integer,
intent(in) :: IJ_water(NWpts)
8143 real(r8),
intent(inout) :: Amin, Amax
8144 real(r8),
intent(inout) :: A(Npts+2)
8145 real(r8),
intent(out) :: Awrk(LBi:UBi,LBj:UBj,LBk:UBk)
8149 integer :: Io, Ie, Jo, Je, Ioff, Joff, Koff
8150 integer :: Imin, Imax, Jmin, Jmax
8151 integer :: iLB, iUB, jLB, jUB
8152 integer :: Isize, Jsize, Ksize, IJsize, Vsize, Vsize2d
8153 integer :: Lstr, MyError, MySize, MyType, Ntasks, Serror, ghost
8154 integer :: Cgrid, i, ic, ij, ijk, j, jc, k, kc, mc, nc, rank
8156 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: counts, displs
8158# ifndef SCATTER_BCAST
8159 integer,
allocatable :: ijk_global(:,:,:)
8161 real(r8) :: Astats(2)
8162 real(r8),
allocatable :: Vrecv(:)
8163 real(r8),
dimension(Npts) :: Vreset
8165 real(r8),
dimension(Npts+2) :: Vglobal
8167 character (len=10) :: MyMethod
8168 character (len=MPI_MAX_ERROR_STRING) :: string
8170 character (len=*),
parameter :: MyFile = &
8171 & __FILE__//
", mp_scatter3d"
8179 CALL wclock_on (ng, model, 67, __line__, myfile)
8197 SELECT CASE (mytype)
8252 SELECT CASE (mytype)
8268 ilb=
bounds(ng) % Imin(cgrid,ghost,rank)
8269 iub=
bounds(ng) % Imax(cgrid,ghost,rank)
8270 jlb=
bounds(ng) % Jmin(cgrid,ghost,rank)
8271 jub=
bounds(ng) % Jmax(cgrid,ghost,rank)
8280 counts(rank)=nc-displs(rank)
8291 IF (gtype.gt.0)
THEN
8292 vglobal(1:vsize)=a(1:vsize)
8293# if defined READ_WATER && defined MASKING
8305 IF (ij_water(mc+1).eq.ij)
THEN
8324# ifdef SCATTER_BCAST
8328 IF (nghost.eq.0)
THEN
8341 vglobal(vsize+1)=amin
8342 vglobal(vsize+2)=amax
8350 IF (myerror.ne.mpi_success)
THEN
8351 CALL mpi_error_string (myerror, string, lstr, serror)
8352 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, trim(string)
8353 10
FORMAT (/,
' MP_SCATTER3D - error during ',a, &
8354 &
' call, Task = ', i3.3,
' Error = ',i3,/,15x,a)
8362 kc=(k-koff)*isize*jsize
8367 awrk(i,j,k)=vglobal(ic)
8371 amin=vglobal(vsize-1)
8387 allocate ( ijk_global(io:ie,jo:je,lbk:ubk) )
8395 ijk_global(i,j,k)=ijk
8406 ilb=
bounds(ng) % Imin(cgrid,ghost,rank)
8407 iub=
bounds(ng) % Imax(cgrid,ghost,rank)
8408 jlb=
bounds(ng) % Jmin(cgrid,ghost,rank)
8409 jub=
bounds(ng) % Jmax(cgrid,ghost,rank)
8413 ijk=ijk_global(i,j,k)
8415 vreset(nc)=vglobal(ijk)
8420 deallocate (ijk_global)
8425 mysize=(imax-imin+1)*(jmax-jmin+1)*(ubk-lbk+1)
8426 allocate ( vrecv(mysize) )
8429 CALL mpi_scatterv (vreset, counts, displs,
mp_float, &
8432 IF (myerror.ne.mpi_success)
THEN
8433 CALL mpi_error_string (myerror, string, lstr, serror)
8436 20
FORMAT (/,
' MP_SCATTER3D - error during ',a, &
8437 &
' call, Task = ', i3.3,
' Error = ',i3,/,15x,a)
8449 awrk(i,j,k)=vrecv(nc)
8453 deallocate ( vrecv )
8457 IF (nghost.gt.0)
THEN
8459 & lbi, ubi, lbj, ubj, lbk, ubk, &
8474 IF (myerror.ne.mpi_success)
THEN
8475 CALL mpi_error_string (myerror, string, lstr, serror)
8476 lstr=len_trim(string)
8477 WRITE (
stdout,30)
'MPI_BCAST',
myrank, myerror, trim(string)
8478 30
FORMAT (/,
' MP_SCATTER3D - error during ',a,
' call, Task = ', &
8479 & i3.3,
' Error = ',i3,/,15x,a)
8493 CALL wclock_off (ng, model, 67, __line__, myfile)
8528 integer,
intent(in) :: ng, model
8529 integer,
intent(in) :: Mstr, Mend, Asize
8531 real(r8),
intent(inout) :: A(Asize)
8533 real(r8),
intent(out) :: Awrk(Mstr:Mend)
8537 integer :: Lstr, MyError, Serror
8538 integer :: i, rank, request
8540 integer,
dimension(0:NtileI(ng)*NtileJ(ng)-1) :: Rrequest
8542 integer,
dimension(MPI_STATUS_SIZE) :: status
8544 real(r8),
allocatable :: Arecv(:)
8546 character (len=MPI_MAX_ERROR_STRING) :: string
8548 character (len=*),
parameter :: MyFile = &
8549 & __FILE__//
", mp_scatter_state"
8557 CALL wclock_on (ng, model, 67, __line__, myfile)
8584 IF (.not.
allocated(arecv))
THEN
8585 allocate (arecv(asize))
8592 CALL mpi_irecv (arecv, asize,
mp_float, rank, rank+5, &
8594 CALL mpi_wait (rrequest(rank), status, myerror)
8595 IF (myerror.ne.mpi_success)
THEN
8596 CALL mpi_error_string (myerror, string, lstr, serror)
8597 lstr=len_trim(string)
8598 WRITE (
stdout,10)
'MPI_IRECV', rank, myerror, string(1:lstr)
8599 10
FORMAT (/,
' MP_SCATTER_STATE - error during ',a, &
8600 &
' call, Task = ', i3.3,
' Error = ',i3,/,13x,a)
8614 CALL mpi_wait (request, status, myerror)
8615 IF (myerror.ne.mpi_success)
THEN
8616 CALL mpi_error_string (myerror, string, lstr, serror)
8617 lstr=len_trim(string)
8618 WRITE (
stdout,10)
'MPI_ISEND',
myrank, myerror, string(1:lstr)
8628 IF (myerror.ne.mpi_success)
THEN
8629 CALL mpi_error_string (myerror, string, lstr, serror)
8630 lstr=len_trim(string)
8631 WRITE (
stdout,10)
'MPI_BCAST',
myrank, myerror, string(1:lstr)
8654 CALL wclock_off (ng, model, 67, __line__, myfile)
8661 & LBiT, UBiT, LBjT, UBjT, &
8662 & LBiG, UBiG, LBjG, UBjG, &
8694 integer,
intent(in) :: ng, model, gtype
8695 integer,
intent(in) :: LBiT, UBiT, LBjT, UBjT
8696 integer,
intent(in) :: LBiG, UBiG, LBjG, UBjG
8698 real(r8),
intent(in) :: Atiled(LBiT:UBiT,LBjT:UBjT)
8699 real(r8),
intent(out) :: Aglobal(LBiG:UBiG,LBjG:UBjG)
8703 integer :: Lstr, MyError, MyType, Nnodes, Npts, Serror
8704 integer :: i, j, np, rank
8706 integer,
dimension(4,0:NtileI(ng)*NtileJ(ng)-1) :: my_bounds
8708 real(r8),
dimension(TileSize(ng)) :: Asend
8709 real(r8),
dimension(TileSize(ng)* &
& NtileI(ng)*NtileJ(ng)) :: Arecv
8711 character (len=MPI_MAX_ERROR_STRING) :: string
8713 character (len=*),
parameter :: MyFile = &
8714 & __FILE__//
", mp_aggregate2d"
8722 CALL wclock_on (ng, model, 71, __line__, myfile)
8734 &
SIZE(arecv))*kind(asend),r8))
8745 SELECT CASE (mytype)
8748 my_bounds(1,rank)=
bounds(ng) % IstrP(rank)
8749 my_bounds(2,rank)=
bounds(ng) % IendP(rank)
8750 my_bounds(3,rank)=
bounds(ng) % JstrP(rank)
8751 my_bounds(4,rank)=
bounds(ng) % JendP(rank)
8755 my_bounds(1,rank)=
bounds(ng) % IstrT(rank)
8756 my_bounds(2,rank)=
bounds(ng) % IendT(rank)
8757 my_bounds(3,rank)=
bounds(ng) % JstrT(rank)
8758 my_bounds(4,rank)=
bounds(ng) % JendT(rank)
8762 my_bounds(1,rank)=
bounds(ng) % IstrP(rank)
8763 my_bounds(2,rank)=
bounds(ng) % IendP(rank)
8764 my_bounds(3,rank)=
bounds(ng) % JstrT(rank)
8765 my_bounds(4,rank)=
bounds(ng) % JendT(rank)
8769 my_bounds(1,rank)=
bounds(ng) % IstrT(rank)
8770 my_bounds(2,rank)=
bounds(ng) % IendT(rank)
8771 my_bounds(3,rank)=
bounds(ng) % JstrP(rank)
8772 my_bounds(4,rank)=
bounds(ng) % JendP(rank)
8782 np=(my_bounds(2,rank)-my_bounds(1,rank)+1)* &
8783 & (my_bounds(4,rank)-my_bounds(3,rank)+1)
8790 10
FORMAT (/,
' MP_AGGREGATE2D - communication buffer to small,', &
8811 asend(np)=atiled(i,j)
8819 CALL mpi_allgather (asend, npts,
mp_float, &
8822 IF (myerror.ne.mpi_success)
THEN
8823 CALL mpi_error_string (myerror, string, lstr, serror)
8824 lstr=len_trim(string)
8827 20
FORMAT (/,
' MP_AGGREGATE2D - error during ',a,
' call, Task = ', &
8828 & i3.3,
' Error = ',i3,/,18x,a)
8839 DO j=my_bounds(3,rank),my_bounds(4,rank)
8840 DO i=my_bounds(1,rank),my_bounds(2,rank)
8842 aglobal(i,j)=arecv(np)
8853 CALL wclock_off (ng, model, 71, __line__, myfile)
8860 & LBiT, UBiT, LBjT, UBjT, &
8861 & LBiG, UBiG, LBjG, UBjG, &
8898 integer,
intent(in) :: ng, model, gtype
8899 integer,
intent(in) :: LBiT, UBiT, LBjT, UBjT
8900 integer,
intent(in) :: LBiG, UBiG, LBjG, UBjG
8901 integer,
intent(in) :: LBk, UBk
8903 real(r8),
intent(in) :: Atiled(LBiT:UBiT,LBjT:UBjT,LBk:UBk)
8904 real(r8),
intent(out) :: Aglobal(LBiG:UBiG,LBjG:UBjG,LBk:UBk)
8908 integer :: Klen, Lstr, MyError, MyType, Nnodes, Npts, Serror
8909 integer :: i, j, k, np, rank
8911 integer,
dimension(4,0:NtileI(ng)*NtileJ(ng)-1) :: my_bounds
8913 real(r8),
dimension(TileSize(ng)*(UBk-LBk+1)) :: Asend
8915 real(r8),
dimension(TileSize(ng)*(UBk-LBk+1)* &
& NtileI(ng)*NtileJ(ng)) :: Arecv
8917 character (len=MPI_MAX_ERROR_STRING) :: string
8919 character (len=*),
parameter :: MyFile = &
8920 & __FILE__//
", mp_aggregate3d"
8928 CALL wclock_on (ng, model, 71, __line__, myfile)
8940 &
SIZE(arecv))*kind(asend),r8))
8951 SELECT CASE (mytype)
8954 my_bounds(1,rank)=
bounds(ng) % IstrP(rank)
8955 my_bounds(2,rank)=
bounds(ng) % IendP(rank)
8956 my_bounds(3,rank)=
bounds(ng) % JstrP(rank)
8957 my_bounds(4,rank)=
bounds(ng) % JendP(rank)
8961 my_bounds(1,rank)=
bounds(ng) % IstrT(rank)
8962 my_bounds(2,rank)=
bounds(ng) % IendT(rank)
8963 my_bounds(3,rank)=
bounds(ng) % JstrT(rank)
8964 my_bounds(4,rank)=
bounds(ng) % JendT(rank)
8968 my_bounds(1,rank)=
bounds(ng) % IstrP(rank)
8969 my_bounds(2,rank)=
bounds(ng) % IendP(rank)
8970 my_bounds(3,rank)=
bounds(ng) % JstrT(rank)
8971 my_bounds(4,rank)=
bounds(ng) % JendT(rank)
8975 my_bounds(1,rank)=
bounds(ng) % IstrT(rank)
8976 my_bounds(2,rank)=
bounds(ng) % IendT(rank)
8977 my_bounds(3,rank)=
bounds(ng) % JstrP(rank)
8978 my_bounds(4,rank)=
bounds(ng) % JendP(rank)
8989 np=(my_bounds(2,rank)-my_bounds(1,rank)+1)* &
8990 & (my_bounds(4,rank)-my_bounds(3,rank)+1)* &
8995 IF (npts.gt.
tilesize(ng)*klen)
THEN
8998 10
FORMAT (/,
' MP_AGGREGATE3D - communication buffer to small,', &
9020 asend(np)=atiled(i,j,k)
9029 CALL mpi_allgather (asend, npts,
mp_float, &
9032 IF (myerror.ne.mpi_success)
THEN
9033 CALL mpi_error_string (myerror, string, lstr, serror)
9034 lstr=len_trim(string)
9037 20
FORMAT (/,
' MP_AGGREGATE3D - error during ',a,
' call, Task = ', &
9038 & i3.3,
' Error = ',i3,/,18x,a)
9050 DO j=my_bounds(3,rank),my_bounds(4,rank)
9051 DO i=my_bounds(1,rank),my_bounds(2,rank)
9053 aglobal(i,j,k)=arecv(np)
9065 CALL wclock_off (ng, model, 71, __line__, myfile)
9071 SUBROUTINE mp_dump (ng, tile, gtype, &
9072 & ILB, IUB, JLB, JUB, KLB, KUB, A, name)
9083 integer,
intent(in) :: ng, tile, gtype
9084 integer,
intent(in) :: ILB, IUB, JLB, JUB, KLB, KUB
9086 real(r8),
intent(in) :: A(ILB:IUB,JLB:JUB,KLB:KUB)
9088 character (len=*) :: name
9095 logical,
save :: first = .true.
9097 integer :: Imin, Imax, Ioff, Jmin, Jmax, Joff
9100 character (len=*),
parameter :: MyFile = &
9101 & __FILE__//
", mp_dump"
9103# include "set_bounds.h"
9115 WRITE (10,
'(a,i3.3,a,a)')
'file ', nc,
': ', trim(name)
9147 WRITE (unit,*) ilb, iub, jlb, jub, klb, kub, &
9148 & ioff, joff, imin, imax, jmin, jmax, &
9149 & a(ilb:iub,jlb:jub,klb:kub)
9182 WRITE (unit,*) imin, imax, jmin, jmax, klb, kub, &
9183 & ioff, joff, imin, imax, jmin, jmax, &
9184 & a(imin:imax,jmin:jmax,klb:kub)
subroutine mp_bcastl_0d(ng, model, a, inpcomm)
subroutine mp_assemblef_1d(ng, model, npts, aspv, a, inpcomm)
subroutine mp_bcastf_3dp(ng, model, a, inpcomm)
subroutine mp_bcastf_3d(ng, model, a, inpcomm)
subroutine mp_scatter3d(ng, model, lbi, ubi, lbj, ubj, lbk, ubk, nghost, gtype, amin, amax, nwpts, ij_water, npts, a, awrk)
subroutine mp_bcastf_4d(ng, model, a, inpcomm)
subroutine mp_collect_i(ng, model, npts, aspv, a, inpcomm)
integer function mp_ncwrite2d(ng, model, ncid, ncvname, ncname, ncrec, lb1, ub1, lb2, ub2, ascale, a)
subroutine mp_reduce2(ng, model, isize, jsize, a, handle_op, inpcomm)
subroutine mp_reduce_0dp(ng, model, asize, a, handle_op, inpcomm)
subroutine mp_gather_state(ng, model, mstr, mend, asize, a, awrk)
subroutine mp_bcastl_1d(ng, model, a, inpcomm)
subroutine mp_bcastf_2d(ng, model, a, inpcomm)
subroutine mp_reduce_1d(ng, model, asize, a, handle_op, inpcomm)
subroutine mp_assemblef_3d(ng, model, npts, aspv, a, inpcomm)
subroutine mp_bcasti_2d(ng, model, a, inpcomm)
subroutine mp_bcastf_2dp(ng, model, a, inpcomm)
subroutine mp_bcasts_1d(ng, model, a, inpcomm)
subroutine mp_bcasti_1d(ng, model, a, inpcomm)
subroutine mp_assemblei_1d(ng, model, npts, aspv, a, inpcomm)
subroutine mp_bcasts_0d(ng, model, a, inpcomm)
subroutine mp_reduce_0d(ng, model, asize, a, handle_op, inpcomm)
integer function mp_ncread1d(ng, model, ncid, ncvname, ncname, ncrec, lb1, ub1, ascale, a)
subroutine mp_bcasts_2d(ng, model, a, inpcomm)
subroutine mp_bcastf_1dp(ng, model, a, inpcomm)
integer function mp_ncread2d(ng, model, ncid, ncvname, ncname, ncrec, lb1, ub1, lb2, ub2, ascale, a)
subroutine mp_aggregate3d(ng, model, gtype, lbit, ubit, lbjt, ubjt, lbig, ubig, lbjg, ubjg, lbk, ubk, atiled, aglobal)
subroutine mp_gather3d(ng, model, lbi, ubi, lbj, ubj, lbk, ubk, tindex, gtype, ascl, amask, a, npts, awrk, setfillval)
subroutine mp_boundary(ng, model, imin, imax, lbi, ubi, lbk, ubk, update, a)
subroutine mp_reduce_i8(ng, model, asize, a, handle_op, inpcomm)
subroutine mp_aggregate2d(ng, model, gtype, lbit, ubit, lbjt, ubjt, lbig, ubig, lbjg, ubjg, atiled, aglobal)
subroutine mp_collect_f(ng, model, npts, aspv, a, inpcomm)
subroutine mp_barrier(ng, model, inpcomm)
subroutine mp_bcastf_0dp(ng, model, a, inpcomm)
subroutine mp_bcasti_0d(ng, model, a, inpcomm)
subroutine mp_assemblef_2d(ng, model, npts, aspv, a, inpcomm)
subroutine mp_assemblei_2d(ng, model, npts, aspv, a, inpcomm)
subroutine mp_gather2d(ng, model, lbi, ubi, lbj, ubj, tindex, gtype, ascl, amask, a, npts, awrk, setfillval)
subroutine mp_dump(ng, tile, gtype, ilb, iub, jlb, jub, klb, kub, a, name)
integer function mp_ncwrite1d(ng, model, ncid, ncvname, ncname, ncrec, lb1, ub1, ascale, a)
subroutine mp_scatter2d(ng, model, lbi, ubi, lbj, ubj, nghost, gtype, amin, amax, nwpts, ij_water, npts, a, awrk)
subroutine mp_scatter_state(ng, model, mstr, mend, asize, a, awrk)
subroutine mp_reduce_1dp(ng, model, asize, a, handle_op, inpcomm)
subroutine mp_bcastf_0d(ng, model, a, inpcomm)
subroutine mp_bcastl_2d(ng, model, a, inpcomm)
subroutine mp_bcast_struc(ng, model, s, inpcomm)
subroutine mp_bcasts_3d(ng, model, a, inpcomm)
subroutine mp_bcastf_1d(ng, model, a, inpcomm)
character(len=50), dimension(9) rerror
integer, parameter mp_double
integer, parameter mp_float
integer, dimension(:), allocatable tilesize
type(t_bounds), dimension(:), allocatable bounds
integer, parameter r3dvar
type(t_iobounds), dimension(:), allocatable iobounds
integer, parameter u3dvar
integer, dimension(:), allocatable lm
integer, parameter u2dvar
real(r8), dimension(:), allocatable bmemmax
integer, dimension(:), allocatable ntilei
integer, parameter p2dvar
integer, dimension(:), allocatable mm
integer, parameter r2dvar
integer, parameter v2dvar
integer, parameter p3dvar
integer, parameter v3dvar
integer, dimension(:), allocatable ntilej
real(dp), parameter spval
logical, dimension(:), allocatable ewperiodic
logical, dimension(:), allocatable nsperiodic
subroutine mp_exchange2d(ng, tile, model, nvar, lbi, ubi, lbj, ubj, nghost, ew_periodic, ns_periodic, a, b, c, d)
subroutine mp_exchange3d(ng, tile, model, nvar, lbi, ubi, lbj, ubj, lbk, ubk, nghost, ew_periodic, ns_periodic, a, b, c, d)
recursive subroutine wclock_off(ng, model, region, line, routine)
recursive subroutine wclock_on(ng, model, region, line, routine)