FE-Project
Loading...
Searching...
No Matches
scale_meshfieldcomm_base Module Reference

module FElib / Data / Communication base More...

Data Types

type  localmeshcommdata
 Derived type to manage data communication at a face between adjacent local meshes. More...
type  meshfieldcommbase
 Base derived type to manage data communication. More...
interface  meshfieldcommbase_put
type  meshfieldcontainer
 Container to save a pointer of MeshField(1D, 2D, 3D) object. More...

Functions/Subroutines

subroutine, public meshfieldcommbase_init (this, sfield_num, hvfield_num, htensorfield_num, bufsize_per_field, comm_face_num, nnode_lcmeshface, mesh)
 Initialize a base object to manage data communication of fields.
subroutine, public meshfieldcommbase_final (this)
 Finalize a base object to manage data communication of fields.
subroutine, public meshfieldcommbase_exchange_core (this, commdata_list, do_wait)
 Exchange halo data.
subroutine, public meshfieldcommbase_wait_core (this, commdata_list, field_list, dim, varid_s, lcmesh_list)
 Wait data communication and move tmp data of LocalMeshCommData object to a recv buffer.
subroutine, public meshfieldcommbase_extract_bounddata (var, refelem, mesh, buf)
 Extract halo data from data array with MeshField object and set it to the receiving buffer.
subroutine, public meshfieldcommbase_extract_bounddata2 (var, vmapb, vmapb_size, npxnea, buf)
 Extract halo data from data array with MeshField object and set it to the receiving buffer.
subroutine, public meshfieldcommbase_extract_bounddata_2 (field_list, dim, varid_s, lcmesh_list, vmapb_size, buf)
 Extract halo data from data array with MeshField object and set it to the receiving buffer.
subroutine, public meshfieldcommbase_extract_bounddata_3 (field_list, dim, varid_s, lcmesh_list, vmapb2, vmapb2_size, buf)
 Extract halo data from data array with MeshField object and set it to the recieving buffer.
subroutine, public meshfieldcommbase_set_bounddata (buf, refelem, mesh, var)
 Extract halo data from the receiving buffer and set it to data array with MeshField object.
subroutine, public meshfieldcommbase_set_bounddata_3 (buf, refelem, mesh, vmapb, vmapb_size, var)
 Extract halo data from the recieving buffer and set it to data array with MeshField object.

Detailed Description

module FElib / Data / Communication base

Description
Base module to manage data communication for element-based methods
Author
Yuta Kawai, Team SCALE

Function/Subroutine Documentation

◆ meshfieldcommbase_init()

subroutine, public scale_meshfieldcomm_base::meshfieldcommbase_init ( class(meshfieldcommbase), intent(inout) this,
integer, intent(in) sfield_num,
integer, intent(in) hvfield_num,
integer, intent(in) htensorfield_num,
integer, intent(in) bufsize_per_field,
integer, intent(in) comm_face_num,
integer, dimension(comm_face_num,mesh%local_mesh_num), intent(in) nnode_lcmeshface,
class(meshbase), intent(in), target mesh )

Initialize a base object to manage data communication of fields.

Parameters
sfield_numNumber of scalar fields
hvfield_numNumber of horizontal vector fields
htensorfield_numNumber of horizontal tensor fields
bufsize_per_fieldBuffer size per a field
comm_face_numNumber of faces on a local mesh which perform data communication
Nnode_LCMeshFaceArray to store the number of nodes

Definition at line 172 of file scale_meshfieldcomm_base.F90.

