Changeset 10132
 Timestamp:
 20180917T14:57:19+02:00 (22 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

NEMO/branches/2018/dev_r9759_HPC09_ESIWACE/src/OCE/LBC/mppini.F90
r9926 r10132 738 738 INTEGER, INTENT(in) :: num_pes ! The number of MPI processes we have 739 739 ! 740 INTEGER, PARAMETER :: nfactmax = 20740 INTEGER, PARAMETER :: nfactmax = 40 741 741 INTEGER :: nfact ! The no. of factors returned 742 742 INTEGER :: ierr ! Error flag … … 744 744 INTEGER :: idiff, mindiff, imin ! For choosing pair of factors that are closest in value 745 745 INTEGER, DIMENSION(nfactmax) :: ifact ! Array of factors 746 integer, dimension(2) :: pdims 746 747 !! 747 748 ! 748 749 ierr = 0 749 ! 750 #ifdef BULL_MPI_DIMS_CREATE 751 ! compute good (rectangular) domain decomposition 752 call MPI_Dims_create(num_pes, 2, pdims, ierr) 753 if(ierr == 0) then 754 write(numout, *) 'MPI_Dims_create: ',pdims 755 jpni=pdims(1) 756 jpnj=pdims(2) 757 else 758 WRITE (numout, *) 'WARNING: factorisation of number of PEs failed' 759 WRITE (numout, *) ' : using grid of ',num_pes,' x 1' 760 jpnj = 1 761 jpni = num_pes 762 endif 763 jpnij = jpni*jpnj 764 #else 765 #ifdef BULL_GET_DIVISORS 766 CALL get_divisors( ifact, nfactmax, nfact, num_pes, ierr ) 767 #else 750 768 CALL factorise( ifact, nfactmax, nfact, num_pes, ierr ) 769 #endif 751 770 ! 752 771 IF( nfact <= 1 ) THEN … … 771 790 ! 772 791 jpnij = jpni*jpnj 792 #endif 773 793 ! 774 794 END SUBROUTINE mpp_init_partition 775 795 776 796 SUBROUTINE get_divisors( kfax, kmaxfax, knfax, kn, kerr ) 797 !! 798 !! *** ROUTINE factorise *** 799 !! 800 !! ** Purpose : A O(sqrt(n)) program that prints all divisors 801 !! in sorted order 802 !! ** Method : 803 !! 804 INTEGER , INTENT(in ) :: kn, kmaxfax 805 INTEGER , INTENT( out) :: kerr, knfax 806 INTEGER, DIMENSION(kmaxfax), INTENT( out) :: kfax 807 ! 808 INTEGER :: ifac, jl, inu 809 kerr=0 810 inu = kn 811 knfax = 0 812 do ifac=1, sqrt(real(kn)) 813 if(mod(kn,ifac) == 0) then 814 IF( knfax+2 > kmaxfax ) THEN 815 kerr = 6 816 write (*,*) 'FACTOR: insufficient space in factor array ', knfax 817 return 818 ENDIF 819 knfax = knfax + 1 ! Add the factor to the list 820 kfax(knfax) = ifac 821 ! Store the other factor that goes with this one 822 knfax = knfax + 1 823 kfax(knfax) = kn/ifac 824 !WRITE (*,'(4(a,i))') 'ARPDBG, factors ',knfax1,' & ',knfax,' are ', kfax(knfax1),' and ',kfax(knfax) 825 endif 826 end do 827 END SUBROUTINE get_divisors 828 777 829 SUBROUTINE factorise( kfax, kmaxfax, knfax, kn, kerr ) 778 830 !!
Note: See TracChangeset
for help on using the changeset viewer.