Back to OASIS4 home


MPI exchanges between applications (components) of the Psmile for the search

psmile_enddef_appl
psmile_enddef_appl
broadcast master_rank to all processes
call MPI_Allreduce (i, master_rank, 1, MPI_INTEGER, MPI_SUM, comm_psmile, ierror)
broadcast master_rank to all processes
call MPI_Allreduce (i, master_rank, 1, MPI_INTEGER, MPI_SUM, comm_psmile, ierror)
collect the number of components in the master process of comm_appl_roots
call MPI_Gather (n_active, 1, MPI_INTEGER, Number_of_comps_per_appl, 1, &
MPI_INTEGER, PRISM_root, comm_appl_roots, ierror)
collect the number of components in the master process of comm_appl_roots
call MPI_Gather (n_active, 1, MPI_INTEGER, Number_of_comps_per_appl, 1, &
MPI_INTEGER, PRISM_root, comm_appl_roots, ierror)
collect the psmile ranks of root processes of comm_appl_roots
call MPI_Gather (psmile_rank, 1, MPI_INTEGER, root_ranks,  1, MPI_INTEGER, &
                          PRISM_root, comm_appl_roots, ierror)
collect the psmile ranks of root processes of comm_appl_roots
call MPI_Gather (psmile_rank, 1, MPI_INTEGER, root_ranks,  1, MPI_INTEGER, &
                          PRISM_root, comm_appl_roots, ierror)
get infos on the collection of components by the master of of comm_appl_roots
call MPI_Gatherv (b_comps,  n_active, datatype_enddef_comp, &
                       all_comp_infos, Number_of_comps_per_appl, disp, datatype_enddef_comp,       &
                           PRISM_root, comm_appl_roots, ierror)
get infos on the collection of components by the master of of comm_appl_roots
call MPI_Gatherv (b_comps,  n_active, datatype_enddef_comp, &
                       all_comp_infos, Number_of_comps_per_appl, disp, datatype_enddef_comp,       &
                           PRISM_root, comm_appl_roots, ierror)
distribute the data collected to all processes in communicator comm_psmile
call MPI_Bcast (Number_of_coll_comps, 1, MPI_INTEGER, master_rank, comm_psmile, ierror)
call MPI_Bcast (Number_of_comps_per_appl, NoApplication, MPI_INTEGER, &
                      master_rank, comm_psmile, ierror)
call MPI_Bcast (root_ranks, NoApplication, MPI_INTEGER, master_rank, comm_psmile, ierror)
call MPI_Bcast (all_comp_infos, Number_of_coll_comps, datatype_enddef_comp, &
       master_rank, comm_psmile, ierror)
call MPI_Bcast (all_comp_infos(icomp)%Number_of_Grids_Vector, size, MPI_INTEGER, &
                            root_ranks(iappl), comm_psmile, ierror)
call MPI_Bcast (all_comp_infos(icomp)%psmile_ranks, size, MPI_INTEGER, &
                            root_ranks(iappl), comm_psmile, ierror)
call MPI_Bcast (all_comp_infos(icomp)%all_extent_infos, n*nd_extent_infos, MPI_INTEGER, &
                            root_ranks(iappl), comm_psmile, ierror)
call MPI_Bcast (all_comp_infos(icomp)%all_extents, n*2*ndim_3d, PSMILe_float_datatype, &
                            root_ranks(iappl), comm_psmile, ierror)
distribute the data collected to all processes in communicator comm_psmile
call MPI_Bcast (Number_of_coll_comps, 1, MPI_INTEGER, master_rank, comm_psmile, ierror)
call MPI_Bcast (Number_of_comps_per_appl, NoApplication, MPI_INTEGER, &
                      master_rank, comm_psmile, ierror)
call MPI_Bcast (root_ranks, NoApplication, MPI_INTEGER, master_rank, comm_psmile, ierror)
call MPI_Bcast (all_comp_infos, Number_of_coll_comps, datatype_enddef_comp, &
       master_rank, comm_psmile, ierror)
call MPI_Bcast (all_comp_infos(icomp)%Number_of_Grids_Vector, size, MPI_INTEGER, &
                            root_ranks(iappl), comm_psmile, ierror)
call MPI_Bcast (all_comp_infos(icomp)%psmile_ranks, size, MPI_INTEGER, &
                            root_ranks(iappl), comm_psmile, ierror)
call MPI_Bcast (all_comp_infos(icomp)%all_extent_infos, n*nd_extent_infos, MPI_INTEGER, &
                            root_ranks(iappl), comm_psmile, ierror)
call MPI_Bcast (all_comp_infos(icomp)%all_extents, n*2*ndim_3d, PSMILe_float_datatype, &
                            root_ranks(iappl), comm_psmile, ierror)

psmile_find_intersect (see below)
psmile_get_intersect (see below)
psmile_find_intersect psmile_search_donor_cells
sends futher fields list to dest if n_vars > 1
call psmile_bsend (field_list(1,2), (n_vars-1)*nd_field_list, &
             MPI_INTEGER, dest, vartag, comm_psmile, ierror)
receive info on additional fields if necessary
call MPI_Recv (field_list, nd_field_list*n_vars, MPI_INTEGER,  &
                        search%sender, vartag, comm_psmile, status, ierror)
psmile_put_field_dble
psmile_get_field_dble
sends msg for data directly sent to othe application without T
recv msg for data directly between applications without T
tag = tag0 + send_info%method_id * 1000
call psmile_bsend (msgdata, nd_msgdata, MPI_INTEGER, &
send_info%dest, tag, comm_psmile, ierror)
tag = tag0 + method_id*1000
call MPI_Recv (msgdata, nd_msgdata, MPI_INTEGER, &
                        mp%recv_infos_direct(index)%source, tag, comm_psmile, status, ierror)
 


