elpa2_print_kernels.F90 5.29 KB
Newer Older
Andreas Marek's avatar
Andreas Marek committed
1 2
!    This file is part of ELPA.
!
3
!    The ELPA library was originally created by the ELPA consortium,
Andreas Marek's avatar
Andreas Marek committed
4 5
!    consisting of the following organizations:
!
6 7
!    - Max Planck Computing and Data Facility (MPCDF), formerly known as
!      Rechenzentrum Garching der Max-Planck-Gesellschaft (RZG),
Andreas Marek's avatar
Andreas Marek committed
8 9 10
!    - Bergische Universität Wuppertal, Lehrstuhl für angewandte
!      Informatik,
!    - Technische Universität München, Lehrstuhl für Informatik mit
11 12
!      Schwerpunkt Wissenschaftliches Rechnen ,
!    - Fritz-Haber-Institut, Berlin, Abt. Theorie,
13
!    - Max-Plack-Institut für Mathematik in den Naturwissenschaften,
14 15
!      Leipzig, Abt. Komplexe Strukutren in Biologie und Kognition,
!      and
Andreas Marek's avatar
Andreas Marek committed
16 17 18 19
!    - IBM Deutschland GmbH
!
!
!    More information can be found here:
20
!    http://elpa.mpcdf.mpg.de/
Andreas Marek's avatar
Andreas Marek committed
21 22
!
!    ELPA is free software: you can redistribute it and/or modify
23 24
!    it under the terms of the version 3 of the license of the
!    GNU Lesser General Public License as published by the Free
Andreas Marek's avatar
Andreas Marek committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
!    Software Foundation.
!
!    ELPA is distributed in the hope that it will be useful,
!    but WITHOUT ANY WARRANTY; without even the implied warranty of
!    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!    GNU Lesser General Public License for more details.
!
!    You should have received a copy of the GNU Lesser General Public License
!    along with ELPA.  If not, see <http://www.gnu.org/licenses/>
!
!    ELPA reflects a substantial effort on the part of the original
!    ELPA consortium, and we ask you to respect the spirit of the
!    license that we chose: i.e., please contribute any changes you
!    may have back to the original ELPA library distribution, and keep
!    any derivatives of ELPA under the same license that we chose for
!    the original distribution, the GNU Lesser General Public License.
!
! ELPA2 -- 2-stage solver for ELPA
43
!
Andreas Marek's avatar
Andreas Marek committed
44 45 46 47
! Copyright of the original code rests with the authors inside the ELPA
! consortium. The copyright of any additional modifications shall rest
! with their original authors, but shall adhere to the licensing terms
! distributed along with the original code in the file "COPYING".
48 49
!
! This file was written by A. Marek, MPCDF
Andreas Marek's avatar
Andreas Marek committed
50 51

#include "config-f90.h"
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66

!> \file print_available_elpa2_kernels.F90
!> \par
!> \brief Provide information which ELPA2 kernels are available on this system
!>
!> \details
!> It is possible to configure ELPA2 such, that different compute intensive
!> "ELPA2 kernels" can be choosen at runtime.
!> The service binary print_available_elpa2_kernels will query the library and tell
!> whether ELPA2 has been configured in this way, and if this is the case which kernels can be
!> choosen at runtime.
!> It will furthermore detail whether ELPA has been configured with OpenMP support
!>
!> Synopsis: print_available_elpa2_kernels
!>
67
!> \author A. Marek (MPCDF)
Andreas Marek's avatar
Andreas Marek committed
68

69
program print_available_elpa2_kernels
70
   use elpa
71
   use, intrinsic :: iso_c_binding
72

Andreas Marek's avatar
Andreas Marek committed
73 74
   implicit none

75
   integer(kind=c_int) :: i
76
   class(elpa_t), pointer :: e
77
   integer :: option, error
78 79 80 81 82 83

   if (elpa_init(CURRENT_API_VERSION) /= ELPA_OK) then
     print *, "Unsupported ELPA API Version"
     stop 1
   endif

84
   e => elpa_allocate(error)
Andreas Marek's avatar
Andreas Marek committed
85 86 87 88 89 90 91 92 93 94 95

   print *, "This program will give information on the ELPA2 kernels, "
   print *, "which are available with this library and it will give "
   print *, "information if (and how) the kernels can be choosen at "
   print *, "runtime"
   print *
#ifdef WITH_OPENMP
   print *, " ELPA supports threads: yes"
#else
   print *, " ELPA supports threads: no"
#endif
96
   print *
Andreas Marek's avatar
Andreas Marek committed
97 98 99 100 101

   print *, "Information on ELPA2 real case: "
   print *, "=============================== "
#ifdef HAVE_ENVIRONMENT_CHECKING
   print *, " choice via environment variable: yes"
102
   print *, " environment variable name      : ELPA_DEFAULT_real_kernel"
Andreas Marek's avatar
Andreas Marek committed
103
#else
104
   print *, " choice via environment variable: no"
Andreas Marek's avatar
Andreas Marek committed
105 106 107 108
#endif
   print *
   print *, " Available real kernels are: "
   print *
109
   call print_options(e, "real_kernel")
Andreas Marek's avatar
Andreas Marek committed
110
   print *
111 112
   print *

Andreas Marek's avatar
Andreas Marek committed
113 114 115 116
   print *, "Information on ELPA2 complex case: "
   print *, "=============================== "
#ifdef HAVE_ENVIRONMENT_CHECKING
   print *, " choice via environment variable: yes"
117
   print *, " environment variable name      : ELPA_DEFAULT_complex_kernel"
Andreas Marek's avatar
Andreas Marek committed
118
#else
119
   print *,  " choice via environment variable: no"
Andreas Marek's avatar
Andreas Marek committed
120 121 122
#endif
   print *
   print *, " Available complex kernels are: "
123
   print *
124
   call print_options(e, "complex_kernel")
125 126 127
   print *
   print *

128
   call elpa_deallocate(e, error)
Andreas Marek's avatar
Andreas Marek committed
129

130 131
   contains

132
     subroutine print_options(e, KERNEL_KEY)
133
       class(elpa_t), intent(inout) :: e
134 135
       character(len=*), intent(in) :: KERNEL_KEY
       integer                      :: i, kernel,error
136

137 138 139 140
       call e%set("solver",ELPA_SOLVER_2STAGE,error)

       do i = 0, elpa_option_cardinality(KERNEL_KEY)
         kernel = elpa_option_enumerate(KERNEL_KEY, i)
141 142 143
         if (elpa_int_value_to_string(KERNEL_KEY, i) .eq. "ELPA_2STAGE_COMPLEX_GPU" .or. &
             elpa_int_value_to_string(KERNEL_KEY, i) .eq. "ELPA_2STAGE_REAL_GPU") then
           if (e%can_set("use_gpu",1) == ELPA_OK) then
144
             call e%set("use_gpu",1, error)
145 146 147
           endif
         endif 

148 149
         if (e%can_set(KERNEL_KEY, kernel) == ELPA_OK) then
           print *, "  ", elpa_int_value_to_string(KERNEL_KEY, kernel)
150 151 152 153
         endif
       end do
     end subroutine

Andreas Marek's avatar
Andreas Marek committed
154
end program print_available_elpa2_kernels