- Timestamp:
- 09/29/21 09:46:40 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/test/generic_testcase.f90
r2236 r2239 11 11 INTEGER :: nb_proc_oce 12 12 INTEGER :: nb_proc_surf 13 INTEGER :: nb_proc_server 13 14 CHARACTER(LEN=len_str) :: proc_distribution 14 15 CHARACTER(LEN=len_str) :: start_date … … 56 57 LOGICAL :: i_am_atm, i_am_oce, i_am_surf, i_am_server 57 58 INTEGER :: rank, size_loc 58 59 INTEGER :: nb_procs(4) 60 LOGICAL :: who_i_am(4) 59 61 60 62 OPEN(unit=unit, file='param.def',status='old',iostat=ierr) … … 80 82 endif 81 83 84 nb_proc_server=size_loc-(nb_proc_atm + nb_proc_oce + nb_proc_surf) 82 85 i_am_atm=.FALSE. ; i_am_oce=.FALSE. ; i_am_surf=.FALSE. ; i_am_server=.FALSE. 83 86 … … 95 98 i_am_server=.TRUE. 96 99 ENDIF ; 97 100 ELSE IF (proc_distribution=="cyclic") THEN 101 ! server ranks are dispatched all along the partition 102 nb_procs(1)=nb_proc_atm ; nb_procs(2)=nb_proc_oce ; nb_procs(3)=nb_proc_surf ; nb_procs(4)=nb_proc_server 103 CALL compute_cyclic_distribution(rank, nb_procs, who_i_am ) 104 i_am_atm=who_i_am(1) 105 i_am_oce=who_i_am(2) 106 i_am_surf=who_i_am(3) 107 i_am_server=who_i_am(4) 98 108 ENDIF 99 109 … … 2427 2437 END SUBROUTINE get_decomposition 2428 2438 2439 SUBROUTINE compute_cyclic_distribution(rank, nb_procs, who_i_am) 2440 IMPLICIT NONE 2441 INTEGER,INTENT(IN) :: rank 2442 INTEGER,INTENT(IN) :: nb_procs(:) 2443 LOGICAL,INTENT(OUT) :: who_i_am(:) 2444 INTEGER :: start(SIZE(nb_procs)) 2445 INTEGER :: nb_comp 2446 INTEGER :: nb_client 2447 INTEGER :: nb_server 2448 INTEGER :: current 2449 INTEGER :: current_client 2450 INTEGER :: i,j,k,nq,q,r 2451 2452 who_i_am=.FALSE. 2453 nb_comp = SIZE(nb_procs) 2454 nb_client = SUM(nb_procs(1:nb_comp-1)) 2455 nb_server = nb_procs(nb_comp) 2456 2457 start(1)=0 2458 DO k=2,nb_comp 2459 start(k)=start(k-1)+nb_procs(k-1) 2460 ENDDO 2461 2462 current=0 2463 current_client=0 2464 2465 IF (nb_client >= nb_server) THEN 2466 q=nb_client/nb_server 2467 r=MOD(nb_client,nb_server) 2468 2469 DO i=1,nb_server 2470 IF (i<=r) THEN ; nq=q+1 ; ELSE ; nq=q ; ENDIF 2471 DO j=1,nq 2472 IF (current==rank) THEN 2473 DO k=1,nb_comp-1 2474 IF (current_client >= start(k) .AND. current_client<start(k+1)) THEN 2475 who_i_am(k)=.TRUE. 2476 RETURN 2477 ENDIF 2478 ENDDO 2479 ENDIF 2480 current=current+1 2481 current_client=current_client+1 2482 ENDDO 2483 2484 IF (current==rank) THEN 2485 who_i_am(nb_comp)=.TRUE. 2486 RETURN 2487 ENDIF 2488 current=current+1 2489 ENDDO 2490 2491 ELSE 2492 q=nb_server/nb_client 2493 r=MOD(nb_server,nb_client) 2494 2495 DO i=1,nb_client 2496 IF (i<=r) THEN ; nq=q+1 ; ELSE ; nq=q ; ENDIF 2497 DO j=1,nq 2498 IF (current==rank) THEN 2499 who_i_am(nb_comp)=.TRUE. 2500 RETURN 2501 ENDIF 2502 current=current+1 2503 ENDDO 2504 2505 IF (current==rank) THEN 2506 DO k=1,nb_comp-1 2507 IF (current_client >= start(k) .AND. current_client<start(k+1)) THEN 2508 who_i_am(k)=.TRUE. 2509 RETURN 2510 ENDIF 2511 ENDDO 2512 ENDIF 2513 current=current+1 2514 current_client=current_client+1 2515 ENDDO 2516 ENDIF 2517 2518 END SUBROUTINE compute_cyclic_distribution 2519 2429 2520 END PROGRAM generic_testcase 2430 2521
Note: See TracChangeset
for help on using the changeset viewer.