Changeset 4828 for palm/trunk/SOURCE/pmc_parent_mod.f90
- Timestamp:
- Jan 5, 2021 11:21:41 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/pmc_parent_mod.f90
r4649 r4828 14 14 ! <http://www.gnu.org/licenses/>. 15 15 ! 16 ! Copyright 1997-202 0Leibniz Universitaet Hannover16 ! Copyright 1997-2021 Leibniz Universitaet Hannover 17 17 !--------------------------------------------------------------------------------------------------! 18 18 ! … … 25 25 ! ----------------- 26 26 ! $Id$ 27 ! pmc_s_set_2d_index_list revised for accelerating the code. Subroutine 28 ! description added. 29 ! 30 ! 4649 2020-08-25 12:11:17Z raasch 27 31 ! File re-formatted to follow the PALM coding standard 28 32 ! … … 70 74 pmc_g_setname, & 71 75 pmc_max_array, & 72 pmc_max_models, & 73 pmc_sort 76 pmc_max_models 74 77 75 78 USE pmc_handle_communicator, & … … 166 169 ! ------------ 167 170 ! 168 !> @Todo: Missing subroutine description.171 !> If this thread is intended as parent, initialize parent part of parent-client data transfer 169 172 !--------------------------------------------------------------------------------------------------! 170 173 SUBROUTINE pmc_parentinit … … 214 217 ! ------------ 215 218 ! 216 !> @Todo: Missing subroutine description. 219 !> thread 0 transfers the index list, which contains all parent grid cells involved in 220 !> parent client data transfer to the thread, on which this grid cell is located 217 221 !--------------------------------------------------------------------------------------------------! 218 222 SUBROUTINE pmc_s_set_2d_index_list( childid, index_list ) … … 220 224 IMPLICIT NONE 221 225 226 INTEGER(iwp), INTENT(IN) :: childid !< 227 INTEGER(iwp), DIMENSION(:,:), INTENT(INOUT) :: index_list !< 228 222 229 INTEGER(iwp) :: ian !< 223 INTEGER(iwp) :: i e!<230 INTEGER(iwp) :: i !< 224 231 INTEGER(iwp) :: ip !< 225 INTEGER(iwp) :: is !<226 232 INTEGER(iwp) :: istat !< 227 228 INTEGER(iwp), INTENT(IN) :: childid !< 229 230 INTEGER(iwp), DIMENSION(:,:), INTENT(INOUT) :: index_list !<233 INTEGER(iwp) :: max_cells !< 234 235 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: cells_on_pe !< 236 INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: lo_ind_list !< 231 237 232 238 233 239 IF ( m_model_rank == 0 ) THEN 234 240 ! 235 !-- Sort to ascending parent process order 236 CALL pmc_sort( index_list, 6 ) 237 is = 1 241 !-- Compute maximum number of grid cells located on one parent thread 242 243 ALLOCATE(cells_on_pe(0:m_model_npes-1)) 244 cells_on_pe = 0 245 246 DO i=1,SIZE( index_list, 2 ) 247 cells_on_pe(index_list(6,i )) = cells_on_pe(index_list(6,i ))+1 248 END DO 249 250 max_cells = MAXVAL(cells_on_pe) 251 ! 252 !-- Allocate temp array for thread dependent transfer of index_list 253 254 ALLOCATE(lo_ind_list(SIZE(index_list,1),max_cells)) 255 238 256 DO ip = 0, m_model_npes-1 239 257 ! 240 258 !-- Split into parent processes 241 ie = is - 1 242 ! 243 !-- There may be no entry for this process 244 IF ( is <= SIZE( index_list, 2 ) .AND. ie >= 0 ) THEN 245 DO WHILE ( index_list(6,ie+1 ) == ip ) 246 ie = ie + 1 247 IF ( ie == SIZE( index_list, 2 ) ) EXIT 248 ENDDO 249 ian = ie - is + 1 250 ELSE 251 is = -1 252 ie = -2 253 ian = 0 254 ENDIF 259 260 ian = 0 261 262 DO i=1,SIZE( index_list, 2 ) 263 IF(index_list(6,i ) == ip ) THEN 264 ian = ian+1 265 lo_ind_list(:,ian) = index_list(:,i) 266 END IF 267 END DO 255 268 ! 256 269 !-- Send data to other parent processes … … 262 275 ALLOCATE( indchildren(childid)%index_list_2d(6,1:ian) ) 263 276 IF ( ian > 0) THEN 264 indchildren(childid)%index_list_2d(:,1:ian) = index_list(:,is:ie)277 indchildren(childid)%index_list_2d(:,1:ian) = lo_ind_list(:,1:ian) 265 278 ENDIF 266 279 ELSE 267 280 CALL MPI_SEND( ian, 1, MPI_INTEGER, ip, 1000, m_model_comm, istat ) 268 281 IF ( ian > 0) THEN 269 CALL MPI_SEND( index_list(1,is), 6*ian, MPI_INTEGER, ip, 1001, m_model_comm, & 270 istat ) 282 CALL MPI_SEND( lo_ind_list, 6*ian, MPI_INTEGER, ip, 1001, m_model_comm, istat ) 271 283 ENDIF 272 284 ENDIF 273 is = ie + 1274 285 ENDDO 286 287 DEALLOCATE(lo_ind_list) 288 DEALLOCATE(cells_on_pe) 275 289 ELSE 276 290 CALL MPI_RECV( indchildren(childid)%nrpoints, 1, MPI_INTEGER, 0, 1000, m_model_comm, & … … 296 310 ! ------------ 297 311 ! 298 !> @Todo: Missing subroutine description. 299 !--------------------------------------------------------------------------------------------------! 312 !> Before creating an array list with arrays schedule for parent client transfer 313 !> make sure that the list is empty 314 !--------------------------------------------------------------------------------------------------! 315 300 316 SUBROUTINE pmc_s_clear_next_array_list 301 317 … … 306 322 307 323 END SUBROUTINE pmc_s_clear_next_array_list 308 309 324 310 325 … … 348 363 ! ------------ 349 364 ! 350 !> @Todo: Missing subroutine description.365 !> add 2D real array to list of arrays scheduled for parent-client transfer 351 366 !--------------------------------------------------------------------------------------------------! 352 367 SUBROUTINE pmc_s_set_dataarray_2d( childid, array, array_2 ) … … 388 403 ! ------------ 389 404 ! 390 !> @Todo: Missing subroutine description.405 !> add 2D integer array to list of arrays scheduled for parent-client transfer 391 406 !--------------------------------------------------------------------------------------------------! 392 407 SUBROUTINE pmc_s_set_dataarray_ip2d( childid, array ) … … 420 435 ! ------------ 421 436 ! 422 !> @Todo: Missing subroutine description.437 !> add 3D real array to list of arrays scheduled for parent-client transfer 423 438 !--------------------------------------------------------------------------------------------------! 424 439 SUBROUTINE pmc_s_set_dataarray_3d( childid, array, nz_cl, nz, array_2 ) … … 645 660 ! ------------ 646 661 ! 647 !> @Todo: Missing subroutine description.662 !> Fill buffer in RMA window to enable the client to fetch the dat with MPI_Get 648 663 !--------------------------------------------------------------------------------------------------! 649 664 SUBROUTINE pmc_s_fillbuffer( childid, waittime, particle_transfer ) … … 747 762 ! ------------ 748 763 ! 749 !> @Todo: Missing subroutine description.764 !> Get client data from RMM window 750 765 !--------------------------------------------------------------------------------------------------! 751 766 SUBROUTINE pmc_s_getdata_from_buffer( childid, waittime , particle_transfer, child_process_nr ) … … 896 911 ! ------------ 897 912 ! 898 !> @Todo: Missing subroutine description.913 !> broadcast name of transfer arrays from child thread 0 to parent threads 899 914 !--------------------------------------------------------------------------------------------------! 900 915 SUBROUTINE get_da_names_from_child( childid )
Note: See TracChangeset
for help on using the changeset viewer.