Changeset 985 for LMDZ4/trunk/libf/dyn3dpar/mod_hallo.F90
- Timestamp:
- Jul 30, 2008, 5:50:03 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ4/trunk/libf/dyn3dpar/mod_hallo.F90
r807 r985 2 2 USE parallel 3 3 implicit none 4 4 logical,save :: use_mpi_alloc 5 5 integer, parameter :: MaxRequest=200 6 6 integer, parameter :: MaxProc=80 … … 9 9 10 10 integer,save :: MaxBufferSize_Used 11 12 real,save,pointer,dimension(:) :: Buffer 13 14 integer,dimension(Listsize) :: Buffer_Pos 15 integer :: Index_Pos 11 !$OMP THREADPRIVATE( MaxBufferSize_Used) 12 13 real,save,pointer,dimension(:) :: Buffer 14 !$OMP THREADPRIVATE(Buffer) 15 16 integer,save,dimension(Listsize) :: Buffer_Pos 17 integer,save :: Index_Pos 18 !$OMP THREADPRIVATE(Buffer_Pos,Index_pos) 16 19 17 20 type Hallo … … 47 50 MaxBufferSize_Used=0 48 51 49 CALL create_global_mpi_buffer 50 52 IF (use_mpi_alloc) THEN 53 CALL create_global_mpi_buffer 54 ELSE 55 CALL create_standard_mpi_buffer 56 ENDIF 57 51 58 end subroutine init_mod_hallo 52 53 59 54 60 SUBROUTINE create_standard_mpi_buffer … … 59 65 END SUBROUTINE create_standard_mpi_buffer 60 66 61 62 67 SUBROUTINE create_global_mpi_buffer 63 68 IMPLICIT NONE … … 68 73 INTEGER :: i,ierr 69 74 70 75 ! Allocation du buffer MPI 71 76 Bs=8*MaxBufferSize 77 !$OMP CRITICAL (MPI) 72 78 CALL MPI_ALLOC_MEM(BS,MPI_INFO_NULL,Pbuffer,ierr) 79 !$OMP END CRITICAL (MPI) 73 80 DO i=1,MaxBufferSize 74 81 MPI_Buffer(i)=i … … 88 95 89 96 END SUBROUTINE create_global_mpi_buffer 90 91 97 92 98 93 99 subroutine allocate_buffer(Size,Index,Pos) … … 381 387 integer :: i,rank,l,ij,Pos,ierr 382 388 integer :: offset 383 ! real,dimension(:),pointer :: Buffer384 389 real,dimension(:,:),pointer :: Field 385 390 integer :: Nb … … 392 397 do i=1,Req%NbRequest 393 398 PtrHallo=>Req%Hallo(i) 394 SizeBuffer=SizeBuffer+PtrHallo%size*PtrHallo%NbLevel*iip1 399 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 400 DO l=1,PtrHallo%NbLevel 401 SizeBuffer=SizeBuffer+PtrHallo%size*iip1 402 ENDDO 403 !$OMP ENDDO NOWAIT 395 404 enddo 396 405 397 406 if (SizeBuffer>0) then 398 407 399 ! allocate(Req%Buffer(SizeBuffer))400 408 call allocate_buffer(SizeBuffer,Req%Index,Req%pos) 401 409 402 410 Pos=Req%Pos 403 ! Buffer=>req%Buffer404 411 do i=1,Req%NbRequest 405 412 PtrHallo=>Req%Hallo(i) … … 407 414 Nb=iip1*PtrHallo%size-1 408 415 Field=>PtrHallo%Field 409 416 417 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 410 418 do l=1,PtrHallo%NbLevel 411 419 !cdir NODEP … … 413 421 Buffer(Pos+ij)=Field(Offset+ij,l) 414 422 enddo 415 ! Buffer(Pos:Pos+Nb)=Field(offset:offset+Nb,l)416 423 417 424 Pos=Pos+Nb+1 418 425 enddo 419 426 !$OMP END DO NOWAIT 420 427 enddo 421 428 422 ! print *, 'process',MPI_RANK,'ISSEND: requette ',a_request%tag,'au process',rank,'de taille',SizeBuffer 423 ! call MPI_ISSEND(Req%Buffer,SizeBuffer,MPI_REAL8,rank,a_request%tag, & 424 ! COMM_LMDZ,Req%MSG_Request,ierr) 425 call MPI_ISSEND(Buffer(req%Pos),SizeBuffer,MPI_REAL8,rank,a_request%tag, & 429 !$OMP CRITICAL (MPI) 430 call MPI_ISSEND(Buffer(req%Pos),SizeBuffer,MPI_REAL8,rank,a_request%tag+1000*omp_rank, & 426 431 COMM_LMDZ,Req%MSG_Request,ierr) 427 432 ! PRINT *,"-------------------------------------------------------------------" 433 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->" 434 ! PRINT *,"Requete envoye au proc :",rank,"tag :",a_request%tag+1000*omp_rank 435 ! PRINT *,"Taille du message :",SizeBuffer,"requete no :",Req%MSG_Request 436 ! PRINT *,"-------------------------------------------------------------------" 437 !$OMP END CRITICAL (MPI) 428 438 endif 429 439 … … 438 448 do i=1,Req%NbRequest 439 449 PtrHallo=>Req%Hallo(i) 440 SizeBuffer=SizeBuffer+PtrHallo%size*PtrHallo%NbLevel*iip1 450 451 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 452 DO l=1,PtrHallo%NbLevel 453 SizeBuffer=SizeBuffer+PtrHallo%size*iip1 454 ENDDO 455 !$OMP ENDDO NOWAIT 441 456 enddo 442 457 443 458 if (SizeBuffer>0) then 444 ! allocate(Req%Buffer(SizeBuffer)) 459 445 460 call allocate_buffer(SizeBuffer,Req%Index,Req%Pos) 446 ! print *, 'process',MPI_RANK,'IRECV: requette ',a_request%tag,'au process',rank,'de taille',SizeBuffer 447 448 ! call MPI_IRECV(Req%Buffer,SizeBuffer,MPI_REAL8,rank,a_request%tag, & 449 ! COMM_LMDZ,Req%MSG_Request,ierr) 450 call MPI_IRECV(Buffer(Req%Pos),SizeBuffer,MPI_REAL8,rank,a_request%tag, & 461 !$OMP CRITICAL (MPI) 462 call MPI_IRECV(Buffer(Req%Pos),SizeBuffer,MPI_REAL8,rank,a_request%tag+1000*omp_rank, & 451 463 COMM_LMDZ,Req%MSG_Request,ierr) 452 464 ! PRINT *,"-------------------------------------------------------------------" 465 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->" 466 ! PRINT *,"Requete en attente du proc :",rank,"tag :",a_request%tag+1000*omp_rank 467 ! PRINT *,"Taille du message :",SizeBuffer,"requete no :",Req%MSG_Request 468 ! PRINT *,"-------------------------------------------------------------------" 469 470 !$OMP END CRITICAL (MPI) 453 471 endif 454 472 … … 492 510 enddo 493 511 494 if (NbRequest>0) call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 495 512 if (NbRequest>0) then 513 !$OMP CRITICAL (MPI) 514 ! PRINT *,"-------------------------------------------------------------------" 515 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"en attente" 516 ! PRINT *,"No des requetes :",TabRequest(1:NbRequest) 517 call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 518 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"complete" 519 ! PRINT *,"-------------------------------------------------------------------" 520 !$OMP END CRITICAL (MPI) 521 endif 496 522 do rank=0,MPI_Size-1 497 523 Req=>a_request%RequestRecv(rank) … … 502 528 offset=(PtrHallo%offset-1)*iip1+1 503 529 Nb=iip1*PtrHallo%size-1 504 530 531 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 505 532 do l=1,PtrHallo%NbLevel 506 533 !cdir NODEP … … 508 535 PtrHallo%Field(offset+ij,l)=Buffer(Pos+ij) 509 536 enddo 510 ! PtrHallo%Field(offset:offset+Nb,l)=Buffer(Pos:Pos+Nb) 511 ! do ij=offset,offset+iip1*PtrHallo%size-1 512 ! PtrHallo%Field(ij,l)=Buffer(Pos) 513 ! Pos=Pos+1 514 ! enddo 537 515 538 Pos=Pos+Nb+1 516 539 enddo 517 540 !$OMP ENDDO NOWAIT 518 541 enddo 519 542 endif … … 566 589 567 590 568 if (NbRequest>0) call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 569 591 if (NbRequest>0) THEN 592 !$OMP CRITICAL (MPI) 593 ! PRINT *,"-------------------------------------------------------------------" 594 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"en attente" 595 ! PRINT *,"No des requetes :",TabRequest(1:NbRequest) 596 call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 597 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"complete" 598 ! PRINT *,"-------------------------------------------------------------------" 599 600 !$OMP END CRITICAL (MPI) 601 endif 570 602 571 603 do rank=0,MPI_SIZE-1 … … 608 640 609 641 610 if (NbRequest>0) call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 642 if (NbRequest>0) then 643 !$OMP CRITICAL (MPI) 644 ! PRINT *,"-------------------------------------------------------------------" 645 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"en attente" 646 ! PRINT *,"No des requetes :",TabRequest(1:NbRequest) 647 call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 648 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"complete" 649 ! PRINT *,"-------------------------------------------------------------------" 650 !$OMP END CRITICAL (MPI) 651 endif 611 652 612 653 do rank=0,MPI_Size-1 … … 618 659 offset=(PtrHallo%offset-1)*iip1+1 619 660 Nb=iip1*PtrHallo%size-1 620 661 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 621 662 do l=1,PtrHallo%NbLevel 622 663 !cdir NODEP … … 626 667 Pos=Pos+Nb+1 627 668 enddo 669 !$OMP END DO NOWAIT 628 670 enddo 629 671 endif … … 651 693 include 'mpif.h' 652 694 653 INTEGER :: ij,ll 695 INTEGER :: ij,ll,l 654 696 REAL, dimension(ij,ll) :: FieldS 655 697 REAL, dimension(ij,ll) :: FieldR … … 673 715 ijb=(jjb-1)*iip1+1 674 716 ije=jje*iip1 675 FieldR(ijb:ije,1:ll)=FieldS(ijb:ije,1:ll) 717 718 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 719 do l=1,ll 720 FieldR(ijb:ije,l)=FieldS(ijb:ije,l) 721 enddo 722 !$OMP ENDDO NOWAIT 676 723 endif 724 677 725 678 726 end subroutine CopyField … … 691 739 integer,dimension(0:MPI_Size-1) :: jj_Begin_New,jj_End_New 692 740 693 integer ::i,jje,jjb,ijb,ije 741 integer ::i,jje,jjb,ijb,ije,l 694 742 695 743 … … 710 758 ijb=(jjb-1)*iip1+1 711 759 ije=jje*iip1 712 FieldR(ijb:ije,1:ll)=FieldS(ijb:ije,1:ll) 760 761 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 762 do l=1,ll 763 FieldR(ijb:ije,l)=FieldS(ijb:ije,l) 764 enddo 765 !$OMP ENDDO NOWAIT 766 713 767 endif 714 768 end subroutine CopyFieldHallo
Note: See TracChangeset
for help on using the changeset viewer.