LCOV - code coverage report
Current view: top level - test/shared - test_setup_mpi.F90 (source / functions) Hit Total Coverage
Test: coverage_50ab7a7628bba174fc62cee3ab72b26e81f87fe5.info Lines: 11 17 64.7 %
Date: 2018-01-10 09:29:53 Functions: 1 1 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             : !
      19             : !    More information can be found here:
      20             : !    http://elpa.mpcdf.mpg.de/
      21             : !
      22             : !    ELPA is free software: you can redistribute it and/or modify
      23             : !    it under the terms of the version 3 of the license of the
      24             : !    GNU Lesser General Public License as published by the Free
      25             : !    Software Foundation.
      26             : !
      27             : !    ELPA is distributed in the hope that it will be useful,
      28             : !    but WITHOUT ANY WARRANTY; without even the implied warranty of
      29             : !    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      30             : !    GNU Lesser General Public License for more details.
      31             : !
      32             : !    You should have received a copy of the GNU Lesser General Public License
      33             : !    along with ELPA.  If not, see <http://www.gnu.org/licenses/>
      34             : !
      35             : !    ELPA reflects a substantial effort on the part of the original
      36             : !    ELPA consortium, and we ask you to respect the spirit of the
      37             : !    license that we chose: i.e., please contribute any changes you
      38             : !    may have back to the original ELPA library distribution, and keep
      39             : !    any derivatives of ELPA under the same license that we chose for
      40             : !    the original distribution, the GNU Lesser General Public License.
      41             : !
      42             : !
      43             : #include "config-f90.h"
      44             : module test_setup_mpi
      45             : 
      46             :   contains
      47             : 
      48       15744 :     subroutine setup_mpi(myid, nprocs)
      49             :       use test_util
      50             :       use ELPA_utilities
      51             :       implicit none
      52             : 
      53             :       integer(kind=ik)              :: mpierr
      54             : 
      55             :       integer(kind=ik), intent(out) :: myid, nprocs
      56             : #ifdef WITH_OPENMP
      57             :       integer(kind=ik)              :: required_mpi_thread_level, &
      58             :                                        provided_mpi_thread_level
      59             : #endif
      60             : 
      61             : 
      62             : #ifdef WITH_MPI
      63             : 
      64             : #ifndef WITH_OPENMP
      65        5312 :       call mpi_init(mpierr)
      66             : #else
      67        5312 :       required_mpi_thread_level = MPI_THREAD_MULTIPLE
      68             : 
      69             :       call mpi_init_thread(required_mpi_thread_level,     &
      70        5312 :                            provided_mpi_thread_level, mpierr)
      71             : 
      72        5312 :       if (required_mpi_thread_level .ne. provided_mpi_thread_level) then
      73           0 :         write(error_unit,*) "MPI ERROR: MPI_THREAD_MULTIPLE is not provided on this system"
      74           0 :         write(error_unit,*) "           only ", mpi_thread_level_name(provided_mpi_thread_level), " is available"
      75           0 :         call MPI_FINALIZE(mpierr)
      76           0 :         call exit(77)
      77             :       endif
      78             : #endif
      79       10624 :       call mpi_comm_rank(mpi_comm_world,myid,mpierr)
      80       10624 :       call mpi_comm_size(mpi_comm_world,nprocs,mpierr)
      81             : 
      82       10624 :       if (nprocs <= 1) then
      83           0 :         print *, "The test programs must be run with more than 1 task to ensure that usage with MPI is actually tested"
      84           0 :         stop 1
      85             :       endif
      86             : #else
      87        5120 :       myid = 0
      88        5120 :       nprocs = 1
      89             : #endif
      90             : 
      91       15744 :     end subroutine
      92             : 
      93             : 
      94             : end module

Generated by: LCOV version 1.12