175
176 implicit none
177
178 class(MeshFieldCommBase), intent(inout) :: this
179 class(Meshbase), intent(in), target :: mesh
180 integer, intent(in) :: sfield_num
181 integer, intent(in) :: hvfield_num
182 integer, intent(in) :: htensorfield_num
183 integer, intent(in) :: bufsize_per_field
184 integer, intent(in) :: comm_face_num
185 integer, intent(in) :: Nnode_LCMeshFace(comm_face_num,mesh%LOCAL_MESH_NUM)
186
187 integer :: n, f
188 class(LocalMeshBase), pointer :: lcmesh
189 !-----------------------------------------------------------------------------
190
191 !$acc enter data create(this)
192 this%mesh => mesh
193 this%sfield_num = sfield_num
194 this%hvfield_num = hvfield_num
195 this%htensorfield_num = htensorfield_num
196 this%field_num_tot = sfield_num + hvfield_num*2 + htensorfield_num*4
197 this%nfaces_comm = comm_face_num
198 !$acc update device(this%sfield_num, this%hvfield_num, this%htensorfield_num, this%field_num_tot, this%nfaces_comm)
199 !$acc enter data attach(this%mesh)
200
201 if (this%field_num_tot > 0) then
202 allocate( this%send_buf(bufsize_per_field, this%field_num_tot, mesh%LOCAL_MESH_NUM) )
203 allocate( this%recv_buf(bufsize_per_field, this%field_num_tot, mesh%LOCAL_MESH_NUM) )
204 allocate( this%request_send(comm_face_num*mesh%LOCAL_MESH_NUM) )
205 allocate( this%request_recv(comm_face_num*mesh%LOCAL_MESH_NUM) )
206 !$acc enter data create(this%send_buf, this%recv_buf, this%request_send, this%request_recv)
207
208 allocate( this%commdata_list(comm_face_num,mesh%LOCAL_MESH_NUM) )
209 allocate( this%is_f(comm_face_num,mesh%LOCAL_MESH_NUM) )
210 allocate( this%Nnode_LCMeshAllFace(mesh%LOCAL_MESH_NUM) )
211 !$acc enter data create(this%is_f, this%Nnode_LCMeshAllFace)
212
213 do n=1, mesh%LOCAL_MESH_NUM
214 this%is_f(1,n) = 1
215 do f=2, this%nfaces_comm
216 this%is_f(f,n) = this%is_f(f-1,n) + nnode_lcmeshface(f-1,n)
217 end do
218 this%Nnode_LCMeshAllFace(n) = sum(nnode_lcmeshface(:,n))
219
220 call mesh%GetLocalMesh(n, lcmesh)
221 do f=1, this%nfaces_comm
222 call this%commdata_list(f,n)%Init( this, lcmesh, f, nnode_lcmeshface(f,n) )
223 end do
224 end do
225 !$acc update device(this%is_f, this%Nnode_LCMeshAllFace)
226 !$acc enter data copyin(this%commdata_list)
227#ifdef _OPENACC
228 do n=1, mesh%LOCAL_MESH_NUM
229 do f=1, this%nfaces_comm
230 call localmeshcommdata_setupforgpu( this%commdata_list(f,n) )
231 end do
232 end do
233#endif
234 end if
235
236 this%MPI_pc_flag = .false.
237
238 obj_ind = obj_ind + 1
239 if ( obj_ind > obj_index_max ) then
240 log_error("MeshFieldCommBase_Init",*) 'obj_ind > OBJ_INDEX_MAX. Check!'
241 call prc_abort
242 end if
243 this%obj_ind = obj_ind
244
245 return

Referenced by scale_meshfieldcomm_base::meshfieldcommbase::prepare_pc().

◆ meshfieldcommbase_final()

subroutine, public scale_meshfieldcomm_base::meshfieldcommbase_final ( class(meshfieldcommbase), intent(inout) this)

Finalize a base object to manage data communication of fields.

Definition at line 251 of file scale_meshfieldcomm_base.F90.

252 implicit none
253
254 class(MeshFieldCommBase), intent(inout) :: this
255
256 integer :: n, f
257 integer :: ireq
258 integer :: ierr
259 !-----------------------------------------------------------------------------
260
261 if (this%field_num_tot > 0) then
262 !$acc exit data delete(this%send_buf, this%recv_buf)
263 deallocate( this%send_buf, this%recv_buf )
264 !$acc exit data delete(this%request_send, this%request_recv)
265 deallocate( this%request_send, this%request_recv )
266
267 do n=1, this%mesh%LOCAL_MESH_NUM
268 do f=1, this%nfaces_comm
269 call this%commdata_list(f,n)%Final()
270 end do
271 end do
272 !$acc exit data delete(this%commdata_list, this%is_f, this%Nnode_LCMeshAllFace)
273 deallocate( this%commdata_list, this%is_f, this%Nnode_LCMeshAllFace )
274
275 if ( this%MPI_pc_flag ) then
276 do ireq=1, this%req_counter
277 call mpi_request_free( this%request_pc(ireq), ierr )
278 end do
279 deallocate( this%request_pc )
280 end if
281 end if
282
283 if ( allocated(this%VMapB_size) ) then
284 !$acc exit data delete(this%VMapB_size)
285 deallocate(this%VMapB_size)
286 end if
287 if ( this%use_vmap_wide_flag ) then
288 !$acc exit data delete(this%VMapB2)
289 deallocate( this%VMapB2 )
290 end if
291
292 return

Referenced by scale_meshfieldcomm_base::meshfieldcommbase::prepare_pc().

◆ meshfieldcommbase_exchange_core()

