2 !***********************************************************************
3 !* GNU Lesser General Public License
5 !* This file
is part of the GFDL Flexible Modeling System (FMS).
7 !* FMS
is free software: you can redistribute it and/or modify it under
8 !* the terms of the GNU Lesser General Public License as published by
9 !* the Free Software Foundation, either
version 3 of the License, or (at
10 !* your option) any later
version.
12 !* FMS
is distributed in the hope that it
will be useful, but WITHOUT
13 !* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 !* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 !* You should have
received a copy of the GNU Lesser General Public
18 !* License along with FMS. If
not, see <http:
19 !***********************************************************************
20 subroutine MPP_DO_GET_BOUNDARY_3D_( f_addrs, domain,
bound, b_addrs, bsize, ke, d_type)
21 type(domain2D), intent(in) :: domain
25 integer, intent(in) :: bsize(:), ke
26 MPP_TYPE_, intent(in) :: d_type ! creates unique interface
29 MPP_TYPE_ :: ebuffer(bsize(1), ke), sbuffer(bsize(2), ke), wbuffer(bsize(3), ke), nbuffer(bsize(4), ke)
30 pointer(ptr_field,
field)
31 pointer(ptr_ebuffer, ebuffer)
32 pointer(ptr_sbuffer, sbuffer)
33 pointer(ptr_wbuffer, wbuffer)
34 pointer(ptr_nbuffer, nbuffer)
46 pointer( ptr, buffer )
47 ptr = LOC(mpp_domains_stack)
50 l_size =
size(f_addrs,1)
52 !---- determine
recv(1) based on b_addrs (
east boundary )
53 num = count(b_addrs(1,:,1) == 0)
56 else
if( num == l_size ) then
60 "mpp_do_get_boundary: number of ebuffer with null address should be 0 or l_size")
63 !---- determine
recv(2) based on b_addrs (
south boundary )
64 num = count(b_addrs(2,:,1) == 0)
67 else
if( num == l_size ) then
71 "mpp_do_get_boundary: number of sbuffer with null address should be 0 or l_size")
74 !---- determine
recv(3) based on b_addrs (
west boundary )
75 num = count(b_addrs(3,:,1) == 0)
78 else
if( num == l_size ) then
82 "mpp_do_get_boundary: number of wbuffer with null address should be 0 or l_size")
85 !---- determine
recv(4) based on b_addrs (
north boundary )
86 num = count(b_addrs(4,:,1) == 0)
89 else
if( num == l_size ) then
93 "mpp_do_get_boundary: number of nbuffer with null address should be 0 or l_size")
97 nlist =
size(domain%list(:))
100 allocate(msg1(0:nlist-1), msg2(0:nlist-1) )
115 call mpp_recv( msg1(l), glen=1,
from_pe=
from_pe, block=.FALSE., tag=COMM_TAG_1)
131 call mpp_sync_self(
check=EVENT_RECV)
134 if(msg1(
m) .NE. msg2(
m)) then
135 print*, "My
pe = ", mpp_pe(), ",domain
name =", trim(domain%
name), ",from
pe=", &
141 write(
outunit,*)"NOTE from mpp_do_get_boundary: message sizes are matched between
send and
recv for domain " &
143 deallocate(msg1, msg2)
161 call
mpp_error( FATAL, 'MPP_DO_GET_BOUNDARY_OLD: mpp_domains_stack overflow, '
162 'call mpp_domains_set_stack_size('
165 buffer_pos = buffer_pos +
msgsize 168 buffer_recv_size = buffer_pos
181 ptr_field = f_addrs(l, tMe)
193 ptr_field = f_addrs(l, tMe)
205 ptr_field = f_addrs(l, tMe)
215 case (ONE_HUNDRED_EIGHTY)
217 ptr_field = f_addrs(l, tMe)
232 !--- maybe we do
not need the following stack
size check.
236 call
mpp_error( FATAL, 'MPP_DO_GET_BOUNDARY_OLD: mpp_domains_stack overflow, '
237 'call mpp_domains_set_stack_size('
245 call mpp_sync_self(
check=EVENT_RECV)
247 buffer_pos = buffer_recv_size
263 ptr_ebuffer = b_addrs(1, l, tMe)
269 ebuffer(index,
k) = buffer(
pos)
277 ptr_sbuffer = b_addrs(2, l, tMe)
283 sbuffer(index,
k) = buffer(
pos)
291 ptr_wbuffer = b_addrs(3, l, tMe)
297 wbuffer(index,
k) = buffer(
pos)
305 ptr_nbuffer = b_addrs(4, l, tMe)
311 nbuffer(index,
k) = buffer(
pos)
322 call mpp_sync_self( )
325 end subroutine MPP_DO_GET_BOUNDARY_3D_
328 subroutine MPP_DO_GET_BOUNDARY_3D_V_(f_addrsx, f_addrsy, domain, boundx, boundy, b_addrsx, b_addrsy, &
329 bsizex, bsizey, ke, d_type, flags, gridtype)
330 type(domain2D), intent(in) :: domain
331 type(overlapSpec), intent(in) :: boundx, boundy
334 integer, intent(in) :: bsizex(:), bsizey(:), ke
335 MPP_TYPE_, intent(in) :: d_type ! creates unique interface
337 integer, intent(in) :: gridtype
339 MPP_TYPE_ :: fieldx(boundx%xbegin:boundx%xend, boundx%ybegin:boundx%yend,ke)
340 MPP_TYPE_ :: fieldy(boundy%xbegin:boundy%xend, boundy%ybegin:boundy%yend,ke)
341 MPP_TYPE_ :: ebufferx(bsizex(1), ke), sbufferx(bsizex(2), ke), wbufferx(bsizex(3), ke), nbufferx(bsizex(4), ke)
342 MPP_TYPE_ :: ebuffery(bsizey(1), ke), sbuffery(bsizey(2), ke), wbuffery(bsizey(3), ke), nbuffery(bsizey(4), ke)
343 pointer(ptr_fieldx, fieldx)
344 pointer(ptr_fieldy, fieldy)
345 pointer(ptr_ebufferx, ebufferx)
346 pointer(ptr_sbufferx, sbufferx)
347 pointer(ptr_wbufferx, wbufferx)
348 pointer(ptr_nbufferx, nbufferx)
349 pointer(ptr_ebuffery, ebuffery)
350 pointer(ptr_sbuffery, sbuffery)
351 pointer(ptr_wbuffery, wbuffery)
352 pointer(ptr_nbuffery, nbuffery)
355 logical :: recvx(4), sendx(4)
356 logical :: recvy(4), sendy(4)
360 integer :: rank_x, rank_y, cur_rank, ind_x, ind_y
361 integer :: nsend_x, nsend_y, nrecv_x, nrecv_y, num
366 pointer( ptr, buffer )
367 ptr = LOC(mpp_domains_stack)
370 l_size =
size(f_addrsx,1)
371 !---- determine
recv(1) based on b_addrs (
east boundary )
372 num = count(b_addrsx(1,:,1) == 0)
375 else
if( num == l_size ) then
379 "mpp_do_get_boundary_V: number of ebufferx with null address should be 0 or l_size")
382 !---- determine
recv(2) based on b_addrs (
south boundary )
383 num = count(b_addrsx(2,:,1) == 0)
386 else
if( num == l_size ) then
390 "mpp_do_get_boundary_V: number of sbufferx with null address should be 0 or l_size")
393 !---- determine
recv(3) based on b_addrs (
west boundary )
394 num = count(b_addrsx(3,:,1) == 0)
397 else
if( num == l_size ) then
401 "mpp_do_get_boundary_V: number of wbufferx with null address should be 0 or l_size")
404 !---- determine
recv(4) based on b_addrs (
north boundary )
405 num = count(b_addrsx(4,:,1) == 0)
408 else
if( num == l_size ) then
412 "mpp_do_get_boundary_V: number of nbufferx with null address should be 0 or l_size")
415 !---- determine
recv(1) based on b_addrs (
east boundary )
416 num = count(b_addrsy(1,:,1) == 0)
419 else
if( num == l_size ) then
423 "mpp_do_get_boundary_V: number of ebuffery with null address should be 0 or l_size")
426 !---- determine
recv(2) based on b_addrs (
south boundary )
427 num = count(b_addrsy(2,:,1) == 0)
430 else
if( num == l_size ) then
434 "mpp_do_get_boundary_V: number of sbuffery with null address should be 0 or l_size")
437 !---- determine
recv(3) based on b_addrs (
west boundary )
438 num = count(b_addrsy(3,:,1) == 0)
441 else
if( num == l_size ) then
445 "mpp_do_get_boundary_V: number of wbuffery with null address should be 0 or l_size")
448 !---- determine
recv(4) based on b_addrs (
north boundary )
449 num = count(b_addrsy(4,:,1) == 0)
452 else
if( num == l_size ) then
456 "mpp_do_get_boundary_V: number of nbuffery with null address should be 0 or l_size")
462 nlist =
size(domain%list(:))
464 nsend_x = boundx%nsend
465 nsend_y = boundy%nsend
466 nrecv_x = boundx%nrecv
467 nrecv_y = boundy%nrecv
470 allocate(msg1(0:nlist-1), msg2(0:nlist-1) )
474 cur_rank = get_rank_recv(domain, boundx, boundy, rank_x, rank_y, ind_x, ind_y)
476 do while ( ind_x .LE. nrecv_x .OR. ind_y .LE. nrecv_y )
478 if(cur_rank == rank_x) then
480 do
n = 1, boundx%
recv(ind_x)%count
481 if(recvx(boundx%
recv(ind_x)%dir(
n))) then
488 if(ind_x .LE. nrecv_x) then
489 rank_x = boundx%
recv(ind_x)%
pe - domain%
pe 490 if(rank_x .LE.0) rank_x = rank_x + nlist
496 if(cur_rank == rank_y) then
498 do
n = 1, boundy%
recv(ind_y)%count
499 if(recvy(boundy%
recv(ind_y)%dir(
n))) then
506 if(ind_y .LE. nrecv_y) then
507 rank_y = boundy%
recv(ind_y)%
pe - domain%
pe 508 if(rank_y .LE.0) rank_y = rank_y + nlist
513 cur_rank =
max(rank_x, rank_y)
515 call mpp_recv( msg1(
m), glen=1,
from_pe=
from_pe, block=.FALSE., tag=COMM_TAG_3)
519 cur_rank = get_rank_send(domain, boundx, boundy, rank_x, rank_y, ind_x, ind_y)
520 do while (ind_x .LE. nsend_x .OR. ind_y .LE. nsend_y)
522 if(cur_rank == rank_x) then
524 do
n = 1, boundx%
send(ind_x)%count
525 if(sendx(boundx%
send(ind_x)%dir(
n))) then
532 if(ind_x .LE. nsend_x) then
533 rank_x = boundx%
send(ind_x)%
pe - domain%
pe 534 if(rank_x .LT.0) rank_x = rank_x + nlist
540 if(cur_rank == rank_y) then
542 do
n = 1, boundy%
send(ind_y)%count
543 if(sendy(boundy%
send(ind_y)%dir(
n))) then
550 if(ind_y .LE. nsend_y) then
551 rank_y = boundy%
send(ind_y)%
pe - domain%
pe 552 if(rank_y .LT.0) rank_y = rank_y + nlist
557 cur_rank =
min(rank_x, rank_y)
561 call mpp_sync_self(
check=EVENT_RECV)
563 if(msg1(
m) .NE. msg2(
m)) then
564 print*, "My
pe = ", mpp_pe(), ",domain
name =", trim(domain%
name), ",from
pe=", &
571 write(
outunit,*)"NOTE from mpp_do_get_boundary_V: message sizes are matched between
send and
recv for domain " &
573 deallocate(msg1, msg2)
578 cur_rank = get_rank_recv(domain, boundx, boundy, rank_x, rank_y, ind_x, ind_y)
580 do while ( ind_x .LE. nrecv_x .OR. ind_y .LE. nrecv_y )
582 if(cur_rank == rank_x) then
584 do
n = 1, boundx%
recv(ind_x)%count
585 if(recvx(boundx%
recv(ind_x)%dir(
n))) then
592 if(ind_x .LE. nrecv_x) then
593 rank_x = boundx%
recv(ind_x)%
pe - domain%
pe 594 if(rank_x .LE.0) rank_x = rank_x + nlist
600 if(cur_rank == rank_y) then
602 do
n = 1, boundy%
recv(ind_y)%count
603 if(recvy(boundy%
recv(ind_y)%dir(
n))) then
610 if(ind_y .LE. nrecv_y) then
611 rank_y = boundy%
recv(ind_y)%
pe - domain%
pe 612 if(rank_y .LE.0) rank_y = rank_y + nlist
617 cur_rank =
max(rank_x, rank_y)
623 call
mpp_error( FATAL, 'MPP_DO_GET_BOUNDARY_V_: mpp_domains_stack overflow, '
624 'call mpp_domains_set_stack_size('
627 buffer_pos = buffer_pos +
msgsize 630 buffer_recv_size = buffer_pos
633 cur_rank = get_rank_send(domain, boundx, boundy, rank_x, rank_y, ind_x, ind_y)
635 do while (ind_x .LE. nsend_x .OR. ind_y .LE. nsend_y)
637 if(cur_rank == rank_x) then
639 do
n = 1, boundx%
send(ind_x)%count
640 if(sendx(boundx%
send(ind_x)%dir(
n))) then
643 tMe = boundx%
send(ind_x)%tileMe(
n)
644 select
case( boundx%
send(ind_x)%rotation(
n) )
647 ptr_fieldx = f_addrsx(l, tMe)
652 buffer(
pos) = fieldx(
i,
j,
k)
658 if( BTEST(flags,SCALAR_BIT) ) then
660 ptr_fieldy = f_addrsy(l, tMe)
665 buffer(
pos) = fieldy(
i,
j,
k)
672 ptr_fieldy = f_addrsy(l, tMe)
677 buffer(
pos) = -fieldy(
i,
j,
k)
685 ptr_fieldy = f_addrsy(l, tMe)
690 buffer(
pos) = fieldy(
i,
j,
k)
695 case (ONE_HUNDRED_EIGHTY)
696 if( BTEST(flags,SCALAR_BIT) ) then
698 ptr_fieldx = f_addrsx(l, tMe)
703 buffer(
pos) = fieldx(
i,
j,
k)
710 ptr_fieldx = f_addrsx(l, tMe)
715 buffer(
pos) = -fieldx(
i,
j,
k)
723 end do !do
n = 1, boundx%count
725 if(ind_x .LE. nsend_x) then
726 rank_x = boundx%
send(ind_x)%
pe - domain%
pe 727 if(rank_x .LT.0) rank_x = rank_x + nlist
733 if(cur_rank == rank_y) then
735 do
n = 1, boundy%
send(ind_y)%count
736 if(sendy(boundy%
send(ind_y)%dir(
n))) then
739 tMe = boundy%
send(ind_y)%tileMe(
n)
740 select
case( boundy%
send(ind_y)%rotation(
n) )
743 ptr_fieldy = f_addrsy(l, tMe)
748 buffer(
pos) = fieldy(
i,
j,
k)
755 ptr_fieldx = f_addrsx(l, tMe)
760 buffer(
pos) = fieldx(
i,
j,
k)
766 if( BTEST(flags,SCALAR_BIT) ) then
768 ptr_fieldx = f_addrsx(l, tMe)
773 buffer(
pos) = fieldx(
i,
j,
k)
780 ptr_fieldx = f_addrsx(l, tMe)
785 buffer(
pos) = -fieldx(
i,
j,
k)
791 case (ONE_HUNDRED_EIGHTY)
792 if( BTEST(flags,SCALAR_BIT) ) then
794 ptr_fieldy = f_addrsy(l, tMe)
799 buffer(
pos) = fieldy(
i,
j,
k)
806 ptr_fieldy = f_addrsy(l, tMe)
811 buffer(
pos) = -fieldy(
i,
j,
k)
819 end do ! do
n = 1, boundy%count
821 if(ind_y .LE. nsend_y) then
822 rank_y = boundy%
send(ind_y)%
pe - domain%
pe 823 if(rank_y .LT.0) rank_y = rank_y + nlist
828 cur_rank =
min(rank_x, rank_y)
831 !--- maybe we do
not need the following stack
size check.
835 call
mpp_error( FATAL, 'MPP_DO_GET_BOUNDARY_V_: mpp_domains_stack overflow, '
836 'call mpp_domains_set_stack_size('
844 call mpp_sync_self(
check=EVENT_RECV)
848 buffer_pos = buffer_recv_size
849 cur_rank = get_rank_unpack(domain, boundx, boundy, rank_x, rank_y, ind_x, ind_y)
851 do while(ind_x >0 .OR. ind_y >0)
852 if(cur_rank == rank_y) then
853 do
n = boundy%
recv(ind_y)%count, 1, -1
854 if(recvy(boundy%
recv(ind_y)%dir(
n))) then
860 tMe = boundy%
recv(ind_y)%tileMe(
n)
864 ptr_ebuffery = b_addrsy(1, l, tMe)
866 index = boundy%
recv(ind_y)%index(
n)
870 ebuffery(index,
k) = buffer(
pos)
878 ptr_sbuffery = b_addrsy(2, l, tMe)
880 index = boundy%
recv(ind_y)%index(
n)
884 sbuffery(index,
k) = buffer(
pos)
892 ptr_wbuffery = b_addrsy(3, l, tMe)
894 index = boundy%
recv(ind_y)%index(
n)
898 wbuffery(index,
k) = buffer(
pos)
906 ptr_nbuffery = b_addrsy(4, l, tMe)
908 index = boundy%
recv(ind_y)%index(
n)
912 nbuffery(index,
k) = buffer(
pos)
922 if(ind_y .GT. 0) then
923 rank_y = boundy%
recv(ind_y)%
pe - domain%
pe 924 if(rank_y .LE.0) rank_y = rank_y + nlist
930 if(cur_rank == rank_x) then
931 do
n = boundx%
recv(ind_x)%count, 1, -1
932 if(recvx(boundx%
recv(ind_x)%dir(
n))) then
938 tMe = boundx%
recv(ind_x)%tileMe(
n)
942 ptr_ebufferx = b_addrsx(1, l, tMe)
944 index = boundx%
recv(ind_x)%index(
n)
948 ebufferx(index,
k) = buffer(
pos)
956 ptr_sbufferx = b_addrsx(2, l, tMe)
958 index = boundx%
recv(ind_x)%index(
n)
962 sbufferx(index,
k) = buffer(
pos)
970 ptr_wbufferx = b_addrsx(3, l, tMe)
972 index = boundx%
recv(ind_x)%index(
n)
976 wbufferx(index,
k) = buffer(
pos)
984 ptr_nbufferx = b_addrsx(4, l, tMe)
986 index = boundx%
recv(ind_x)%index(
n)
990 nbufferx(index,
k) = buffer(
pos)
1000 if(ind_x .GT. 0) then
1001 rank_x = boundx%
recv(ind_x)%
pe - domain%
pe 1002 if(rank_x .LE.0) rank_x = rank_x + nlist
1007 cur_rank =
min(rank_x, rank_y)
1010 !--- domain always
is symmetry
1013 if( BTEST(domain%fold,NORTH) .AND. (.NOT.BTEST(flags,SCALAR_BIT)) )then
1015 if( domain%y(1)%data%
begin.LE.
j .AND.
j.LE.domain%y(1)%data%
end+shift )then !fold
is within domain
1016 !poles
set to 0: BGRID only
1017 if( gridtype.EQ.BGRID_NE )then
1021 do
i =
is ,
ie, midpoint
1022 if( domain%x(1)%compute%
begin ==
i )then
1024 ptr_wbufferx = b_addrsx(3, l, tMe)
1025 ptr_wbuffery = b_addrsy(3, l, tMe)
1037 call mpp_sync_self( )
1041 end subroutine MPP_DO_GET_BOUNDARY_3D_V_
integer mpp_domains_stack_hwm
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call a get means do a wait to ensure put on remote PE is complete error call increase mpp_nml request_multiply call MPP_TRANSMIT get_len end if return end subroutine MPP_TRANSMIT_ ! MPP_BROADCAST ! subroutine but that doesn t allow !broadcast to a subset of PEs This version will
type(ext_fieldtype), dimension(:), pointer, save, private field
*f90 *************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine MPP_UPDATE_NEST_FINE_2D_(field, nest_domain, wbuffer, ebuffer, sbuffer, nbuffer, &flags, complete, position, extra_halo, name, tile_count) MPP_TYPE_, intent(in) ::field(:,:) type(nest_domain_type), intent(inout) ::nest_domain MPP_TYPE_, intent(inout) ::wbuffer(:,:) MPP_TYPE_, intent(inout) ::ebuffer(:,:) MPP_TYPE_, intent(inout) ::sbuffer(:,:) MPP_TYPE_, intent(inout) ::nbuffer(:,:) integer, intent(in), optional ::flags logical, intent(in), optional ::complete integer, intent(in), optional ::position integer, intent(in), optional ::extra_halo character(len= *), intent(in), optional ::name integer, intent(in), optional ::tile_count MPP_TYPE_ ::field3D(size(field, 1), size(field, 2), 1) MPP_TYPE_ ::wbuffer3D(size(wbuffer, 1), size(wbuffer, 2), 1) MPP_TYPE_ ::ebuffer3D(size(ebuffer, 1), size(ebuffer, 2), 1) MPP_TYPE_ ::sbuffer3D(size(sbuffer, 1), size(sbuffer, 2), 1) MPP_TYPE_ ::nbuffer3D(size(nbuffer, 1), size(nbuffer, 2), 1) pointer(ptr, field3D) pointer(ptr_w, wbuffer3D) pointer(ptr_e, ebuffer3D) pointer(ptr_s, sbuffer3D) pointer(ptr_n, nbuffer3D) ptr=LOC(field) ptr_w=LOC(wbuffer) ptr_e=LOC(ebuffer) ptr_s=LOC(sbuffer) ptr_n=LOC(nbuffer) call mpp_update_nest_fine(field3D, nest_domain, wbuffer3D, ebuffer3D, sbuffer3D, nbuffer3D, &flags, complete, position, extra_halo, name, tile_count) returnend subroutine MPP_UPDATE_NEST_FINE_2D_subroutine MPP_UPDATE_NEST_FINE_3D_(field, nest_domain, wbuffer, sbuffer, ebuffer, nbuffer, &flags, complete, position, extra_halo, name, tile_count) MPP_TYPE_, intent(in) ::field(:,:,:) type(nest_domain_type), intent(inout) ::nest_domain MPP_TYPE_, intent(inout) ::wbuffer(:,:,:) MPP_TYPE_, intent(inout) ::ebuffer(:,:,:) MPP_TYPE_, intent(inout) ::sbuffer(:,:,:) MPP_TYPE_, intent(inout) ::nbuffer(:,:,:) integer, intent(in), optional ::flags logical, intent(in), optional ::complete integer, intent(in), optional ::position integer, intent(in), optional ::extra_halo character(len= *), intent(in), optional ::name integer, intent(in), optional ::tile_count MPP_TYPE_ ::d_type type(nestSpec), pointer ::update=> set_mismatch integer ::tile update_position nbuffersz l_size integer
l_size ! loop over number of fields ke do je do i
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine MPP_WRITE_UNLIMITED_AXIS_1D_(unit, field, domain, data, nelems_io) integer, intent(in) ::unit type(fieldtype), intent(inout) ::field type(domain2D), intent(inout) ::domain MPP_TYPE_, intent(inout) ::data(:) integer, intent(in) ::nelems_io(:) ! number of compressed elements from each ! member of the io_domain. It MUST have the ! same order as the io_domain pelist. integer, allocatable ::pelist(:) integer ::i, j, nelems, npes type(domain2d), pointer ::io_domain=> allocatable
subroutine, public copy(self, rhs)
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call a get means do a wait to ensure put on remote PE is complete error call increase mpp_nml request_multiply call MPP_TRANSMIT end
integer(long), parameter true
integer(long), parameter false
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call a get means do a wait to ensure put on remote PE is complete error call increase mpp_nml request_multiply call MPP_TRANSMIT get_len end if return end subroutine MPP_TRANSMIT_ ! MPP_BROADCAST ! subroutine but that doesn t allow !broadcast to a subset of PEs This version and mpp_transmit will remain !backward compatible MPP_TYPE_
l_size ! loop over number of fields ke do j
integer, parameter, public west
l_size ! loop over number of fields ke do je do ie to je n if(.NOT. d_comm%R_do_buf(list)) cycle from_pe
l_size ! loop over number of fields ke do je do ie to to_pe
character(len=128) version
l_size ! loop over number of fields ke do je do ie to is
integer, parameter, public global
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call mpp_error(FATAL, 'MPP_TRANSMIT:you cannot transmit to ANY_PE using MPI.') else if(to_pe.NE.NULL_PE) then !no other valid cases except NULL_PE call mpp_error(FATAL
l_size ! loop over number of fields ke do je do ie to je msgsize
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine READ_RECORD_CORE_(unit, field, nwords, data, start, axsiz) integer, intent(in) ::unit type(fieldtype), intent(in) ::field integer, intent(in) ::nwords MPP_TYPE_, intent(inout) ::data(nwords) integer, intent(in) ::start(:), axsiz(:) integer(SHORT_KIND) ::i2vals(nwords)!rab used in conjunction with transfer intrinsic to determine size of a variable integer(KIND=1) ::one_byte(8) integer ::word_sz!#ifdef __sgi integer(INT_KIND) ::ivals(nwords) real(FLOAT_KIND) ::rvals(nwords)!#else! integer ::ivals(nwords)! real ::rvals(nwords)!#endif real(DOUBLE_KIND) ::r8vals(nwords) pointer(ptr1, i2vals) pointer(ptr2, ivals) pointer(ptr3, rvals) pointer(ptr4, r8vals) if(mpp_io_stack_size< nwords) call mpp_io_set_stack_size(nwords) call mpp_error(FATAL, 'MPP_READ currently requires use_netCDF option') end subroutine READ_RECORD_CORE_ subroutine READ_RECORD_(unit, field, nwords, data, time_level, domain, position, tile_count, start_in, axsiz_in)!routine that is finally called by all mpp_read routines to perform the read!a non-netCDF record contains:! field ID! a set of 4 coordinates(is:ie, js:je) giving the data subdomain! a timelevel and a timestamp(=NULLTIME if field is static)! 3D real data(stored as 1D)!if you are using direct access I/O, the RECL argument to OPEN must be large enough for the above!in a global direct access file, record position on PE is given by %record.!Treatment of timestamp:! We assume that static fields have been passed without a timestamp.! Here that is converted into a timestamp of NULLTIME.! For non-netCDF fields, field is treated no differently, but is written! with a timestamp of NULLTIME. There is no check in the code to prevent! the user from repeatedly writing a static field. integer, intent(in) ::unit, nwords type(fieldtype), intent(in) ::field MPP_TYPE_, intent(inout) ::data(nwords) integer, intent(in), optional ::time_level type(domain2D), intent(in), optional ::domain integer, intent(in), optional ::position, tile_count integer, intent(in), optional ::start_in(:), axsiz_in(:) integer, dimension(size(field%axes(:))) ::start, axsiz integer ::tlevel !, subdomain(4) integer ::i, error, is, ie, js, je, isg, ieg, jsg, jeg type(domain2d), pointer ::io_domain=> tlevel if(PRESENT(start_in) .AND. PRESENT(axsiz_in)) then if(size(start(! the data domain and compute domain must refer to the subdomain being passed ! In this case
integer, parameter, public east
integer mpp_domains_stack_size
real(fvprc) function, dimension(size(a, 1), size(a, 2)) reverse(A)
logical function received(this, seqno)
logical debug_message_passing
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine READ_RECORD_CORE_(unit, field, nwords, data, start, axsiz) integer, intent(in) ::unit type(fieldtype), intent(in) ::field integer, intent(in) ::nwords MPP_TYPE_, intent(inout) ::data(nwords) integer, intent(in) ::start(:), axsiz(:) integer(SHORT_KIND) ::i2vals(nwords)!rab used in conjunction with transfer intrinsic to determine size of a variable integer(KIND=1) ::one_byte(8) integer ::word_sz!#ifdef __sgi integer(INT_KIND) ::ivals(nwords) real(FLOAT_KIND) ::rvals(nwords)!#else! integer ::ivals(nwords)! real ::rvals(nwords)!#endif real(DOUBLE_KIND) ::r8vals(nwords) pointer(ptr1, i2vals) pointer(ptr2, ivals) pointer(ptr3, rvals) pointer(ptr4, r8vals) if(mpp_io_stack_size< nwords) call mpp_io_set_stack_size(nwords) call mpp_error(FATAL, 'MPP_READ currently requires use_netCDF option') end subroutine READ_RECORD_CORE_ subroutine READ_RECORD_(unit, field, nwords, data, time_level, domain, position, tile_count, start_in, axsiz_in)!routine that is finally called by all mpp_read routines to perform the read!a non-netCDF record contains:! field ID! a set of 4 coordinates(is:ie, js:je) giving the data subdomain! a timelevel and a timestamp(=NULLTIME if field is static)! 3D real data(stored as 1D)!if you are using direct access I/O, the RECL argument to OPEN must be large enough for the above!in a global direct access file, record position on PE is given by %record.!Treatment of timestamp:! We assume that static fields have been passed without a timestamp.! Here that is converted into a timestamp of NULLTIME.! For non-netCDF fields, field is treated no differently, but is written! with a timestamp of NULLTIME. There is no check in the code to prevent! the user from repeatedly writing a static field. integer, intent(in) ::unit, nwords type(fieldtype), intent(in) ::field MPP_TYPE_, intent(inout) ::data(nwords) integer, intent(in), optional ::time_level type(domain2D), intent(in), optional ::domain integer, intent(in), optional ::position, tile_count integer, intent(in), optional ::start_in(:), axsiz_in(:) integer, dimension(size(field%axes(:))) ::start, axsiz integer ::tlevel !, subdomain(4) integer ::i, error, is, ie, js, je, isg, ieg, jsg, jeg type(domain2d), pointer ::io_domain=> tlevel if(PRESENT(start_in) .AND. PRESENT(axsiz_in)) then if(size(start(! the data domain and compute domain must refer to the subdomain being passed ! In this ! since that attempts to gather all data on PE size(field%axes(:)) axsiz(i)
integer, parameter, public north
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call a get means do a wait to ensure put on remote PE is complete error call increase mpp_nml request_multiply call MPP_TRANSMIT get_len end if return end subroutine MPP_TRANSMIT_ ! MPP_BROADCAST ! subroutine but that doesn t allow !broadcast to a subset of PEs This version and mpp_transmit will remain !backward compatible intent(inout) a
real(kind_real), parameter bound
l_size ! loop over number of fields ke do je do ie pos
integer, parameter, public order
*f90 *************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If not
integer, parameter, public south
l_size ! loop over number of fields ke do je do ie to js
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call a get means do a wait to ensure put on remote PE is complete error call increase mpp_nml request_multiply call MPP_TRANSMIT get_len end if return end subroutine MPP_TRANSMIT_ ! MPP_BROADCAST ! subroutine but that doesn t allow !broadcast to a subset of PEs This version and mpp_transmit will remain !backward compatible intent(inout) MPP_BROADCAST begin