elpa2_print_kernels.F90 5.12 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
78
79
80
81
82
83
84

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

   e => elpa_allocate()
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_2STAGE_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
#endif
   print *
   print *, " Available real kernels are: "
108
109
110
#ifdef HAVE_AVX2
   print *, " AVX kernels are optimized for FMA (AVX2)"
#endif
Andreas Marek's avatar
Andreas Marek committed
111
   print *
112
   call print_options(e, "real_kernel")
Andreas Marek's avatar
Andreas Marek committed
113
   print *
114
115
   print *

Andreas Marek's avatar
Andreas Marek committed
116
117
118
119
   print *, "Information on ELPA2 complex case: "
   print *, "=============================== "
#ifdef HAVE_ENVIRONMENT_CHECKING
   print *, " choice via environment variable: yes"
120
   print *, " environment variable name      : ELPA_2STAGE_COMPLEX_KERNEL"
Andreas Marek's avatar
Andreas Marek committed
121
#else
122
   print *,  " choice via environment variable: no"
Andreas Marek's avatar
Andreas Marek committed
123
124
125
#endif
   print *
   print *, " Available complex kernels are: "
126
127
128
#ifdef HAVE_AVX2
   print *, " AVX kernels are optimized for FMA (AVX2)"
#endif
129
   print *
130
   call print_options(e, "complex_kernel")
131
132
133
134
   print *
   print *

   call elpa_deallocate(e)
Andreas Marek's avatar
Andreas Marek committed
135

136
137
   contains

138
     subroutine print_options(e, KERNEL_KEY)
139
       class(elpa_t), intent(inout) :: e
140
141
       character(len=*), intent(in) :: KERNEL_KEY
       integer                      :: i, kernel,error
142

143
144
145
146
147
148
       call e%set("solver",ELPA_SOLVER_2STAGE,error)

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

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