subroutine, public scale_meshfieldcomm_base::meshfieldcommbase_exchange_core ( class(meshfieldcommbase), intent(inout) this,
type(localmeshcommdata), dimension(this%nfaces_comm, this%mesh%local_mesh_num), intent(inout), target commdata_list,
logical, intent(in), optional do_wait )

Exchange halo data.

Parameters
commdata_listArray of LocalMeshCommData objects which manage information and halo data
do_waitFlag whether MPI_waitall is called and move tmp data of LocalMeshCommData object to a recv buffer

Definition at line 354 of file scale_meshfieldcomm_base.F90.

355#ifdef __FUJITSU
356 use mpi_ext, only: &
357 fjmpi_prequest_startall
358#endif
359! use mpi, only: &
360! MPI_startall
361 use scale_prof
362 implicit none
363
364 class(MeshFieldCommBase), intent(inout) :: this
365 type(LocalMeshCommData), intent(inout), target :: commdata_list(this%nfaces_comm, this%mesh%LOCAL_MESH_NUM)
366 logical, intent(in), optional :: do_wait
367
368 integer :: n, f
369 integer :: ierr
370 logical :: do_wait_
371
372 integer :: i
373 type(LocalMeshCommData), pointer :: lcommdata
374 !-----------------------------------------------------------------------------
375
376 if ( present(do_wait) ) then
377 do_wait_ = do_wait
378 else
379 do_wait_ = .true.
380 end if
381
382! call PROF_rapstart( 'meshfiled_comm_ex_core', 3)
383 !
384 if ( this%MPI_pc_flag ) then
385#ifdef _OPENACC
386 do n=1, this%mesh%LOCAL_MESH_NUM
387 do f=1, this%nfaces_comm
388 lcommdata => commdata_list(f,n)
389 if ( lcommdata%s_rank /= lcommdata%lcmesh%PRC_myrank ) then
390 !$acc update host(lcommdata%send_buf) async(1)
391 end if
392 end do
393 end do
394 !$acc wait(1)
395
396#endif
397 !$omp parallel
398 !$omp master
399 if ( this%use_mpi_pc_fujitsu_ext ) then
400#ifdef __FUJITSU
401 ! Use Fujitsu MPI extension for persistent communication
402 call fjmpi_prequest_startall( this%req_counter, this%request_pc(1:this%req_counter), ierr )
403#endif
404 else
405 call mpi_startall( this%req_counter, this%request_pc(1:this%req_counter), ierr )
406 end if
407 !$omp end master
408
409 !$omp do collapse(2) private(lcommdata)
410 do n=1, this%mesh%LOCAL_MESH_NUM
411 do f=1, this%nfaces_comm
412 lcommdata => commdata_list(f,n)
413 if ( lcommdata%s_rank == lcommdata%lcmesh%PRC_myrank ) then
414#ifdef _OPENACC
415 call set_recvbuf_from_sendbuf_lc( commdata_list(abs(lcommdata%s_faceID), lcommdata%s_tilelocalID)%recv_buf, &
416 lcommdata%send_buf, size(lcommdata%send_buf) )
417#else
418 commdata_list(abs(lcommdata%s_faceID), lcommdata%s_tilelocalID)%recv_buf(:,:) &
419 = lcommdata%send_buf(:,:)
420#endif
421 end if
422 end do
423 end do
424 !$acc wait(1)
425 !$omp end parallel
426 else
427 this%req_counter = 0
428 do n=1, this%mesh%LOCAL_MESH_NUM
429 do f=1, this%nfaces_comm
430 call commdata_list(f,n)%SendRecv( &
431 this%req_counter, this%request_send, this%request_recv, & ! (inout)
432 commdata_list ) ! (inout)
433 end do
434 end do
435 !$acc wait(1)
436 end if
437
438! call PROF_rapend( 'meshfiled_comm_ex_core', 3)
439
440 if ( do_wait_ ) then
441 call meshfieldcommbase_wait_core( this, commdata_list )
442 this%call_wait_flag_sub_get = .false.
443 else
444 this%call_wait_flag_sub_get = .true.
445 end if
446
447 return

References meshfieldcommbase_wait_core().

Referenced by scale_meshfieldcomm_base::meshfieldcommbase::prepare_pc().

◆ meshfieldcommbase_wait_core()

subroutine, public scale_meshfieldcomm_base::meshfieldcommbase_wait_core ( class(meshfieldcommbase), intent(inout) this,
type(localmeshcommdata), dimension(this%nfaces_comm, this%mesh%local_mesh_num), intent(inout), target commdata_list,
type(meshfieldcontainer), dimension(:), intent(inout), optional field_list,
integer, intent(in), optional dim,
integer, intent(in), optional varid_s,
class(localmeshbase), dimension(:), intent(in), optional, target lcmesh_list )

