Changeset 4600 for LMDZ6/trunk/libf/dyn3dmem
- Timestamp:
- Jun 30, 2023, 8:18:43 PM (18 months ago)
- Location:
- LMDZ6/trunk/libf/dyn3dmem
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/dyn3dmem/abort_gcm.F
r4593 r4600 47 47 else 48 48 write(lunout,*) 'Houston, we have a problem, ierr = ', ierr 49 #ifdef CPP_MPI 49 50 if (using_mpi) THEN 50 51 C$OMP CRITICAL (MPI_ABORT_GCM) 51 call MPI_ABORT(COMM_LMDZ, 1, ierror_mpi)52 call MPI_ABORT(COMM_LMDZ, 1, ierror_mpi) 52 53 C$OMP END CRITICAL (MPI_ABORT_GCM) 53 #else 54 stop 1 55 #endif 54 else 55 stop 1 56 endif 57 56 58 endif 57 59 END -
LMDZ6/trunk/libf/dyn3dmem/mod_const_mpi.F90
r4146 r4600 11 11 12 12 SUBROUTINE Init_const_mpi 13 USE lmdz_mpi 14 13 15 #ifdef CPP_IOIPSL 14 16 USE IOIPSL, ONLY: getin … … 25 27 #endif 26 28 IMPLICIT NONE 27 #ifdef CPP_MPI28 INCLUDE 'mpif.h'29 #endif30 29 31 30 INTEGER :: ierr … … 52 51 !$OMP END MASTER 53 52 #endif 54 #ifdef CPP_MPI55 53 MPI_REAL_LMDZ=MPI_REAL8 56 #endif57 54 ELSE 58 55 CALL init_mpi … … 62 59 63 60 SUBROUTINE Init_mpi 61 USE lmdz_mpi 62 64 63 #ifdef CPP_XIOS 65 64 USE wxios, only: wxios_init 66 65 #endif 67 66 IMPLICIT NONE 68 #ifdef CPP_MPI69 INCLUDE 'mpif.h'70 #endif71 67 INTEGER :: ierr 72 68 INTEGER :: thread_required 73 69 INTEGER :: thread_provided 74 70 75 #ifdef CPP_MPI76 71 !$OMP MASTER 77 72 thread_required=MPI_THREAD_SERIALIZED … … 92 87 #endif 93 88 !$OMP END MASTER 94 #else95 #ifdef CPP_XIOS96 !$OMP MASTER97 CALL wxios_init("LMDZ")98 !$OMP END MASTER99 #endif100 #endif101 89 102 90 END SUBROUTINE Init_mpi 103 91 104 92 END MODULE mod_const_mpi -
LMDZ6/trunk/libf/dyn3dmem/mod_hallo.F90
r4469 r4600 106 106 107 107 SUBROUTINE create_global_mpi_buffer 108 USE lmdz_mpi 108 109 IMPLICIT NONE 109 #ifdef CPP_MPI110 INCLUDE 'mpif.h'111 #endif112 110 POINTER (Pbuffer,MPI_Buffer(MaxBufferSize)) 113 111 REAL :: MPI_Buffer 114 #ifdef CPP_MPI115 112 INTEGER(KIND=MPI_ADDRESS_KIND) :: BS 116 #else117 INTEGER(KIND=8) :: BS118 #endif119 113 INTEGER :: i,ierr 120 114 … … 122 116 Bs=8*MaxBufferSize 123 117 !$OMP CRITICAL (MPI) 124 #ifdef CPP_MPI125 118 CALL MPI_ALLOC_MEM(BS,MPI_INFO_NULL,Pbuffer,ierr) 126 #endif127 119 !$OMP END CRITICAL (MPI) 128 120 DO i=1,MaxBufferSize … … 1157 1149 subroutine Register_Hallo(Field,ij,ll,RUp,Rdown,SUp,SDown,a_request) 1158 1150 USE dimensions_mod 1151 USE lmdz_mpi 1159 1152 implicit none 1160 1153 1161 #ifdef CPP_MPI1162 include 'mpif.h'1163 #endif1164 1154 INTEGER :: ij,ll 1165 1155 REAL, dimension(ij,ll) :: Field … … 1224 1214 subroutine Register_Hallo_u(Field,ll,RUp,Rdown,SUp,SDown,a_request) 1225 1215 USE dimensions_mod 1216 USE lmdz_mpi 1226 1217 implicit none 1227 #ifdef CPP_MPI1228 include 'mpif.h'1229 #endif1230 1218 INTEGER :: ll 1231 1219 REAL, dimension(ijb_u:ije_u,ll) :: Field … … 1289 1277 subroutine Register_Hallo_v(Field,ll,RUp,Rdown,SUp,SDown,a_request) 1290 1278 USE dimensions_mod 1279 USE lmdz_mpi 1291 1280 implicit none 1292 #ifdef CPP_MPI1293 include 'mpif.h'1294 #endif1295 1281 INTEGER :: ll 1296 1282 REAL, dimension(ijb_v:ije_v,ll) :: Field … … 1354 1340 subroutine SendRequest(a_Request) 1355 1341 USE dimensions_mod 1342 USE lmdz_mpi 1356 1343 implicit none 1357 1358 #ifdef CPP_MPI1359 include 'mpif.h'1360 #endif1361 1344 1362 1345 type(request),target :: a_request … … 1410 1393 !$OMP CRITICAL (MPI) 1411 1394 1412 #ifdef CPP_MPI1413 1395 call MPI_ISEND(Buffer(req%Pos),SizeBuffer,MPI_REAL_LMDZ,rank,a_request%tag+1000*omp_rank, & 1414 1396 COMM_LMDZ,Req%MSG_Request,ierr) 1415 #endif1416 1397 IF (.NOT.using_mpi) THEN 1417 1398 PRINT *,'Erreur, echange MPI en mode sequentiel !!!' … … 1453 1434 !$OMP CRITICAL (MPI) 1454 1435 1455 #ifdef CPP_MPI1456 1436 call MPI_IRECV(Buffer(Req%Pos),SizeBuffer,MPI_REAL_LMDZ,rank,a_request%tag+1000*omp_rank, & 1457 1437 COMM_LMDZ,Req%MSG_Request,ierr) 1458 #endif 1438 1459 1439 IF (.NOT.using_mpi) THEN 1460 1440 PRINT *,'Erreur, echange MPI en mode sequentiel !!!' … … 1478 1458 subroutine WaitRequest(a_Request) 1479 1459 USE dimensions_mod 1460 USE lmdz_mpi 1480 1461 implicit none 1481 1482 #ifdef CPP_MPI1483 include 'mpif.h'1484 #endif1485 1462 1486 1463 type(request),target :: a_request … … 1488 1465 type(Hallo),pointer :: PtrHallo 1489 1466 integer, dimension(2*mpi_size) :: TabRequest 1490 #ifdef CPP_MPI1491 1467 integer, dimension(MPI_STATUS_SIZE,2*mpi_size) :: TabStatus 1492 #else1493 integer, dimension(1,2*mpi_size) :: TabStatus1494 #endif1495 1468 integer :: NbRequest 1496 1469 integer :: i,rank,pos,ij,l,ierr … … 1521 1494 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"en attente" 1522 1495 ! PRINT *,"No des requetes :",TabRequest(1:NbRequest) 1523 #ifdef CPP_MPI1524 1496 call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 1525 #endif1526 1497 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"complete" 1527 1498 ! PRINT *,"-------------------------------------------------------------------" … … 1571 1542 1572 1543 subroutine WaitSendRequest(a_Request) 1544 USE lmdz_mpi 1573 1545 USE dimensions_mod 1574 1546 implicit none 1575 1547 1576 #ifdef CPP_MPI1577 include 'mpif.h'1578 #endif1579 1548 type(request),target :: a_request 1580 1549 type(request_SR),pointer :: Req 1581 1550 type(Hallo),pointer :: PtrHallo 1582 1551 integer, dimension(mpi_size) :: TabRequest 1583 #ifdef CPP_MPI1584 1552 integer, dimension(MPI_STATUS_SIZE,mpi_size) :: TabStatus 1585 #else1586 integer, dimension(1,mpi_size) :: TabStatus1587 #endif1588 1553 integer :: NbRequest 1589 1554 integer :: i,rank,pos,ij,l,ierr … … 1606 1571 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"en attente" 1607 1572 ! PRINT *,"No des requetes :",TabRequest(1:NbRequest) 1608 #ifdef CPP_MPI 1609 call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 1610 #endif 1573 call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 1611 1574 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"complete" 1612 1575 ! PRINT *,"-------------------------------------------------------------------" … … 1628 1591 subroutine WaitRecvRequest(a_Request) 1629 1592 USE dimensions_mod 1593 USE lmdz_mpi 1630 1594 implicit none 1631 1632 #ifdef CPP_MPI1633 include 'mpif.h'1634 #endif1635 1636 1595 type(request),target :: a_request 1637 1596 type(request_SR),pointer :: Req 1638 1597 type(Hallo),pointer :: PtrHallo 1639 1598 integer, dimension(mpi_size) :: TabRequest 1640 #ifdef CPP_MPI1641 1599 integer, dimension(MPI_STATUS_SIZE,mpi_size) :: TabStatus 1642 #else1643 integer, dimension(1,mpi_size) :: TabStatus1644 #endif1645 1600 integer :: NbRequest 1646 1601 integer :: i,rank,pos,ij,l,ierr … … 1664 1619 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"en attente" 1665 1620 ! PRINT *,"No des requetes :",TabRequest(1:NbRequest) 1666 #ifdef CPP_MPI 1667 call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 1668 #endif 1621 call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 1669 1622 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"complete" 1670 1623 ! PRINT *,"-------------------------------------------------------------------" -
LMDZ6/trunk/libf/dyn3dmem/parallel_lmdz.F90
r4593 r4600 4 4 MODULE parallel_lmdz 5 5 USE mod_const_mpi 6 USE lmdz_mpi, ONLY : using_mpi 6 7 #ifdef CPP_IOIPSL 7 8 use IOIPSL … … 12 13 INTEGER,PARAMETER :: halo_max=3 13 14 14 LOGICAL,SAVE :: using_mpi ! .true. if using MPI15 15 LOGICAL,SAVE :: using_omp ! .true. if using OpenMP 16 16 LOGICAL,SAVE :: is_master ! .true. if the core is both MPI & OpenMP master … … 88 88 subroutine init_parallel 89 89 USE vampir 90 USE lmdz_mpi 90 91 implicit none 91 #ifdef CPP_MPI92 include 'mpif.h'93 #endif94 92 INCLUDE "dimensions.h" 95 93 INCLUDE "paramet.h" … … 111 109 #endif 112 110 113 #ifdef CPP_MPI114 using_mpi=.TRUE.115 #else116 using_mpi=.FALSE.117 #endif118 119 120 111 #ifdef CPP_OMP 121 112 using_OMP=.TRUE. … … 127 118 128 119 IF (using_mpi) THEN 129 #ifdef CPP_MPI130 120 call MPI_COMM_SIZE(COMM_LMDZ,mpi_size,ierr) 131 121 call MPI_COMM_RANK(COMM_LMDZ,mpi_rank,ierr) 132 #endif133 122 ELSE 134 123 mpi_size=1 … … 161 150 write(lunout,*)" ---> diminuez le nombre de CPU ou augmentez la taille en lattitude" 162 151 163 #ifdef CPP_MPI164 152 IF (using_mpi) call MPI_ABORT(COMM_LMDZ,-1, ierr) 165 #endif 153 166 154 endif 167 155 … … 395 383 396 384 subroutine Finalize_parallel 385 USE lmdz_mpi 397 386 #ifdef CPP_XIOS 398 387 ! ug Pour les sorties XIOS … … 418 407 include "dimensions.h" 419 408 include "paramet.h" 420 #ifdef CPP_MPI421 include 'mpif.h'422 #endif423 409 424 410 integer :: ierr … … 446 432 CALL wxios_close() 447 433 #endif 448 #ifdef CPP_MPI 449 IF (using_mpi) call MPI_FINALIZE(ierr) 450 #endif 434 IF (using_mpi) call MPI_FINALIZE(ierr) 451 435 end if 452 436 … … 502 486 503 487 SUBROUTINE barrier 488 USE lmdz_mpi 504 489 IMPLICIT NONE 505 #ifdef CPP_MPI506 INCLUDE 'mpif.h'507 #endif508 490 INTEGER :: ierr 509 491 510 492 !$OMP CRITICAL (MPI) 511 #ifdef CPP_MPI512 493 IF (using_mpi) CALL MPI_Barrier(COMM_LMDZ,ierr) 513 #endif514 494 !$OMP END CRITICAL (MPI) 515 495 … … 518 498 519 499 subroutine exchange_hallo(Field,ij,ll,up,down) 500 USE lmdz_mpi 520 501 USE Vampir 521 502 implicit none 522 503 INCLUDE "dimensions.h" 523 504 INCLUDE "paramet.h" 524 #ifdef CPP_MPI525 include 'mpif.h'526 #endif527 505 INTEGER :: ij,ll 528 506 REAL, dimension(ij,ll) :: Field … … 533 511 LOGICAL :: RecvUp,RecvDown 534 512 INTEGER, DIMENSION(4) :: Request 535 #ifdef CPP_MPI536 513 INTEGER, DIMENSION(MPI_STATUS_SIZE,4) :: Status 537 #else 538 INTEGER, DIMENSION(1,4) :: Status 539 #endif 514 540 515 INTEGER :: NbRequest 541 516 REAL, dimension(:),allocatable :: Buffer_Send_up,Buffer_Send_down … … 582 557 call PACK_Data(Field(ij_begin,1),ij,ll,down,Buffer_Send_up) 583 558 !$OMP CRITICAL (MPI) 584 #ifdef CPP_MPI585 559 call MPI_ISEND(Buffer_send_up,Buffer_Size,MPI_REAL8,MPI_Rank-1,1, & 586 560 COMM_LMDZ,Request(NbRequest),ierr) 587 #endif588 561 !$OMP END CRITICAL (MPI) 589 562 ENDIF … … 597 570 598 571 !$OMP CRITICAL (MPI) 599 #ifdef CPP_MPI600 572 call MPI_ISEND(Buffer_send_down,Buffer_Size,MPI_REAL8,MPI_Rank+1,1, & 601 573 COMM_LMDZ,Request(NbRequest),ierr) 602 #endif603 574 !$OMP END CRITICAL (MPI) 604 575 ENDIF … … 611 582 612 583 !$OMP CRITICAL (MPI) 613 #ifdef CPP_MPI614 584 call MPI_IRECV(Buffer_recv_up,Buffer_size,MPI_REAL8,MPI_Rank-1,1, & 615 585 COMM_LMDZ,Request(NbRequest),ierr) 616 #endif617 586 !$OMP END CRITICAL (MPI) 618 587 … … 626 595 627 596 !$OMP CRITICAL (MPI) 628 #ifdef CPP_MPI629 597 call MPI_IRECV(Buffer_recv_down,Buffer_size,MPI_REAL8,MPI_Rank+1,1, & 630 598 COMM_LMDZ,Request(NbRequest),ierr) 631 #endif632 599 !$OMP END CRITICAL (MPI) 633 600 634 601 ENDIF 635 602 636 #ifdef CPP_MPI637 603 if (NbRequest > 0) call MPI_WAITALL(NbRequest,Request,Status,ierr) 638 #endif639 604 IF (RecvUp) call Unpack_Data(Field(ij_begin-up*iip1,1),ij,ll,up,Buffer_Recv_up) 640 605 IF (RecvDown) call Unpack_Data(Field(ij_end+1,1),ij,ll,down,Buffer_Recv_down) … … 651 616 652 617 subroutine Gather_Field(Field,ij,ll,rank) 618 USE lmdz_mpi 653 619 implicit none 654 620 INCLUDE "dimensions.h" 655 621 INCLUDE "paramet.h" 656 622 INCLUDE "iniprint.h" 657 #ifdef CPP_MPI658 include 'mpif.h'659 #endif660 623 INTEGER :: ij,ll,rank 661 624 REAL, dimension(ij,ll) :: Field … … 709 672 710 673 !$OMP CRITICAL (MPI) 711 #ifdef CPP_MPI712 674 call MPI_GATHERV(Buffer_send,(min(ij_end,ij)-ij_begin+1)*ll,MPI_REAL8, & 713 675 Buffer_Recv,Recv_count,displ,MPI_REAL8,rank,COMM_LMDZ,ierr) 714 #endif715 676 !$OMP END CRITICAL (MPI) 716 677 … … 735 696 736 697 subroutine AllGather_Field(Field,ij,ll) 698 USE lmdz_mpi 737 699 implicit none 738 700 INCLUDE "dimensions.h" 739 701 INCLUDE "paramet.h" 740 #ifdef CPP_MPI741 include 'mpif.h'742 #endif743 702 INTEGER :: ij,ll 744 703 REAL, dimension(ij,ll) :: Field … … 748 707 call Gather_Field(Field,ij,ll,0) 749 708 !$OMP CRITICAL (MPI) 750 #ifdef CPP_MPI751 709 call MPI_BCAST(Field,ij*ll,MPI_REAL8,0,COMM_LMDZ,ierr) 752 #endif753 710 !$OMP END CRITICAL (MPI) 754 711 ENDIF … … 757 714 758 715 subroutine Broadcast_Field(Field,ij,ll,rank) 716 USE lmdz_mpi 759 717 implicit none 760 718 INCLUDE "dimensions.h" 761 719 INCLUDE "paramet.h" 762 #ifdef CPP_MPI763 include 'mpif.h'764 #endif765 720 INTEGER :: ij,ll 766 721 REAL, dimension(ij,ll) :: Field … … 771 726 772 727 !$OMP CRITICAL (MPI) 773 #ifdef CPP_MPI774 728 call MPI_BCAST(Field,ij*ll,MPI_REAL8,rank,COMM_LMDZ,ierr) 775 #endif776 729 !$OMP END CRITICAL (MPI) 777 730 … … 781 734 782 735 ! Subroutine verif_hallo(Field,ij,ll,up,down) 736 ! USE lmdz_mpi 783 737 ! implicit none 784 738 ! INCLUDE "dimensions.h" 785 739 ! INCLUDE "paramet.h" 786 ! include 'mpif.h'787 740 ! 788 741 ! INTEGER :: ij,ll -
LMDZ6/trunk/libf/dyn3dmem/times.F90
r4593 r4600 137 137 subroutine allgather_timer 138 138 USE parallel_lmdz 139 implicit none 140 #ifdef CPP_MPI 141 include 'mpif.h' 142 #endif 139 USE lmdz_mpi 140 implicit none 141 143 142 integer :: ierr 144 143 integer :: data_size … … 155 154 156 155 tmp_table(:,:)=timer_table(:,:,mpi_rank) 157 #ifdef CPP_MPI158 156 call mpi_allgather(tmp_table(1,1),data_size,MPI_REAL_LMDZ,timer_table(1,1,0),data_size,MPI_REAL_LMDZ,COMM_LMDZ,ierr) 159 #endif160 157 tmp_table(:,:)=timer_table_sqr(:,:,mpi_rank) 161 #ifdef CPP_MPI162 158 call mpi_allgather(tmp_table(1,1),data_size,MPI_REAL_LMDZ,timer_table_sqr(1,1,0),data_size,MPI_REAL_LMDZ,COMM_LMDZ,ierr) 163 #endif164 159 deallocate(tmp_table) 165 160 … … 172 167 subroutine allgather_timer_average 173 168 USE parallel_lmdz 174 implicit none 175 #ifdef CPP_MPI 176 include 'mpif.h' 177 #endif 169 USE lmdz_mpi 170 implicit none 178 171 integer :: ierr 179 172 integer :: data_size … … 192 185 193 186 tmp_table(:,:)=timer_average(:,:,mpi_rank) 194 #ifdef CPP_MPI195 187 call mpi_allgather(tmp_table(1,1),data_size,MPI_REAL_LMDZ,timer_average(1,1,0),data_size,MPI_REAL_LMDZ,COMM_LMDZ,ierr) 196 #endif197 188 tmp_table(:,:)=timer_delta(:,:,mpi_rank) 198 #ifdef CPP_MPI199 189 call mpi_allgather(tmp_table(1,1),data_size,MPI_REAL_LMDZ,timer_delta(1,1,0),data_size,MPI_REAL_LMDZ,COMM_LMDZ,ierr) 200 #endif201 190 tmp_iter(:,:)=timer_iteration(:,:,mpi_rank) 202 #ifdef CPP_MPI203 191 call mpi_allgather(tmp_iter(1,1),data_size,MPI_INTEGER,timer_iteration(1,1,0),data_size,MPI_INTEGER,COMM_LMDZ,ierr) 204 #endif205 192 deallocate(tmp_table) 206 193
Note: See TracChangeset
for help on using the changeset viewer.