Changeset 4549 for palm/trunk
- Timestamp:
- May 29, 2020 9:27:29 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/cpulog_mod.f90
r4539 r4549 25 25 ! ----------------- 26 26 ! $Id$ 27 ! bugfix for r4539: values for min/max/rms stored in separate arrays 28 ! 29 ! 4539 2020-05-18 14:05:17Z raasch 27 30 ! code re-structured, 28 31 ! cpu time per grid point and timestep does not included initialization and spinup any more … … 280 283 REAL(dp) :: average_cputime !< 281 284 REAL(dp), SAVE :: norm = 1.0_dp !< 282 REAL(dp), DIMENSION(:), ALLOCATABLE :: pe_max !< 283 REAL(dp), DIMENSION(:), ALLOCATABLE :: pe_min !< 284 REAL(dp), DIMENSION(:), ALLOCATABLE :: pe_rms !< 285 REAL(dp), DIMENSION(:), ALLOCATABLE :: pe_tmp !< 286 REAL(dp), DIMENSION(:), ALLOCATABLE :: sum !< 287 REAL(dp), DIMENSION(:,:), ALLOCATABLE :: pe_log_points !< 285 REAL(dp), DIMENSION(:), ALLOCATABLE :: pe_max !< 286 REAL(dp), DIMENSION(:), ALLOCATABLE :: pe_max_s !< 287 REAL(dp), DIMENSION(:), ALLOCATABLE :: pe_min !< 288 REAL(dp), DIMENSION(:), ALLOCATABLE :: pe_min_s !< 289 REAL(dp), DIMENSION(:), ALLOCATABLE :: pe_rms !< 290 REAL(dp), DIMENSION(:), ALLOCATABLE :: pe_rms_s !< 291 REAL(dp), DIMENSION(:), ALLOCATABLE :: pe_tmp !< 292 REAL(dp), DIMENSION(:), ALLOCATABLE :: pe_tmp_s !< 293 REAL(dp), DIMENSION(:), ALLOCATABLE :: sum !< 294 REAL(dp), DIMENSION(:), ALLOCATABLE :: sum_s !< 295 REAL(dp), DIMENSION(:,:), ALLOCATABLE :: pe_log_points !< 296 REAL(dp), DIMENSION(:,:), ALLOCATABLE :: pe_log_points_s !< 288 297 289 298 … … 372 381 IF ( myid == 0 ) THEN 373 382 ! 374 !-- Initialize temporary arrays needed for statistics 375 pe_min = log_point_s%sum 376 pe_max = log_point_s%sum ! need to be set in case of 1 PE 377 pe_rms = 0.0_dp 383 !-- Allocate and initialize temporary arrays needed for statistics 384 ALLOCATE( pe_max_s( SIZE( log_point_s ) ), pe_min_s( SIZE( log_point_s ) ), & 385 pe_rms_s( SIZE( log_point_s ) ), pe_tmp_s( SIZE( log_point_s ) ), & 386 pe_log_points_s( SIZE( log_point_s ), 0:numprocs-1 ) ) 387 pe_min_s = log_point_s%sum 388 pe_max_s = log_point_s%sum ! need to be set in case of 1 PE 389 pe_rms_s = 0.0_dp 378 390 379 391 #if defined( __parallel ) … … 381 393 !-- Receive data from all PEs 382 394 DO i = 1, numprocs-1 383 CALL MPI_RECV( pe_tmp (1), SIZE( log_point ), MPI_DOUBLE_PRECISION, MPI_ANY_SOURCE,&384 MPI_ANY_ TAG, comm2d, status, ierr )395 CALL MPI_RECV( pe_tmp_s(1), SIZE( log_point_s ), MPI_DOUBLE_PRECISION, & 396 MPI_ANY_SOURCE, MPI_ANY_TAG, comm2d, status, ierr ) 385 397 sender = status(MPI_SOURCE) 386 pe_log_points (:,sender) = pe_tmp398 pe_log_points_s(:,sender) = pe_tmp_s 387 399 ENDDO 388 pe_log_points (:,0) = log_point_s%sum ! Results from PE0400 pe_log_points_s(:,0) = log_point_s%sum ! Results from PE0 389 401 ! 390 402 !-- Calculate mean of all PEs, store it on log_point_s%sum 391 403 !-- and find minimum and maximum 392 DO iii = 1, SIZE( log_point )404 DO iii = 1, SIZE( log_point_s ) 393 405 DO i = 1, numprocs-1 394 log_point_s(iii)%sum = log_point_s(iii)%sum + pe_log_points (iii,i)395 pe_min (iii) = MIN( pe_min(iii), pe_log_points(iii,i) )396 pe_max (iii) = MAX( pe_max(iii), pe_log_points(iii,i) )406 log_point_s(iii)%sum = log_point_s(iii)%sum + pe_log_points_s(iii,i) 407 pe_min_s(iii) = MIN( pe_min_s(iii), pe_log_points_s(iii,i) ) 408 pe_max_s(iii) = MAX( pe_max_s(iii), pe_log_points_s(iii,i) ) 397 409 ENDDO 398 410 log_point_s(iii)%sum = log_point_s(iii)%sum / numprocs … … 400 412 !-- Calculate rms 401 413 DO i = 0, numprocs-1 402 pe_rms (iii) = pe_rms(iii) + ( pe_log_points(iii,i) - log_point_s(iii)%sum )**2414 pe_rms_s(iii) = pe_rms_s(iii) + ( pe_log_points_s(iii,i) - log_point_s(iii)%sum )**2 403 415 ENDDO 404 pe_rms (iii) = SQRT( pe_rms(iii) / numprocs )416 pe_rms_s(iii) = SQRT( pe_rms_s(iii) / numprocs ) 405 417 ENDDO 406 418 ELSE … … 408 420 !-- Send data to PE0 (pe_max is used as temporary storage to send 409 421 !-- the data in order to avoid sending the data type log) 410 pe_max = log_point_s%sum 411 CALL MPI_SEND( pe_max(1), SIZE( log_point ), MPI_DOUBLE_PRECISION, 0, 0, comm2d, ierr ) 422 ALLOCATE( pe_max_s( SIZE( log_point_s ) ) ) 423 pe_max_s = log_point_s%sum 424 CALL MPI_SEND( pe_max_s(1), SIZE( log_point_s ), MPI_DOUBLE_PRECISION, 0, 0, comm2d, & 425 ierr ) 412 426 #endif 413 427 … … 470 484 ! 471 485 !-- Re-store sums 486 ALLOCATE( sum_s( SIZE( log_point_s ) ) ) 472 487 WHERE ( log_point_s%counts /= 0 ) 473 sum = log_point_s%sum488 sum_s = log_point_s%sum 474 489 ELSEWHERE 475 sum = -1.0_dp490 sum_s = -1.0_dp 476 491 ENDWHERE 477 492 … … 480 495 WRITE ( 18, 101 ) 481 496 DO 482 ii = MAXLOC( sum )497 ii = MAXLOC( sum_s ) 483 498 i = ii(1) 484 IF ( sum (i) /= -1.0_dp ) THEN499 IF ( sum_s(i) /= -1.0_dp ) THEN 485 500 WRITE ( 18, 102 ) log_point_s(i)%place, log_point_s(i)%sum, & 486 501 log_point_s(i)%sum / log_point(1)%sum * 100.0_dp, & 487 log_point_s(i)%counts, pe_min (i), pe_max(i), pe_rms(i)488 sum (i) = -1.0_dp502 log_point_s(i)%counts, pe_min_s(i), pe_max_s(i), pe_rms_s(i) 503 sum_s(i) = -1.0_dp 489 504 ELSE 490 505 EXIT
Note: See TracChangeset
for help on using the changeset viewer.