Changeset 2801 for palm/trunk/SOURCE/pmc_child_mod.f90
- Timestamp:
- Feb 14, 2018 4:01:55 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/pmc_child_mod.f90
r2718 r2801 26 26 ! ----------------- 27 27 ! $Id$ 28 ! Introduce particle transfer in nested models. 29 ! 30 ! 2718 2018-01-02 08:49:38Z maronga 28 31 ! Corrected "Former revisions" section 29 32 ! … … 84 87 ! 85 88 ! Child part of Palm Model Coupler 86 !------------------------------------------------------------------------------ -!89 !------------------------------------------------------------------------------! 87 90 88 91 #if defined( __parallel ) … … 97 100 98 101 USE kinds 99 USE pmc_general, 100 ONLY: arraydef, childdef, da_desclen, da_namedef, da_namelen, pedef, 102 USE pmc_general, & 103 ONLY: arraydef, childdef, da_desclen, da_namedef, da_namelen, pedef, & 101 104 pmc_da_name_err, pmc_g_setname, pmc_max_array, pmc_status_ok 102 105 103 USE pmc_handle_communicator, 106 USE pmc_handle_communicator, & 104 107 ONLY: m_model_comm, m_model_npes, m_model_rank, m_to_parent_comm 105 108 106 USE pmc_mpi_wrapper, 109 USE pmc_mpi_wrapper, & 107 110 ONLY: pmc_alloc_mem, pmc_bcast, pmc_inter_bcast, pmc_time 108 111 … … 112 115 SAVE 113 116 114 TYPE(childdef) :: me !<115 116 INTEGER :: myindex = 0 !< counter and unique number for data arrays117 INTEGER :: next_array_in_list = 0 !<117 TYPE(childdef), PUBLIC :: me !< 118 119 INTEGER(iwp) :: myindex = 0 !< counter and unique number for data arrays 120 INTEGER(iwp) :: next_array_in_list = 0 !< 118 121 119 122 … … 149 152 MODULE PROCEDURE pmc_c_set_dataarray_2d 150 153 MODULE PROCEDURE pmc_c_set_dataarray_3d 154 MODULE PROCEDURE pmc_c_set_dataarray_ip2d 151 155 END INTERFACE pmc_c_set_dataarray 152 156 … … 157 161 158 162 159 PUBLIC pmc_childinit, pmc_c_clear_next_array_list, pmc_c_getbuffer, 160 pmc_c_getnextarray, pmc_c_putbuffer, pmc_c_setind_and_allocmem, 163 PUBLIC pmc_childinit, pmc_c_clear_next_array_list, pmc_c_getbuffer, & 164 pmc_c_getnextarray, pmc_c_putbuffer, pmc_c_setind_and_allocmem, & 161 165 pmc_c_set_dataarray, pmc_set_dataarray_name, pmc_c_get_2d_index_list 162 166 … … 169 173 IMPLICIT NONE 170 174 171 INTEGER :: i !<172 INTEGER :: istat !<175 INTEGER(iwp) :: i !< 176 INTEGER(iwp) :: istat !< 173 177 174 178 ! … … 197 201 198 202 199 SUBROUTINE pmc_set_dataarray_name( parentarraydesc, parentarrayname, 203 SUBROUTINE pmc_set_dataarray_name( parentarraydesc, parentarrayname, & 200 204 childarraydesc, childarrayname, istat ) 201 205 … … 207 211 CHARACTER(LEN=*), INTENT(IN) :: childarraydesc !< 208 212 209 INTEGER , INTENT(OUT) :: istat !<213 INTEGER(iwp), INTENT(OUT) :: istat !< 210 214 ! 211 215 !-- Local variables 212 216 TYPE(da_namedef) :: myname !< 213 217 214 INTEGER :: mype !<215 INTEGER :: my_addiarray = 0 !<218 INTEGER(iwp) :: mype !< 219 INTEGER(iwp) :: my_addiarray = 0 !< 216 220 217 221 … … 219 223 ! 220 224 !-- Check length of array names 221 IF ( LEN( TRIM( parentarrayname) ) > da_namelen .OR. 225 IF ( LEN( TRIM( parentarrayname) ) > da_namelen .OR. & 222 226 LEN( TRIM( childarrayname) ) > da_namelen ) THEN 223 227 istat = pmc_da_name_err … … 235 239 ! 236 240 !-- Broadcast to all child processes 237 !-- TODO: describe what is broadcast here and why it is done 241 ! 242 !-- The complete description of an transfer names array is broadcasted 243 238 244 CALL pmc_bcast( myname%couple_index, 0, comm=m_model_comm ) 239 245 CALL pmc_bcast( myname%parentdesc, 0, comm=m_model_comm ) … … 243 249 ! 244 250 !-- Broadcast to all parent processes 245 !-- TODO: describe what is broadcast here and why it is done 251 !-- The complete description of an transfer array names is broadcasted als to all parent processe 252 ! Only the root PE of the broadcasts to parent using intra communicator 253 246 254 IF ( m_model_rank == 0 ) THEN 247 255 mype = MPI_ROOT … … 290 298 IMPLICIT NONE 291 299 292 INTEGER :: dummy !<293 INTEGER :: i, ierr, i2, j, nr !<294 INTEGER :: indwin !< MPI window object295 INTEGER :: indwin2 !< MPI window object300 INTEGER(iwp) :: dummy !< 301 INTEGER(iwp) :: i, ierr, i2, j, nr !< 302 INTEGER(iwp) :: indwin !< MPI window object 303 INTEGER(iwp) :: indwin2 !< MPI window object 296 304 297 305 INTEGER(KIND=MPI_ADDRESS_KIND) :: win_size !< Size of MPI window 1 (in bytes) … … 307 315 308 316 win_size = C_SIZEOF( dummy ) 309 CALL MPI_WIN_CREATE( dummy, win_size, iwp, MPI_INFO_NULL, me%intra_comm, 317 CALL MPI_WIN_CREATE( dummy, win_size, iwp, MPI_INFO_NULL, me%intra_comm, & 310 318 indwin, ierr ) 311 319 ! 312 !-- Open window on parent side 313 !-- TODO: why is the next MPI routine called twice?? 320 !-- Close window on child side and open on parent side 314 321 CALL MPI_WIN_FENCE( 0, indwin, ierr ) 315 ! 322 323 ! Between the two MPI_WIN_FENCE calls, the parent can fill the RMA window 324 316 325 !-- Close window on parent side and open on child side 326 317 327 CALL MPI_WIN_FENCE( 0, indwin, ierr ) 318 328 319 329 DO i = 1, me%inter_npes 320 330 disp = me%model_rank * 2 321 CALL MPI_GET( nrele((i-1)*2+1), 2, MPI_INTEGER, i-1, disp, 2, 331 CALL MPI_GET( nrele((i-1)*2+1), 2, MPI_INTEGER, i-1, disp, 2, & 322 332 MPI_INTEGER, indwin, ierr ) 323 333 ENDDO … … 347 357 !-- Here, we use a dummy for the MPI window because the parent processes do 348 358 !-- not access the RMA window via MPI_GET or MPI_PUT 349 CALL MPI_WIN_CREATE( dummy, winsize, iwp, MPI_INFO_NULL, me%intra_comm, 359 CALL MPI_WIN_CREATE( dummy, winsize, iwp, MPI_INFO_NULL, me%intra_comm, & 350 360 indwin2, ierr ) 351 361 ! 352 362 !-- MPI_GET is non-blocking -> data in nrele is not available until MPI_FENCE is 353 363 !-- called 354 !-- TODO: as before: why is this called twice?? 364 355 365 CALL MPI_WIN_FENCE( 0, indwin2, ierr ) 366 367 ! Between the two MPI_WIN_FENCE calls, the parent can fill the RMA window 368 356 369 CALL MPI_WIN_FENCE( 0, indwin2, ierr ) 357 370 … … 362 375 disp = nrele(2*(i-1)+1) 363 376 CALL MPI_WIN_LOCK( MPI_LOCK_SHARED , i-1, 0, indwin2, ierr ) 364 CALL MPI_GET( myind, 2*nr, MPI_INTEGER, i-1, disp, 2*nr, 377 CALL MPI_GET( myind, 2*nr, MPI_INTEGER, i-1, disp, 2*nr, & 365 378 MPI_INTEGER, indwin2, ierr ) 366 379 CALL MPI_WIN_UNLOCK( i-1, indwin2, ierr ) … … 424 437 myname = ar%name 425 438 ! 426 !-- Return true if legalarray427 !-- TODO: the case of a non-legal array does not seem to appear, so why is this428 !-- setting required at all? 439 !-- Return true if annother array 440 !-- If all array have been processed, the RETURN statement a couple of lines above is active 441 429 442 pmc_c_getnextarray = .TRUE. 430 443 431 END functionpmc_c_getnextarray444 END FUNCTION pmc_c_getnextarray 432 445 433 446 … … 439 452 REAL(wp), INTENT(IN) , DIMENSION(:,:), POINTER :: array !< 440 453 441 INTEGER 442 INTEGER 443 INTEGER , DIMENSION(4):: dims !<454 INTEGER(iwp) :: i !< 455 INTEGER(iwp) :: nrdims !< 456 INTEGER(iwp), DIMENSION(4) :: dims !< 444 457 445 458 TYPE(C_PTR) :: array_adr … … 459 472 ar => ape%array_list(next_array_in_list) 460 473 ar%nrdims = nrdims 474 ar%dimkey = nrdims 461 475 ar%a_dim = dims 462 476 ar%data = array_adr … … 465 479 END SUBROUTINE pmc_c_set_dataarray_2d 466 480 467 481 SUBROUTINE pmc_c_set_dataarray_ip2d( array ) 482 483 IMPLICIT NONE 484 485 INTEGER(idp), INTENT(IN) , DIMENSION(:,:), POINTER :: array !< 486 487 INTEGER(iwp) :: i !< 488 INTEGER(iwp) :: nrdims !< 489 INTEGER(iwp), DIMENSION(4) :: dims !< 490 491 TYPE(C_PTR) :: array_adr 492 TYPE(arraydef), POINTER :: ar 493 TYPE(pedef), POINTER :: ape 494 495 dims = 1 496 nrdims = 2 497 dims(1) = SIZE( array, 1 ) 498 dims(2) = SIZE( array, 2 ) 499 500 array_adr = C_LOC( array ) 501 502 DO i = 1, me%inter_npes 503 ape => me%pes(i) 504 ar => ape%array_list(next_array_in_list) 505 ar%nrdims = nrdims 506 ar%dimkey = 22 507 ar%a_dim = dims 508 ar%data = array_adr 509 ENDDO 510 511 END SUBROUTINE pmc_c_set_dataarray_ip2d 468 512 469 513 SUBROUTINE pmc_c_set_dataarray_3d (array) … … 473 517 REAL(wp), INTENT(IN), DIMENSION(:,:,:), POINTER :: array !< 474 518 475 INTEGER :: i 476 INTEGER :: nrdims 477 INTEGER, DIMENSION (4) :: dims 519 INTEGER(iwp) :: i 520 INTEGER(iwp) :: nrdims 521 INTEGER(iwp), DIMENSION (4) :: dims 522 478 523 TYPE(C_PTR) :: array_adr 479 524 TYPE(pedef), POINTER :: ape … … 493 538 ar => ape%array_list(next_array_in_list) 494 539 ar%nrdims = nrdims 540 ar%dimkey = nrdims 495 541 ar%a_dim = dims 496 542 ar%data = array_adr … … 512 558 CHARACTER(LEN=da_namelen) :: myname !< 513 559 514 INTEGER :: arlen !<515 INTEGER :: myindex !<516 INTEGER :: i !<517 INTEGER :: ierr !<518 INTEGER :: istat !<519 INTEGER :: j !<520 INTEGER :: rcount !<521 INTEGER :: tag !<522 523 INTEGER , PARAMETER :: noindex = -1 !<560 INTEGER(iwp) :: arlen !< 561 INTEGER(iwp) :: myindex !< 562 INTEGER(iwp) :: i !< 563 INTEGER(iwp) :: ierr !< 564 INTEGER(iwp) :: istat !< 565 INTEGER(iwp) :: j !< 566 INTEGER(iwp) :: rcount !< 567 INTEGER(iwp) :: tag !< 568 569 INTEGER(iwp), PARAMETER :: noindex = -1 !< 524 570 525 571 INTEGER(idp) :: bufsize !< size of MPI data window 526 572 INTEGER(KIND=MPI_ADDRESS_KIND) :: winsize !< 527 573 528 INTEGER ,DIMENSION(1024) :: req !<574 INTEGER(iwp),DIMENSION(1024) :: req !< 529 575 530 576 REAL(wp), DIMENSION(:), POINTER, SAVE :: base_array_pc !< base array … … 549 595 !-- Receive index from child 550 596 tag = tag + 1 551 CALL MPI_RECV( myindex, 1, MPI_INTEGER, i-1, tag, me%inter_comm, 597 CALL MPI_RECV( myindex, 1, MPI_INTEGER, i-1, tag, me%inter_comm, & 552 598 MPI_STATUS_IGNORE, ierr ) 553 599 ar%recvindex = myindex 554 600 ! 555 601 !-- Determine max, because child buffer is allocated only once 556 !-- TODO: give a more meaningful comment 557 IF( ar%nrdims == 3 ) THEN 602 !-- All 2D and 3d arrays use the same buffer 603 604 IF ( ar%nrdims == 3 ) THEN 558 605 bufsize = MAX( bufsize, ar%a_dim(1)*ar%a_dim(2)*ar%a_dim(3) ) 559 606 ELSE … … 588 635 DO j = 1, ape%nr_arrays 589 636 ar => ape%array_list(j) 590 IF ( ar%nrdims == 2 ) THEN637 IF ( ar%nrdims == 2 ) THEN 591 638 arlen = ape%nrele 592 639 ELSEIF( ar%nrdims == 3 ) THEN … … 596 643 rcount = rcount + 1 597 644 IF ( ape%nrele > 0 ) THEN 598 CALL MPI_ISEND( myindex, 1, MPI_INTEGER, i-1, tag, me%inter_comm, 645 CALL MPI_ISEND( myindex, 1, MPI_INTEGER, i-1, tag, me%inter_comm, & 599 646 req(rcount), ierr ) 600 647 ar%sendindex = myindex 601 648 ELSE 602 CALL MPI_ISEND( noindex, 1, MPI_INTEGER, i-1, tag, me%inter_comm, 649 CALL MPI_ISEND( noindex, 1, MPI_INTEGER, i-1, tag, me%inter_comm, & 603 650 req(rcount), ierr ) 604 651 ar%sendindex = noindex 605 652 ENDIF 606 653 ! 607 !-- Maximum of 1024 outstanding requests 608 !-- TODO: explain where this maximum comes from (arbitrary?). 609 !-- Outstanding = pending? 654 !-- Maximum of 1024 pending requests 655 ! 1024 is an arbitrary value just to make sure the number of pending 656 ! requests is getting too large. It is possible that this value has to 657 ! be adjusted in case of running the model on large number of cores. 658 610 659 IF ( rcount == 1024 ) THEN 611 660 CALL MPI_WAITALL( rcount, req, MPI_STATUSES_IGNORE, ierr ) … … 640 689 winSize = me%totalbuffersize 641 690 642 CALL MPI_WIN_CREATE( base_array_cp, winsize, wp, MPI_INFO_NULL, 691 CALL MPI_WIN_CREATE( base_array_cp, winsize, wp, MPI_INFO_NULL, & 643 692 me%intra_comm, me%win_parent_child, ierr ) 644 693 CALL MPI_WIN_FENCE( 0, me%win_parent_child, ierr ) … … 657 706 !-- the message-routine 658 707 IF ( ar%sendindex+ar%sendsize > bufsize ) THEN 659 WRITE( 0,'(a,i4,4i7,1x,a)') 'Child buffer too small ', i, 660 ar%sendindex, ar%sendsize, ar%sendindex+ar%sendsize, 708 WRITE( 0,'(a,i4,4i7,1x,a)') 'Child buffer too small ', i, & 709 ar%sendindex, ar%sendsize, ar%sendindex+ar%sendsize, & 661 710 bufsize, TRIM( ar%name ) 662 711 CALL MPI_ABORT( MPI_COMM_WORLD, istat, ierr ) … … 670 719 671 720 672 SUBROUTINE pmc_c_getbuffer( waittime )721 SUBROUTINE pmc_c_getbuffer( waittime, particle_transfer ) 673 722 674 723 IMPLICIT NONE 675 724 676 725 REAL(wp), INTENT(OUT), OPTIONAL :: waittime !< 726 LOGICAL, INTENT(IN), OPTIONAL :: particle_transfer !< 677 727 678 728 CHARACTER(LEN=da_namelen) :: myname !< 679 680 INTEGER :: ierr !< 681 INTEGER :: ij !< 682 INTEGER :: ip !< 683 INTEGER :: j !< 684 INTEGER :: myindex !< 685 INTEGER :: nr !< number of elements to get 686 !< from parent 729 730 LOGICAL :: lo_ptrans!< 731 732 INTEGER(iwp) :: ierr !< 733 INTEGER(iwp) :: ij !< 734 INTEGER(iwp) :: ip !< 735 INTEGER(iwp) :: j !< 736 INTEGER(iwp) :: myindex !< 737 INTEGER(iwp) :: nr !< number of elements to get 738 !< from parent 687 739 INTEGER(KIND=MPI_ADDRESS_KIND) :: target_disp 688 740 INTEGER,DIMENSION(1) :: buf_shape … … 696 748 TYPE(pedef), POINTER :: ape 697 749 TYPE(arraydef), POINTER :: ar 750 INTEGER(idp), POINTER, DIMENSION(:) :: ibuf !< 751 INTEGER(idp), POINTER, DIMENSION(:,:) :: idata_2d !< 698 752 699 753 ! … … 701 755 !-- Therefore the RMA window can be filled without 702 756 !-- sychronization at this point and a barrier is not necessary. 757 758 !-- In case waittime is present, the following barrier is necessary to 759 !-- insure the same number of barrier calls on parent and child 760 !-- This means, that here on child side two barriers are call successively 761 !-- The parent is filling its buffer between the two barrier calls 762 703 763 !-- Please note that waittime has to be set in pmc_s_fillbuffer AND 704 764 !-- pmc_c_getbuffer … … 709 769 waittime = t2 - t1 710 770 ENDIF 771 772 lo_ptrans = .FALSE. 773 IF ( PRESENT( particle_transfer)) lo_ptrans = particle_transfer 774 711 775 ! 712 776 !-- Wait for buffer is filled. 713 !-- TODO: explain in more detail what is happening here. The barrier seems to 714 !-- contradict what is said a few lines before (i.e. that no barrier is necessary) 715 !-- TODO: In case of PRESENT( waittime ) the barrrier would be calles twice. Why? 716 !-- Shouldn't it be done the same way as in pmc_putbuffer? 777 ! 778 !-- The parent side (in pmc_s_fillbuffer) is filling the buffer in the MPI RMA window 779 !-- When the filling is complet, a MPI_BARRIER is called. 780 !-- The child is not allowd to access the parent-buffer before it is completely filled 781 !-- therefore the following barrier is required. 782 717 783 CALL MPI_BARRIER( me%intra_comm, ierr ) 718 784 … … 721 787 DO j = 1, ape%nr_arrays 722 788 ar => ape%array_list(j) 723 IF ( ar%nrdims == 2 ) THEN 789 790 IF ( ar%dimkey == 2 .AND. .NOT.lo_ptrans) THEN 724 791 nr = ape%nrele 725 ELSEIF ( ar% nrdims == 3) THEN792 ELSEIF ( ar%dimkey == 3 .AND. .NOT.lo_ptrans) THEN 726 793 nr = ape%nrele * ar%a_dim(1) 794 ELSE IF ( ar%dimkey == 22 .AND. lo_ptrans) THEN 795 nr = ape%nrele 796 ELSE 797 CYCLE ! Particle array ar not transferd here 727 798 ENDIF 728 799 buf_shape(1) = nr 729 CALL C_F_POINTER( ar%recvbuf, buf, buf_shape ) 800 IF ( lo_ptrans ) THEN 801 CALL C_F_POINTER( ar%recvbuf, ibuf, buf_shape ) 802 ELSE 803 CALL C_F_POINTER( ar%recvbuf, buf, buf_shape ) 804 ENDIF 730 805 ! 731 806 !-- MPI passive target RMA 732 !-- TODO: explain the above comment 807 !-- One data array is fetcht from MPI RMA window on parent 808 733 809 IF ( nr > 0 ) THEN 734 810 target_disp = ar%recvindex - 1 735 CALL MPI_WIN_LOCK( MPI_LOCK_SHARED , ip-1, 0, 811 CALL MPI_WIN_LOCK( MPI_LOCK_SHARED , ip-1, 0, & 736 812 me%win_parent_child, ierr ) 737 CALL MPI_GET( buf, nr, MPI_REAL, ip-1, target_disp, nr, MPI_REAL, & 738 me%win_parent_child, ierr ) 813 IF ( lo_ptrans ) THEN 814 CALL MPI_GET( ibuf, nr*8, MPI_BYTE, ip-1, target_disp, nr*8, MPI_BYTE, & !There is no MPI_INTEGER8 datatype 815 me%win_parent_child, ierr ) 816 ELSE 817 CALL MPI_GET( buf, nr, MPI_REAL, ip-1, target_disp, nr, & 818 MPI_REAL, me%win_parent_child, ierr ) 819 ENDIF 739 820 CALL MPI_WIN_UNLOCK( ip-1, me%win_parent_child, ierr ) 740 821 ENDIF 741 822 myindex = 1 742 IF ( ar%nrdims == 2 ) THEN 823 IF ( ar%dimkey == 2 .AND. .NOT.lo_ptrans) THEN 824 743 825 CALL C_F_POINTER( ar%data, data_2d, ar%a_dim(1:2) ) 744 826 DO ij = 1, ape%nrele … … 746 828 myindex = myindex + 1 747 829 ENDDO 748 ELSEIF ( ar%nrdims == 3 ) THEN 830 831 ELSEIF ( ar%dimkey == 3 .AND. .NOT.lo_ptrans) THEN 832 749 833 CALL C_F_POINTER( ar%data, data_3d, ar%a_dim(1:3) ) 750 834 DO ij = 1, ape%nrele 751 data_3d(:,ape%locind(ij)%j,ape%locind(ij)%i) = 835 data_3d(:,ape%locind(ij)%j,ape%locind(ij)%i) = & 752 836 buf(myindex:myindex+ar%a_dim(1)-1) 753 837 myindex = myindex+ar%a_dim(1) 754 838 ENDDO 839 840 ELSEIF ( ar%dimkey == 22 .AND. lo_ptrans) THEN 841 CALL C_F_POINTER( ar%data, idata_2d, ar%a_dim(1:2) ) 842 843 DO ij = 1, ape%nrele 844 idata_2d(ape%locind(ij)%j,ape%locind(ij)%i) = ibuf(myindex) 845 myindex = myindex + 1 846 ENDDO 847 755 848 ENDIF 756 849 ENDDO … … 761 854 762 855 763 SUBROUTINE pmc_c_putbuffer( waittime )856 SUBROUTINE pmc_c_putbuffer( waittime , particle_transfer ) 764 857 765 858 IMPLICIT NONE 766 859 767 860 REAL(wp), INTENT(OUT), OPTIONAL :: waittime !< 861 LOGICAL, INTENT(IN), OPTIONAL :: particle_transfer !< 768 862 769 863 CHARACTER(LEN=da_namelen) :: myname !< 770 771 INTEGER :: ierr !< 772 INTEGER :: ij !< 773 INTEGER :: ip !< 774 INTEGER :: j !< 775 INTEGER :: myindex !< 776 INTEGER :: nr !< number of elements to get 777 !< from parent 864 865 LOGICAL :: lo_ptrans!< 866 867 INTEGER(iwp) :: ierr !< 868 INTEGER(iwp) :: ij !< 869 INTEGER(iwp) :: ip !< 870 INTEGER(iwp) :: j !< 871 INTEGER(iwp) :: myindex !< 872 INTEGER(iwp) :: nr !< number of elements to get from parent 873 778 874 INTEGER(KIND=MPI_ADDRESS_KIND) :: target_disp !< 779 780 INTEGER, DIMENSION(1) :: buf_shape !< 875 876 877 INTEGER(iwp), DIMENSION(1) :: buf_shape !< 781 878 782 879 REAL(wp) :: t1 !< 783 880 REAL(wp) :: t2 !< 784 881 785 REAL(wp), POINTER, DIMENSION(:) :: buf !< 786 REAL(wp), POINTER, DIMENSION(:,:) :: data_2d !< 787 REAL(wp), POINTER, DIMENSION(:,:,:) :: data_3d !< 788 789 TYPE(pedef), POINTER :: ape !< 790 TYPE(arraydef), POINTER :: ar !< 882 REAL(wp), POINTER, DIMENSION(:) :: buf !< 883 REAL(wp), POINTER, DIMENSION(:,:) :: data_2d !< 884 REAL(wp), POINTER, DIMENSION(:,:,:) :: data_3d !< 885 886 INTEGER(idp), POINTER, DIMENSION(:) :: ibuf !< 887 INTEGER(idp), POINTER, DIMENSION(:,:) :: idata_2d !< 888 889 TYPE(pedef), POINTER :: ape !< 890 TYPE(arraydef), POINTER :: ar !< 791 891 792 892 ! 793 893 !-- Wait for empty buffer 794 !-- TODO: explain what is done here 894 !-- Switch RMA epoche 895 795 896 t1 = pmc_time() 796 897 CALL MPI_BARRIER( me%intra_comm, ierr ) 797 898 t2 = pmc_time() 798 899 IF ( PRESENT( waittime ) ) waittime = t2 - t1 900 901 lo_ptrans = .FALSE. 902 IF ( PRESENT( particle_transfer)) lo_ptrans = particle_transfer 799 903 800 904 DO ip = 1, me%inter_npes … … 803 907 ar => aPE%array_list(j) 804 908 myindex = 1 805 IF ( ar%nrdims == 2 ) THEN 909 910 IF ( ar%dimkey == 2 .AND. .NOT.lo_ptrans ) THEN 911 806 912 buf_shape(1) = ape%nrele 807 913 CALL C_F_POINTER( ar%sendbuf, buf, buf_shape ) … … 811 917 myindex = myindex + 1 812 918 ENDDO 813 ELSEIF ( ar%nrdims == 3 ) THEN 919 920 ELSEIF ( ar%dimkey == 3 .AND. .NOT.lo_ptrans ) THEN 921 814 922 buf_shape(1) = ape%nrele*ar%a_dim(1) 815 923 CALL C_F_POINTER( ar%sendbuf, buf, buf_shape ) … … 820 928 myindex = myindex + ar%a_dim(1) 821 929 ENDDO 930 931 ELSE IF ( ar%dimkey == 22 .AND. lo_ptrans) THEN 932 933 buf_shape(1) = ape%nrele 934 CALL C_F_POINTER( ar%sendbuf, ibuf, buf_shape ) 935 CALL C_F_POINTER( ar%data, idata_2d, ar%a_dim(1:2) ) 936 937 DO ij = 1, ape%nrele 938 ibuf(myindex) = idata_2d(ape%locind(ij)%j,ape%locind(ij)%i) 939 myindex = myindex + 1 940 ENDDO 941 822 942 ENDIF 823 943 ENDDO 824 944 ENDDO 825 945 ! 826 !-- TODO: Fence might do it, test later827 !-- Call MPI_WIN_FENCE( 0, me%win_parent_child, ierr) !828 !829 946 !-- Buffer is filled 830 !-- TODO: explain in more detail what is happening here 947 !-- Switch RMA epoche 948 831 949 CALL MPI_Barrier(me%intra_comm, ierr) 832 950
Note: See TracChangeset
for help on using the changeset viewer.