LCOV - code coverage report
Current view: top level - src/elpa2 - elpa2_symm_matrix_allreduce_real_template.F90 (source / functions) Hit Total Coverage
Test: coverage_50ab7a7628bba174fc62cee3ab72b26e81f87fe5.info Lines: 23 23 100.0 %
Date: 2018-01-10 09:29:53 Functions: 2 2 100.0 %

          Line data    Source code
       1             : !    This file is part of ELPA.
       2             : !
       3             : !    The ELPA library was originally created by the ELPA consortium,
       4             : !    consisting of the following organizations:
       5             : !
       6             : !    - Max Planck Computing and Data Facility (MPCDF), formerly known as
       7             : !      Rechenzentrum Garching der Max-Planck-Gesellschaft (RZG),
       8             : !    - Bergische Universität Wuppertal, Lehrstuhl für angewandte
       9             : !      Informatik,
      10             : !    - Technische Universität München, Lehrstuhl für Informatik mit
      11             : !      Schwerpunkt Wissenschaftliches Rechnen ,
      12             : !    - Fritz-Haber-Institut, Berlin, Abt. Theorie,
      13             : !    - Max-Plack-Institut für Mathematik in den Naturwissenschaften,
      14             : !      Leipzig, Abt. Komplexe Strukutren in Biologie und Kognition,
      15             : !      and
      16             : !    - IBM Deutschland GmbH
      17             : !
      18             : !    This particular source code file contains additions, changes and
      19             : !    enhancements authored by Intel Corporation which is not part of
      20             : !    the ELPA consortium.
      21             : !
      22             : !    More information can be found here:
      23             : !    http://elpa.mpcdf.mpg.de/
      24             : !
      25             : !    ELPA is free software: you can redistribute it and/or modify
      26             : !    it under the terms of the version 3 of the license of the
      27             : !    GNU Lesser General Public License as published by the Free
      28             : !    Software Foundation.
      29             : !
      30             : !    ELPA is distributed in the hope that it will be useful,
      31             : !    but WITHOUT ANY WARRANTY; without even the implied warranty of
      32             : !    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      33             : !    GNU Lesser General Public License for more details.
      34             : !
      35             : !    You should have received a copy of the GNU Lesser General Public License
      36             : !    along with ELPA.  If not, see <http://www.gnu.org/licenses/>
      37             : !
      38             : !    ELPA reflects a substantial effort on the part of the original
      39             : !    ELPA consortium, and we ask you to respect the spirit of the
      40             : !    license that we chose: i.e., please contribute any changes you
      41             : !    may have back to the original ELPA library distribution, and keep
      42             : !    any derivatives of ELPA under the same license that we chose for
      43             : !    the original distribution, the GNU Lesser General Public License.
      44             : !
      45             : !
      46             : ! ELPA1 -- Faster replacements for ScaLAPACK symmetric eigenvalue routines
      47             : !
      48             : ! Copyright of the original code rests with the authors inside the ELPA
      49             : ! consortium. The copyright of any additional modifications shall rest
      50             : ! with their original authors, but shall adhere to the licensing terms
      51             : ! distributed along with the original code in the file "COPYING".
      52             : 
      53             : #include "../general/sanity.F90"
      54             : 
      55             :     subroutine symm_matrix_allreduce_&
      56      142560 : &PRECISION &
      57      142560 :                     (obj, n, a, lda, ldb, comm)
      58             :     !-------------------------------------------------------------------------------
      59             :     !  symm_matrix_allreduce: Does an mpi_allreduce for a symmetric matrix A.
      60             :     !  On entry, only the upper half of A needs to be set
      61             :     !  On exit, the complete matrix is set
      62             :     !-------------------------------------------------------------------------------
      63             :       use elpa_abstract_impl
      64             :       use precision
      65             :       implicit none
      66             :       class(elpa_abstract_impl_t), intent(inout) :: obj
      67             :       integer(kind=ik)             :: n, lda, ldb, comm
      68             : #ifdef USE_ASSUMED_SIZE
      69             :       real(kind=REAL_DATATYPE)     :: a(lda,*)
      70             : #else
      71             :       real(kind=REAL_DATATYPE)     :: a(lda,ldb)
      72             : #endif
      73             :       integer(kind=ik)             :: i, nc, mpierr
      74      285120 :       real(kind=REAL_DATATYPE)     :: h1(n*n), h2(n*n)
      75             : 
      76      142560 :       call obj%timer%start("symm_matrix_allreduce" // PRECISION_SUFFIX)
      77             : 
      78      142560 :       nc = 0
      79     6943104 :       do i=1,n
      80     6800544 :         h1(nc+1:nc+i) = a(1:i,i)
      81     6800544 :         nc = nc+i
      82             :       enddo
      83             : 
      84             : #ifdef WITH_MPI
      85       95040 :       call obj%timer%start("mpi_communication")
      86       95040 :       call mpi_allreduce(h1, h2, nc, MPI_REAL_PRECISION, MPI_SUM, comm, mpierr)
      87       95040 :       call obj%timer%stop("mpi_communication")
      88       95040 :       nc = 0
      89     4628736 :       do i=1,n
      90     4533696 :         a(1:i,i) = h2(nc+1:nc+i)
      91     4533696 :         a(i,1:i-1) = a(1:i-1,i)
      92     4533696 :         nc = nc+i
      93             :       enddo
      94             : 
      95             : #else /* WITH_MPI */
      96             : !      h2=h1
      97             : 
      98       47520 :       nc = 0
      99     2314368 :       do i=1,n
     100     2266848 :         a(1:i,i) = h1(nc+1:nc+i)
     101     2266848 :         a(i,1:i-1) = a(1:i-1,i)
     102     2266848 :         nc = nc+i
     103             :       enddo
     104             : 
     105             : #endif /* WITH_MPI */
     106             : !      nc = 0
     107             : !      do i=1,n
     108             : !        a(1:i,i) = h2(nc+1:nc+i)
     109             : !        a(i,1:i-1) = a(1:i-1,i)
     110             : !        nc = nc+i
     111             : !      enddo
     112             : 
     113      142560 :       call obj%timer%stop("symm_matrix_allreduce" // PRECISION_SUFFIX)
     114             : 
     115             :     end subroutine symm_matrix_allreduce_&
     116      142560 :     &PRECISION
     117             : 
     118             : 
     119             : 

Generated by: LCOV version 1.12