Example GRIDLESS

source
target
psmile_find_intersect psmile_find_intersect
sends msgint to the process (dest) with which has an intersection
call psmile_bsend (msgint, ip, MPI_INTEGER, dest, lastag, comm_psmile, ierror)
lastag = 100
sends msgint to the process (dest) with which has an intersection
call psmile_bsend (msgint, ip, MPI_INTEGER, dest, lastag, comm_psmile, ierror)
lastag = 100


psmile_get_intersect psmile_get_intersect

set up request for a grid transfer (answer to tag "lastag")    
if (paction%n_answer < paction%n_answer2recv) then
         call MPI_Irecv (paction%msgreq, nd_msgint, MPI_INTEGER,      &
                         MPI_ANY_SOURCE, reqtag, comm_psmile, paction%lrequest(1), ierror)
' Posting Irecv request(1) ', paction%lrequest(1), 'with tag ', reqtag (=101)
set up request for receive of an extra search request
     
if (paction%n_fin2recv > 0) then
         call MPI_Irecv (paction%msg_extra, msg_extra_size, MPI_INTEGER, &
                         MPI_ANY_SOURCE, exttag, comm_psmile,  paction%lrequest(4), ierror)
' Posting Irecv request(4) ', paction%lrequest(4), 'with tag ', exttag (=104)
set up request for receive of an extra search request
     
if (paction%n_fin2recv > 0) then
         call MPI_Irecv (paction%msg_extra, msg_extra_size, MPI_INTEGER, &
                         MPI_ANY_SOURCE, exttag, comm_psmile,  paction%lrequest(4), ierror)
' Posting Irecv request(4) ', paction%lrequest(4), 'with tag ', exttag (=104)
psmile_get_intersect
set up request for receive of an intersection   
 do while ( paction%n   < paction%ninter    .or.    paction%n_answer   < paction%n_answer2recv .or. &
                 paction%nloc_recv  < paction%n_answer2recv .or.   paction%n_selected > 0   .or.     paction%grid2receive )
            call MPI_Irecv (paction%msgint, nd_msgint, MPI_INTEGER,      &
              maxval(paction%intersect_ranks), paction%lastag, comm_psmile, paction%lrequest(2),  ierror)
' Posting Irecv request(2) ', paction%lrequest(2), 'with tag ', paction%lastag (=100)

     list of requests             1            0
     list of requests             2          168
     list of requests             3            0
     list of requests             4          167
     list of requests             5            0
     list of requests             1          167
     list of requests             2          169
     list of requests             3            0
     list of requests             4          168
     list of requests             5            0
     list of requests             6            0
psmile_enddef_action : index = 2 ; Message from a partner with an intersection was found
(see psmile_find_intersect of target)

send message back as acknowledge to sending process
           
call psmile_bsend (paction%msgint, nd_msgint, MPI_INTEGER, sender, reqtag, comm_psmile, ierror)
set up receive the subgrid sent by process sender
call psmile_recv_req_subgrid (msg_intersections, sender, grdtag, search, paction%recv_req, new_search, ierror)

psmile_recv_req_subgrid
call psmile_recv_req_mask for gridless
call psmile_recv_req_corners_dble for conservative (+ mask)
call psmile_recv_req_coords_dble for point method (+ mask)

psmile_recv_req_mask
         call MPI_Irecv (search%search_mask(ipart)%vector, len_mask, &
                         MPI_LOGICAL, sender, tag, comm_psmile, recv_req (ndim_3d+1, ipart), ierror)
or if no mask to receive
         call MPI_Irecv (dummy_mask, 0, MPI_LOGICAL, &
                         sender, tag, comm_psmile, recv_req (ndim_3d+1, 1), ierror)
index=ndim_3d+1=3
tag=102

psmile_recv_req_corners_dble for conservative
psmile_recv_req_coords_dble for point method
psmile_get_intersect
     list of requests             1            0
     list of requests             2            0
     list of requests             3          168
     list of requests             4          167
     list of requests             5            0


psmile_search_donor_gridless
psmile_enddef_action : index = 1 ; Request for sending grid data found. Send subgrid to
partner which performs search of donor cells

call psmile_send_req_subgrid (msg_intersections, sender, grdtag, ierror)
grdtag=102

psmile_send_req_subgrid

call psmile_send_req_mask for gridless
call psmile_send_req_corners_dble for conservative (+ mask)
call psmile_send_req_coords_dble for point method (+ mask)

psmile_enddef_action : index = 1

set up request for receive of locations (that will be found by the search : dstijk)
         call MPI_Irecv (paction%loc_messages(1,ind), msgloc_size, MPI_INTEGER, &
               sender, loctag+ind, comm_psmile, paction%lrequest (num_req_types-1+ind), ierror)
num_req_types-1+ind=6
loctag=110

psmile_get_intersect

     list of requests             1            0
     list of requests             2          169
     list of requests             3            0
     list of requests             4          168
     list of requests             5            0
     list of requests             6          167

psmile_enddef_action : index = 2 ; Message from a partner with an intersection was found
(see psmile_find_intersect of target)

nothing to do (no search) because not a source

psmile_get_intersect

     list of requests             1            0
     list of requests             2            0
     list of requests             3            0
     list of requests             4          168
     list of requests             5            0
     list of requests             6          167

psmile_enddef_action : index = 6

call psmile_enddef_action_loc