Wait data communication and move tmp data of LocalMeshCommData object to a recv buffer.

Parameters
commdata_listArray of LocalMeshCommData objects which manage information and halo data

Definition at line 454 of file scale_meshfieldcomm_base.F90.

456 use mpi, only: &
457! MPI_waitall, &
458 mpi_status_size
459 use scale_prof
460 implicit none
461
462 class(MeshFieldCommBase), intent(inout) :: this
463 type(LocalMeshCommData), intent(inout), target :: commdata_list(this%nfaces_comm, this%mesh%LOCAL_MESH_NUM)
464 type(MeshFieldContainer), intent(inout), optional :: field_list(:)
465 integer, intent(in), optional :: dim
466 integer, intent(in), optional :: varid_s
467 class(LocalMeshBase), intent(in), optional, target :: lcmesh_list(:)
468
469 integer :: ierr
470 integer :: stat_send(MPI_STATUS_SIZE, this%req_counter)
471 integer :: stat_recv(MPI_STATUS_SIZE, this%req_counter)
472 integer :: stat_pc(MPI_STATUS_SIZE, this%req_counter)
473
474 integer :: n, f
475 integer :: i, var_id
476 integer :: irs(this%nfaces_comm,this%mesh%LOCAL_MESH_NUM), ire(this%nfaces_comm,this%mesh%LOCAL_MESH_NUM)
477
478 class(LocalMeshBase), pointer :: lcmesh
479 integer :: val_size(this%mesh%LOCAL_MESH_NUM)
480 !----------------------------
481
482! call PROF_rapstart( 'meshfiled_comm_wait_core', 2)
483 if ( this%MPI_pc_flag ) then
484 if (this%req_counter > 0) then
485 call mpi_waitall( this%req_counter, this%request_pc(1:this%req_counter), stat_pc, ierr )
486 end if
487 else
488 if ( this%req_counter > 0 ) then
489 call mpi_waitall( this%req_counter, this%request_recv(1:this%req_counter), stat_recv, ierr )
490 call mpi_waitall( this%req_counter, this%request_send(1:this%req_counter), stat_send, ierr )
491 end if
492 end if
493
494#ifdef _OPENACC
495 do n=1, this%mesh%LOCAL_MESH_NUM
496 do f=1, this%nfaces_comm
497 if ( commdata_list(f,n)%s_rank /= commdata_list(f,n)%lcmesh%PRC_myrank ) then
498 !$acc update device( commdata_list(f,n)%recv_buf ) async(1)
499 end if
500 end do
501 end do
502#endif
503
504! call PROF_rapend( 'meshfiled_comm_wait_core', 2)
505
506 !---------------------
507
508! call PROF_rapstart( 'meshfiled_comm_wait_post', 2)
509
510 if ( present(field_list) ) then
511 do n=1, this%mesh%LOCAL_MESH_NUM
512 lcmesh => lcmesh_list(n)
513 val_size(n) = lcmesh%refElem%Np * lcmesh%NeA
514 irs(1,n) = lcmesh%refElem%Np * lcmesh%Ne + 1
515 do f=1, this%nfaces_comm
516 ire(f,n) = irs(f,n) + commdata_list(f,n)%Nnode_LCMeshFace - 1
517 if (f<this%nfaces_comm) irs(f+1,n) = ire(f,n) + 1
518 end do
519 end do
520
521 !$omp parallel do private(var_id,n,i,f) collapse(3)
522 !$acc parallel loop gang collapse(3) present(field_list, commdata_list) copyin(irs, ire, val_size) async(1)
523 do n=1, this%mesh%LOCAL_MESH_NUM
524 do i=1, size(field_list)
525 do f=1, this%nfaces_comm
526 var_id = varid_s + i - 1
527
528 if (dim==1) then
529 call set_bounddata( field_list(var_id)%field1d%local(n)%val, val_size(n), irs(f,n), ire(f,n), commdata_list(f,n)%recv_buf(:,var_id) )
530 else if (dim==2) then
531 call set_bounddata( field_list(var_id)%field2d%local(n)%val, val_size(n), irs(f,n), ire(f,n), commdata_list(f,n)%recv_buf(:,var_id) )
532 else if (dim==3) then
533 call set_bounddata( field_list(var_id)%field3d%local(n)%val, val_size(n), irs(f,n), ire(f,n), commdata_list(f,n)%recv_buf(:,var_id) )
534 end if
535 end do ! end loop for face
536 end do
537 end do
538#ifdef _OPENACC
539 do n=1, this%mesh%LOCAL_MESH_NUM
540 do i=1, size(field_list)
541 do f=1, this%nfaces_comm
542 var_id = varid_s + i - 1
543 if (dim==1) then
544 !$acc update device( field_list(var_id)%field1d%local(n)%val(irs(f,n):ire(f,n)) ) async(1)
545 else if (dim==2) then
546 !$acc update device( field_list(var_id)%field2d%local(n)%val(irs(f,n):ire(f,n)) ) async(1)
547 else if (dim==3) then
548 !$acc update device( field_list(var_id)%field3d%local(n)%val(irs(f,n):ire(f,n)) ) async(1)
549 end if
550 end do ! end loop for face
551 end do
552 end do
553#endif
554
555 else
556
557 do n=1, this%mesh%LOCAL_MESH_NUM
558 irs(1,n) = 1
559 do f=1, this%nfaces_comm
560 ire(f,n) = irs(f,n) + commdata_list(f,n)%Nnode_LCMeshFace - 1
561 if (f<this%nfaces_comm) irs(f+1,n) = ire(f,n) + 1
562 end do
563 end do
564
565 !$omp parallel do private(n,var_id,f) collapse(3)
566 !$acc parallel loop gang collapse(3) present(this%recv_buf, commdata_list) copyin(irs, ire) async(1)
567 do n=1, this%mesh%LOCAL_MESH_NUM
568 do var_id=1, this%field_num_tot
569 do f=1, this%nfaces_comm
570#ifdef _OPENACC
571 call set_bounddata( this%recv_buf(:,var_id,n), size(this%recv_buf(:,var_id,n)), irs(f,n), ire(f,n), commdata_list(f,n)%recv_buf(:,var_id) )
572#else
573 this%recv_buf(irs(f,n):ire(f,n),var_id,n) = commdata_list(f,n)%recv_buf(:,var_id)
574#endif
575 end do ! end loop for face
576 end do
577 end do
578 end if
579
580 !$acc wait(1)
581! call PROF_rapend( 'meshfiled_comm_wait_post', 2)
582 return
583 contains
584!OCL SERIAL
585 subroutine set_bounddata( var, IA, irs_, ire_, recv_buf )
586 implicit none
587 integer, intent(in) :: IA
588 real(RP), intent(inout) :: var(IA)
589 integer, intent(in) :: irs_, ire_
590 real(RP), intent(in) :: recv_buf(ire_-irs_+1)
591
592 integer :: ii
593 !-----------------------------
594 !$acc routine vector
595
596 !$acc loop vector
597 do ii=1, size(recv_buf)
598 var(irs_+ii-1) = recv_buf(ii)
599 end do
600 return
601 end subroutine set_bounddata
subroutine set_bounddata(var, ia, irs_, ire_, recv_buf)

