Changeset 2304 for branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/lib_mpp.F90
- Timestamp:
- 2010-10-22T17:56:39+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/lib_mpp.F90
r2287 r2304 73 73 PUBLIC mppsize, mpprank 74 74 75 # if defined key_mpp_rep176 PUBLIC mpp_allgatherv77 # endif78 79 75 !! * Interfaces 80 76 !! define generic interface for these routine as they are called sometimes … … 88 84 END INTERFACE 89 85 INTERFACE mpp_sum 90 # if defined key_mpp_rep 286 # if defined key_mpp_rep 91 87 MODULE PROCEDURE mppsum_a_int, mppsum_int, mppsum_a_real, mppsum_real, & 92 88 mppsum_realdd, mppsum_a_realdd … … 105 101 END INTERFACE 106 102 107 # if defined key_mpp_rep1108 INTERFACE mpp_allgatherv109 MODULE PROCEDURE mpp_allgatherv_real, mpp_allgatherv_int110 END INTERFACE111 # endif112 113 103 !! ========================= !! 114 104 !! MPI variable definition !! … … 289 279 mynode = mpprank 290 280 ! 291 #if defined key_mpp_rep 2281 #if defined key_mpp_rep 292 282 CALL MPI_OP_CREATE(DDPDD_MPI, .TRUE., MPI_SUMDD, ierr) 293 283 #endif … … 1430 1420 END SUBROUTINE mppsum_real 1431 1421 1432 # if defined key_mpp_rep 21422 # if defined key_mpp_rep 1433 1423 SUBROUTINE mppsum_realdd( ytab, kcom ) 1434 1424 !!---------------------------------------------------------------------- … … 2352 2342 END SUBROUTINE mpi_init_opa 2353 2343 2354 #if defined key_mpp_rep1 2355 SUBROUTINE mpp_allgatherv_real( pvalsin, knoin, pvalsout, ksizeout, & 2356 & knoout, kstartout ) 2357 !!---------------------------------------------------------------------- 2358 !! *** ROUTINE mpp_allgatherv_real *** 2359 !! 2360 !! ** Purpose : Gather a real array on all processors 2361 !! 2362 !! ** Method : MPI all gatherv 2363 !! 2364 !! ** Action : This does only work for MPI. 2365 !! It does not work for SHMEM. 2366 !! 2367 !! References : http://www.mpi-forum.org 2368 !! 2369 !! History : 2370 !! ! 08-08 (K. Mogensen) Original code 2371 !!---------------------------------------------------------------------- 2372 2373 !! * Arguments 2374 INTEGER, INTENT(IN) :: & 2375 & knoin, & 2376 & ksizeout 2377 REAL(wp), DIMENSION(knoin), INTENT(IN) :: & 2378 & pvalsin 2379 REAL(wp), DIMENSION(ksizeout), INTENT(OUT) :: & 2380 & pvalsout 2381 INTEGER, DIMENSION(jpnij), INTENT(OUT) :: & 2382 & kstartout, & 2383 & knoout 2384 2385 !! * Local declarations 2386 INTEGER :: & 2387 & ierr 2388 INTEGER :: & 2389 & ji 2390 !----------------------------------------------------------------------- 2391 ! Call the MPI library to get number of data per processor 2392 !----------------------------------------------------------------------- 2393 CALL mpi_allgather( knoin, 1, mpi_integer, & 2394 & knoout, 1, mpi_integer, & 2395 & mpi_comm_opa, ierr ) 2396 !----------------------------------------------------------------------- 2397 ! Compute starts of each processors contribution 2398 !----------------------------------------------------------------------- 2399 kstartout(1) = 0 2400 DO ji = 2, jpnij 2401 kstartout(ji) = kstartout(ji-1) + knoout(ji-1) 2402 ENDDO 2403 !----------------------------------------------------------------------- 2404 ! Call the MPI library to do the gathering of the data 2405 !----------------------------------------------------------------------- 2406 CALL mpi_allgatherv( pvalsin, knoin, MPI_DOUBLE_PRECISION, & 2407 & pvalsout, knoout, kstartout, MPI_DOUBLE_PRECISION, & 2408 & mpi_comm_opa, ierr ) 2409 2410 END SUBROUTINE mpp_allgatherv_real 2411 2412 SUBROUTINE mpp_allgatherv_int( kvalsin, knoin, kvalsout, ksizeout, & 2413 & knoout, kstartout ) 2414 !!---------------------------------------------------------------------- 2415 !! *** ROUTINE mpp_allgatherv *** 2416 !! 2417 !! ** Purpose : Gather an integer array on all processors 2418 !! 2419 !! ** Method : MPI all gatherv 2420 !! 2421 !! ** Action : This does only work for MPI. 2422 !! It does not work for SHMEM. 2423 !! 2424 !! References : http://www.mpi-forum.org 2425 !! 2426 !! History : 2427 !! ! 06-07 (K. Mogensen) Original code 2428 !!---------------------------------------------------------------------- 2429 2430 !! * Arguments 2431 INTEGER, INTENT(IN) :: & 2432 & knoin, & 2433 & ksizeout 2434 INTEGER, DIMENSION(knoin), INTENT(IN) :: & 2435 & kvalsin 2436 INTEGER, DIMENSION(ksizeout), INTENT(OUT) :: & 2437 & kvalsout 2438 INTEGER, DIMENSION(jpnij), INTENT(OUT) :: & 2439 & kstartout, & 2440 & knoout 2441 2442 !! * Local declarations 2443 INTEGER :: & 2444 & ierr 2445 INTEGER :: & 2446 & ji 2447 !----------------------------------------------------------------------- 2448 ! Call the MPI library to get number of data per processor 2449 !----------------------------------------------------------------------- 2450 CALL mpi_allgather( knoin, 1, mpi_integer, & 2451 & knoout, 1, mpi_integer, & 2452 & mpi_comm_opa, ierr ) 2453 !----------------------------------------------------------------------- 2454 ! Compute starts of each processors contribution 2455 !----------------------------------------------------------------------- 2456 kstartout(1) = 0 2457 DO ji = 2, jpnij 2458 kstartout(ji) = kstartout(ji-1) + knoout(ji-1) 2459 ENDDO 2460 !----------------------------------------------------------------------- 2461 ! Call the MPI library to do the gathering of the data 2462 !----------------------------------------------------------------------- 2463 CALL mpi_allgatherv( kvalsin, knoin, mpi_integer, & 2464 & kvalsout, knoout, kstartout, mpi_integer, & 2465 & mpi_comm_opa, ierr ) 2466 2467 END SUBROUTINE mpp_allgatherv_int 2468 #endif 2469 2470 #if defined key_mpp_rep2 2344 #if defined key_mpp_rep 2471 2345 SUBROUTINE DDPDD_MPI (ydda, yddb, ilen, itype) 2472 2346 !!--------------------------------------------------------------------- … … 2503 2377 !! Default case: Dummy module share memory computing 2504 2378 !!---------------------------------------------------------------------- 2505 # if defined key_mpp_rep12506 USE par_kind2507 USE par_oce2508 2509 PUBLIC mpp_allgatherv2510 # endif2511 2379 2512 2380 INTERFACE mpp_sum … … 2530 2398 END INTERFACE 2531 2399 2532 # if defined key_mpp_rep12533 INTERFACE mpp_allgatherv2534 MODULE PROCEDURE mpp_allgatherv_real, mpp_allgatherv_int2535 END INTERFACE2536 # endif2537 2538 2539 2400 LOGICAL, PUBLIC, PARAMETER :: lk_mpp = .FALSE. !: mpp flag 2540 2401 INTEGER :: ncomm_ice … … 2719 2580 WRITE(*,*) 'mpp_comm_free: You should not have seen this print! error?', kcom 2720 2581 END SUBROUTINE mpp_comm_free 2721 2722 # if defined key_mpp_rep12723 SUBROUTINE mpp_allgatherv_real( pvalsin, knoin, pvalsout, ksizeout, &2724 & knoout, kstartout )2725 INTEGER, INTENT(IN) :: &2726 & knoin, &2727 & ksizeout2728 REAL(wp), DIMENSION(knoin), INTENT(IN) :: &2729 & pvalsin2730 REAL(wp), DIMENSION(ksizeout), INTENT(OUT) :: &2731 & pvalsout2732 INTEGER, DIMENSION(jpnij), INTENT(OUT) :: &2733 & kstartout, &2734 & knoout2735 pvalsout(1:knoin) = pvalsin(1:knoin)2736 kstartout(1) = 02737 knoout(1) = knoin2738 END SUBROUTINE mpp_allgatherv_real2739 2740 SUBROUTINE mpp_allgatherv_int( kvalsin, knoin, kvalsout, ksizeout, &2741 & knoout, kstartout )2742 INTEGER, INTENT(IN) :: &2743 & knoin, &2744 & ksizeout2745 INTEGER, DIMENSION(knoin), INTENT(IN) :: &2746 & kvalsin2747 INTEGER, DIMENSION(ksizeout), INTENT(OUT) :: &2748 & kvalsout2749 INTEGER, DIMENSION(jpnij), INTENT(OUT) :: &2750 & kstartout, &2751 & knoout2752 2753 kvalsout(1:knoin) = kvalsin(1:knoin)2754 kstartout(1) = 02755 knoout(1) = knoin2756 END SUBROUTINE mpp_allgatherv_int2757 # endif2758 2759 2582 #endif 2760 2583 !!----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.