References set_bounddata().

Referenced by meshfieldcommbase_exchange_core(), and scale_meshfieldcomm_base::meshfieldcommbase::prepare_pc().

◆ meshfieldcommbase_extract_bounddata()

subroutine, public scale_meshfieldcomm_base::meshfieldcommbase_extract_bounddata ( real(rp), dimension(refelem%np * mesh%nea), intent(in) var,
class(elementbase), intent(in) refelem,
class(localmeshbase), intent(in) mesh,
real(rp), dimension(size(mesh%vmapb)), intent(out) buf )

Extract halo data from data array with MeshField object and set it to the receiving buffer.

Definition at line 606 of file scale_meshfieldcomm_base.F90.

607 implicit none
608
609 class(ElementBase), intent(in) :: refElem
610 class(LocalMeshBase), intent(in) :: mesh
611 real(RP), intent(in) :: var(refElem%Np * mesh%NeA)
612 real(RP), intent(out) :: buf(size(mesh%VmapB))
613
614 integer :: i
615 !-----------------------------------------------------------------------------
616 !$omp parallel do
617 !$acc parallel loop present(var, mesh%VmapB, buf)
618!OCL PREFETCH
619 do i=1, size(buf)
620 buf(i) = var(mesh%VmapB(i))
621 end do
622 return

Referenced by scale_meshfieldcomm_base::meshfieldcommbase::prepare_pc().

◆ meshfieldcommbase_extract_bounddata2()

subroutine, public scale_meshfieldcomm_base::meshfieldcommbase_extract_bounddata2 ( real(rp), dimension(npxnea), intent(in) var,
integer, dimension(vmapb_size), intent(in) vmapb,
integer, intent(in) vmapb_size,
integer, intent(in) npxnea,
real(rp), dimension(vmapb_size), intent(out) buf )

Extract halo data from data array with MeshField object and set it to the receiving buffer.

Definition at line 627 of file scale_meshfieldcomm_base.F90.

628 implicit none
629 integer, intent(in) :: VMapB_size
630 integer, intent(in) :: NpxNeA
631 real(RP), intent(in) :: var(NpxNeA)
632 integer, intent(in) :: VMapB(VMapB_size)
633 real(RP), intent(out) :: buf(VMapB_size)
634
635 integer :: i
636 !-----------------------------------------------------------------------------
637 !$omp parallel do
638 !$acc parallel loop present(var, VmapB, buf) async(1)
639!OCL PREFETCH
640 do i=1, size(buf)
641 buf(i) = var(vmapb(i))
642 end do
643 return

Referenced by meshfieldcommbase_extract_bounddata_2(), meshfieldcommbase_extract_bounddata_3(), and scale_meshfieldcomm_base::meshfieldcommbase::prepare_pc().

◆ meshfieldcommbase_extract_bounddata_2()

subroutine, public scale_meshfieldcomm_base::meshfieldcommbase_extract_bounddata_2 ( type(meshfieldcontainer), dimension(:), intent(in), target field_list,
integer, intent(in) dim,
integer, intent(in) varid_s,
class(localmeshbase), dimension(:), intent(in), target lcmesh_list,
integer, intent(in) vmapb_size,
real(rp), dimension(vmapb_size,size(field_list),size(lcmesh_list)), intent(out) buf )

Extract halo data from data array with MeshField object and set it to the receiving buffer.

Note: We assume that the size of VmapB is the same for all local meshes. For the future, this subroutine should be modified to handle the case with different sizes of VmapB among local meshes.

Parameters
[in]varid_sStarting variable ID to extract halo data
[in]dimNumber of dimensions of the field (1, 2, or 3)
[in]lcmesh_listArray of local mesh objects to extract halo data
[in]vmapb_sizeSize of VmapB (we assume that the size of VmapB is the same for all local meshes)

Definition at line 652 of file scale_meshfieldcomm_base.F90.

653 implicit none
654 type(MeshFieldContainer), intent(in), target :: field_list(:)
655 integer, intent(in) :: varid_s !< Starting variable ID to extract halo data
656 integer, intent(in) :: dim !< Number of dimensions of the field (1, 2, or 3)
657 class(LocalMeshBase), intent(in), target :: lcmesh_list(:) !< Array of local mesh objects to extract halo data
658 integer, intent(in) :: vmapB_size !< Size of VmapB (we assume that the size of VmapB is the same for all local meshes)
659 real(RP), intent(out) :: buf(vmapB_size,size(field_list),size(lcmesh_list))
660
661 class(LocalMeshBase), pointer :: lcmesh
662 integer :: varid
663 integer :: i, n
664
665 integer :: field_num
666 !-----------------------------------------------------------------------------
667
668 field_num = size(field_list)
669
670 do n=1, size(lcmesh_list)
671 lcmesh => lcmesh_list(n)
672 i = 1
673 do while( i <= field_num )
674 varid = varid_s + i - 1
675 if ( i+1 <= field_num ) then
676 if (dim==1) then
677 call extract_bounddata_var2( buf(:,varid,n), buf(:,varid+1,n), field_list(varid)%field1d%local(n)%val, field_list(varid+1)%field1d%local(n)%val, lcmesh, lcmesh%refElem )
678 else if(dim==2) then
679 call extract_bounddata_var2( buf(:,varid,n), buf(:,varid+1,n), field_list(varid)%field2d%local(n)%val, field_list(varid+1)%field2d%local(n)%val, lcmesh, lcmesh%refElem )
680 else if(dim==3) then
681 call extract_bounddata_var2( buf(:,varid,n), buf(:,varid+1,n), field_list(varid)%field3d%local(n)%val, field_list(varid+1)%field3d%local(n)%val, lcmesh, lcmesh%refElem )
682 end if
683 i = i + 2
684 else
685 if (dim==1) then
686 call meshfieldcommbase_extract_bounddata2( field_list(varid)%field1d%local(n)%val, lcmesh%VMapB, size(lcmesh%VMapB), lcmesh%refElem%Np*lcmesh%NeA, buf(:,varid,n) )
687 else if(dim==2) then
688 call meshfieldcommbase_extract_bounddata2( field_list(varid)%field2d%local(n)%val, lcmesh%VMapB, size(lcmesh%VMapB), lcmesh%refElem%Np*lcmesh%NeA, buf(:,varid,n) )
689 else if(dim==3) then
690 call meshfieldcommbase_extract_bounddata2( field_list(varid)%field3d%local(n)%val, lcmesh%VMapB, size(lcmesh%VMapB), lcmesh%refElem%Np*lcmesh%NeA, buf(:,varid,n) )
691 end if
692 i = i + 1
693 end if
694 end do
695 !!$acc update host( buf(:,varid_s:field_num,n) )
696 end do
697 !$acc wait(1)
698
699 return
700 contains
701!OCL SERIAL
702 subroutine extract_bounddata_var2( buf1_, buf2_, var1, var2, lmesh, elem )
703 implicit none
704 class(LocalMeshBase), intent(in) :: lmesh
705 class(ElementBase), intent(in) :: elem
706 real(RP), intent(out) :: buf1_(size(lmesh%VMapB))
707 real(RP), intent(out) :: buf2_(size(lmesh%VMapB))
708 real(RP), intent(inout) :: var1(elem%Np*lmesh%NeA)
709 real(RP), intent(inout) :: var2(elem%Np*lmesh%NeA)
710
711 integer :: ii, b
712 !-----------------------------
713 !$omp parallel do
714 !$acc parallel loop present(buf1_, buf2_, var1, var2, lmesh%vmapB) async(1)
715!OCL PREFETCH
716 do ii=1, size(buf1_)
717 b = lmesh%vmapB(ii)
718 buf1_(ii) = var1(b)
719 buf2_(ii) = var2(b)
720 end do
721 return
722 end subroutine extract_bounddata_var2

References meshfieldcommbase_extract_bounddata2().

Referenced by scale_meshfieldcomm_base::meshfieldcommbase::prepare_pc().

◆ meshfieldcommbase_extract_bounddata_3()

subroutine, public scale_meshfieldcomm_base::meshfieldcommbase_extract_bounddata_3 ( class(meshfieldcontainer), dimension(:), intent(in), target field_list,
integer, intent(in) dim,
integer, intent(in) varid_s,
class(localmeshbase), dimension(:), intent(in), target lcmesh_list,
integer, dimension(vmapb2_size), intent(in) vmapb2,
integer, intent(in) vmapb2_size,
real(rp), dimension(vmapb2_size,size(field_list),size(lcmesh_list)), intent(out) buf )

Extract halo data from data array with MeshField object and set it to the recieving buffer.

Definition at line 727 of file scale_meshfieldcomm_base.F90.

728 implicit none
729 class(MeshFieldContainer), intent(in), target :: field_list(:)
730 integer, intent(in) :: varid_s
731 integer, intent(in) :: dim
732 class(LocalMeshBase), intent(in), target :: lcmesh_list(:)
733 integer, intent(in) :: VMapB2_size
734 integer, intent(in) :: VMapB2(VMapB2_size)
735 real(RP), intent(out) :: buf(VMapB2_size,size(field_list),size(lcmesh_list))
736
737 class(LocalMeshBase), pointer :: lcmesh
738 integer :: varid
739 integer :: i, n
740
741 integer :: field_num
742 !-----------------------------------------------------------------------------
743
744 field_num = size(field_list)
745
746 do n=1, size(lcmesh_list)
747 lcmesh => lcmesh_list(n)
748 i = 1
749 do while( i <= field_num )
750 varid = varid_s + i - 1
751 if ( i+1 <= field_num ) then
752 if (dim==1) then
753 call extract_bounddata_var2( buf(:,varid,n), buf(:,varid+1,n), &
754 vmapb2, vmapb2_size, field_list(varid)%field1d%local(n)%val, field_list(varid+1)%field1d%local(n)%val, lcmesh%refElem%Np * lcmesh%NeA )
755 else if(dim==2) then
756 call extract_bounddata_var2( buf(:,varid,n), buf(:,varid+1,n), &
757 vmapb2, vmapb2_size, field_list(varid)%field2d%local(n)%val, field_list(varid+1)%field2d%local(n)%val, lcmesh%refElem%Np * lcmesh%NeA )
758 else if(dim==3) then
759 call extract_bounddata_var2( buf(:,varid,n), buf(:,varid+1,n), &
760 vmapb2, vmapb2_size, field_list(varid)%field3d%local(n)%val, field_list(varid+1)%field3d%local(n)%val, lcmesh%refElem%Np * lcmesh%NeA )
761 end if
762 i = i + 2
763 else
764 if (dim==1) then
765 call meshfieldcommbase_extract_bounddata2( field_list(varid)%field1d%local(n)%val, vmapb2, vmapb2_size, lcmesh%refElem%Np*lcmesh%NeA, &
766 buf(:,varid,n) )
767 else if(dim==2) then
768 call meshfieldcommbase_extract_bounddata2( field_list(varid)%field2d%local(n)%val, vmapb2, vmapb2_size, lcmesh%refElem%Np*lcmesh%NeA, &
769 buf(:,varid,n) )
770 else if(dim==3) then
771 call meshfieldcommbase_extract_bounddata2( field_list(varid)%field3d%local(n)%val, vmapb2, vmapb2_size, lcmesh%refElem%Np*lcmesh%NeA, &
772 buf(:,varid,n) )
773 end if
774 i = i + 1
775 end if
776 end do
777 end do
778 return
779 contains
780!OCL SERIAL
781 subroutine extract_bounddata_var2( buf1_, buf2_, VMapB, VMapB_size, var1, var2, varSize )
782 implicit none
783 integer, intent(in) :: vmapB_size
784 real(RP), intent(out) :: buf1_(vmapB_size)
785 real(RP), intent(out) :: buf2_(vmapB_size)
786 integer, intent(in) :: vmapB(vmapB_size)
787 integer, intent(in) :: varSize
788 real(RP), intent(inout) :: var1(varSize)
789 real(RP), intent(inout) :: var2(varSize)
790
791 integer :: ii
792 !-----------------------------
793 !$omp parallel do
794!OCL PREFETCH
795 do ii=1, vmapb_size
796 buf1_(ii) = var1(vmapb(ii))
797 buf2_(ii) = var2(vmapb(ii))
798 end do
799 return
800 end subroutine extract_bounddata_var2

References meshfieldcommbase_extract_bounddata2().

Referenced by scale_meshfieldcomm_base::meshfieldcommbase::prepare_pc().

◆ meshfieldcommbase_set_bounddata()

subroutine, public scale_meshfieldcomm_base::meshfieldcommbase_set_bounddata ( real(rp), dimension(size(mesh%vmapb)), intent(in) buf,
class(elementbase), intent(in) refelem,
class(localmeshbase), intent(in) mesh,
real(rp), dimension(refelem%np * mesh%nea), intent(inout) var )

Extract halo data from the receiving buffer and set it to data array with MeshField object.

Definition at line 804 of file scale_meshfieldcomm_base.F90.

805 implicit none
806
807 class(ElementBase), intent(in) :: refElem
808 class(LocalMeshBase), intent(in) :: mesh
809 real(RP), intent(in) :: buf(size(mesh%VmapB))
810 real(RP), intent(inout) :: var(refElem%Np * mesh%NeA)
811
812 integer :: ii, iis
813 !-----------------------------------------------------------------------------
814
815#ifdef _OPENACC
816 iis = refelem%Np*mesh%NeE
817 !$acc parallel loop present(buf, var) async(1)
818 do ii=1, size(buf)
819 var(iis+ii) = buf(ii)
820 end do
821#else
822 var(refelem%Np*mesh%NeE+1:refelem%Np*mesh%NeE+size(buf)) = buf(:)
823#endif
824 return

Referenced by scale_meshfieldcomm_base::meshfieldcommbase::prepare_pc().

◆ meshfieldcommbase_set_bounddata_3()

subroutine, public scale_meshfieldcomm_base::meshfieldcommbase_set_bounddata_3 ( real(rp), dimension(vmapb_size), intent(in) buf,
class(elementbase), intent(in) refelem,
class(localmeshbase), intent(in) mesh,
integer, dimension(vmapb_size), intent(in) vmapb,
integer, intent(in) vmapb_size,
real(rp), dimension(refelem%np * mesh%nea), intent(inout) var )

Extract halo data from the recieving buffer and set it to data array with MeshField object.

Definition at line 828 of file scale_meshfieldcomm_base.F90.

829 implicit none
830
831 class(ElementBase), intent(in) :: refElem
832 class(LocalMeshBase), intent(in) :: mesh
833 integer, intent(in) :: vmapB_size
834 integer, intent(in) :: vmapB(vmapB_size)
835 real(RP), intent(in) :: buf(vmapB_size)
836 real(RP), intent(inout) :: var(refElem%Np * mesh%NeA)
837 !-----------------------------------------------------------------------------
838
839 var(refelem%Np*mesh%NeE+1:refelem%Np*mesh%NeE+size(buf)) = buf(:)
840 return

Referenced by scale_meshfieldcomm_base::meshfieldcommbase::prepare_pc().