elpa2_utilities.F90 16.9 KB
Newer Older
1 2 3 4 5
!    This file is part of ELPA.
!
!    The ELPA library was originally created by the ELPA consortium,
!    consisting of the following organizations:
!
6 7
!    - Max Planck Computing and Data Facility (MPCDF), formerly known as
!      Rechenzentrum Garching der Max-Planck-Gesellschaft (RZG),
8 9 10 11 12
!    - Bergische Universität Wuppertal, Lehrstuhl für angewandte
!      Informatik,
!    - Technische Universität München, Lehrstuhl für Informatik mit
!      Schwerpunkt Wissenschaftliches Rechnen ,
!    - Fritz-Haber-Institut, Berlin, Abt. Theorie,
13
!    - Max-Plack-Institut für Mathematik in den Naturwissenschaften,
14 15 16 17 18 19
!      Leipzig, Abt. Komplexe Strukutren in Biologie und Kognition,
!      and
!    - IBM Deutschland GmbH
!
!
!    More information can be found here:
20
!    http://elpa.mpcdf.mpg.de/
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
!
!    ELPA is free software: you can redistribute it and/or modify
!    it under the terms of the version 3 of the license of the
!    GNU Lesser General Public License as published by the Free
!    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
!
! 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".
49 50
!
! Author: Andreas Marek, MPCDF
51 52

#include "config-f90.h"
53
!> \brief Fortran module tp provide some variables for the LEGACY interface. This is obsolete, please use the new interface
54
module elpa2_utilities
55
  use elpa
56
  implicit none
57
  public
58

Andreas Marek's avatar
Andreas Marek committed
59
  integer(kind=c_int), parameter :: number_of_real_kernels = ELPA_2STAGE_NUMBER_OF_REAL_KERNELS - 7
60
  integer(kind=c_int), parameter :: number_of_complex_kernels = ELPA_2STAGE_NUMBER_OF_COMPLEX_KERNELS
61

62
#ifdef WITH_REAL_GENERIC_KERNEL
63
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_GENERIC = ELPA_2STAGE_REAL_GENERIC
64
#endif
65
#ifdef WITH_REAL_GENERIC_SIMPLE_KERNEL
66
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_GENERIC_SIMPLE = ELPA_2STAGE_REAL_GENERIC_SIMPLE
67
#endif
68
#ifdef WITH_REAL_BGP_KERNEL
69
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_BGP = ELPA_2STAGE_REAL_BGP
70
#endif
71
#ifdef WITH_REAL_BGQ_KERNEL
72
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_BGQ = ELPA_2STAGE_REAL_BGQ
73
#endif
74
#ifdef WITH_REAL_SSE_ASSEMBLY_KERNEL
75
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_SSE = ELPA_2STAGE_REAL_SSE_ASSEMBLY
76
#endif
77
#ifdef WITH_REAL_SSE_BLOCK2_KERNEL
78
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_SSE_BLOCK2 = ELPA_2STAGE_REAL_SSE_BLOCK2
79
#endif
80
#ifdef WITH_REAL_SSE_BLOCK4_KERNEL
81
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_SSE_BLOCK4 = ELPA_2STAGE_REAL_SSE_BLOCK4
82
#endif
83
#ifdef WITH_REAL_SSE_BLOCK6_KERNEL
84
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_SSE_BLOCK6 = ELPA_2STAGE_REAL_SSE_BLOCK6
85
#endif
86
#ifdef WITH_REAL_AVX_BLOCK2_KERNEL
87
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_AVX_BLOCK2 = ELPA_2STAGE_REAL_AVX_BLOCK2
88
#endif
89
#ifdef WITH_REAL_AVX_BLOCK4_KERNEL
90
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_AVX_BLOCK4 = ELPA_2STAGE_REAL_AVX_BLOCK4
91
#endif
92
#ifdef WITH_REAL_AVX_BLOCK6_KERNEL
93
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_AVX_BLOCK6 = ELPA_2STAGE_REAL_AVX_BLOCK6
94
#endif
95
#ifdef WITH_REAL_AVX2_BLOCK2_KERNEL
96
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_AVX2_BLOCK2 = ELPA_2STAGE_REAL_AVX2_BLOCK2
97
#endif
98
#ifdef WITH_REAL_AVX2_BLOCK4_KERNEL
99
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_AVX2_BLOCK4 = ELPA_2STAGE_REAL_AVX2_BLOCK4
100
#endif
101
#ifdef WITH_REAL_AVX2_BLOCK6_KERNEL
102
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_AVX2_BLOCK6 = ELPA_2STAGE_REAL_AVX2_BLOCK6
103
#endif
104
#ifdef WITH_REAL_AVX512_BLOCK2_KERNEL
105
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_AVX512_BLOCK2 = ELPA_2STAGE_REAL_AVX512_BLOCK2
106
#endif
107
#ifdef WITH_REAL_AVX512_BLOCK4_KERNEL
108
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_AVX512_BLOCK4 = ELPA_2STAGE_REAL_AVX512_BLOCK4
109
#endif
110
#ifdef WITH_REAL_AVX512_BLOCK6_KERNEL
111
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_AVX512_BLOCK6 = ELPA_2STAGE_REAL_AVX512_BLOCK6
112
#endif
113
#ifdef WITH_GPU_KERNEL
114
  integer(kind=c_int), parameter :: REAL_ELPA_KERNEL_GPU = ELPA_2STAGE_REAL_GPU
115
#endif
116

117
  integer(kind=c_int), parameter :: DEFAULT_REAL_ELPA_KERNEL = ELPA_2STAGE_REAL_DEFAULT
118

119
#ifdef WITH_COMPLEX_GENERIC_KERNEL
120
  integer(kind=c_int), parameter :: COMPLEX_ELPA_KERNEL_GENERIC = ELPA_2STAGE_COMPLEX_GENERIC
121
#endif
122
#ifdef WITH_COMPLEX_GENERIC_SIMPLE_KERNEL
123
  integer(kind=c_int), parameter :: COMPLEX_ELPA_KERNEL_GENERIC_SIMPLE = ELPA_2STAGE_COMPLEX_GENERIC_SIMPLE
124
#endif
125
#ifdef WITH_COMPLEX_BGP_KERNEL
126
  integer(kind=c_int), parameter :: COMPLEX_ELPA_KERNEL_BGP = ELPA_2STAGE_COMPLEX_BGP
127
#endif
128
#ifdef WITH_COMPLEX_BGQ_KERNEL
129
  integer(kind=c_int), parameter :: COMPLEX_ELPA_KERNEL_BGQ = ELPA_2STAGE_COMPLEX_BGQ
130
#endif
131
#ifdef WITH_COMPLEX_SSE_ASSEMBLY_KERNEL
132
  integer(kind=c_int), parameter :: COMPLEX_ELPA_KERNEL_SSE = ELPA_2STAGE_COMPLEX_SSE_ASSEMBLY
133
#endif
134
#ifdef WITH_COMPLEX_SSE_BLOCK1_KERNEL
135
  integer(kind=c_int), parameter :: COMPLEX_ELPA_KERNEL_SSE_BLOCK1 = ELPA_2STAGE_COMPLEX_SSE_BLOCK1
136
#endif
137
#ifdef WITH_COMPLEX_SSE_BLOCK2_KERNEL
138
  integer(kind=c_int), parameter :: COMPLEX_ELPA_KERNEL_SSE_BLOCK2 = ELPA_2STAGE_COMPLEX_SSE_BLOCK2
139
#endif
140
#ifdef WITH_COMPLEX_AVX_BLOCK1_KERNEL
141
  integer(kind=c_int), parameter :: COMPLEX_ELPA_KERNEL_AVX_BLOCK1 = ELPA_2STAGE_COMPLEX_AVX_BLOCK1
142
#endif
143
#ifdef WITH_COMPLEX_AVX_BLOCK2_KERNEL
144
  integer(kind=c_int), parameter :: COMPLEX_ELPA_KERNEL_AVX_BLOCK2 = ELPA_2STAGE_COMPLEX_AVX_BLOCK2
145
#endif
146
#ifdef WITH_COMPLEX_AVX2_BLOCK1_KERNEL
147
  integer(kind=c_int), parameter :: COMPLEX_ELPA_KERNEL_AVX2_BLOCK1 = ELPA_2STAGE_COMPLEX_AVX2_BLOCK1
148
#endif
149
#ifdef WITH_COMPLEX_AVX2_BLOCK2_KERNEL
150
  integer(kind=c_int), parameter :: COMPLEX_ELPA_KERNEL_AVX2_BLOCK2 = ELPA_2STAGE_COMPLEX_AVX2_BLOCK2
151
#endif
152
#ifdef WITH_COMPLEX_AVX512_BLOCK1_KERNEL
153
  integer(kind=c_int), parameter :: COMPLEX_ELPA_KERNEL_AVX512_BLOCK1 = ELPA_2STAGE_COMPLEX_AVX512_BLOCK1
154
#endif
155
#ifdef WITH_COMPLEX_AVX512_BLOCK2_KERNEL
156
  integer(kind=c_int), parameter :: COMPLEX_ELPA_KERNEL_AVX512_BLOCK2 = ELPA_2STAGE_COMPLEX_AVX512_BLOCK2
157
#endif
158
#ifdef WITH_GPU_KERNEL
159
  integer(kind=c_int), parameter :: COMPLEX_ELPA_KERNEL_GPU = ELPA_2STAGE_COMPLEX_GPU
160
#endif
161

162
  integer(kind=c_int), parameter :: DEFAULT_COMPLEX_ELPA_KERNEL = ELPA_2STAGE_COMPLEX_DEFAULT
163

164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
  character(35), parameter, dimension(number_of_real_kernels) :: &
  REAL_ELPA_KERNEL_NAMES =    (/"REAL_ELPA_KERNEL_GENERIC           ", &
                                "REAL_ELPA_KERNEL_GENERIC_SIMPLE    ", &
                                "REAL_ELPA_KERNEL_BGP               ", &
                                "REAL_ELPA_KERNEL_BGQ               ", &
                                "REAL_ELPA_KERNEL_SSE               ", &
                                "REAL_ELPA_KERNEL_SSE_BLOCK2        ", &
                                "REAL_ELPA_KERNEL_SSE_BLOCK4        ", &
                                "REAL_ELPA_KERNEL_SSE_BLOCK6        ", &
                                "REAL_ELPA_KERNEL_AVX_BLOCK2        ", &
                                "REAL_ELPA_KERNEL_AVX_BLOCK4        ", &
                                "REAL_ELPA_KERNEL_AVX_BLOCK6        ", &
                                "REAL_ELPA_KERNEL_AVX2_BLOCK2       ", &
                                "REAL_ELPA_KERNEL_AVX2_BLOCK4       ", &
                                "REAL_ELPA_KERNEL_AVX2_BLOCK6       ", &
                                "REAL_ELPA_KERNEL_AVX512_BLOCK2     ", &
                                "REAL_ELPA_KERNEL_AVX512_BLOCK4     ", &
                                "REAL_ELPA_KERNEL_AVX512_BLOCK6     ", &
                                "REAL_ELPA_KERNEL_GPU               "/)

  character(35), parameter, dimension(number_of_complex_kernels) :: &
  COMPLEX_ELPA_KERNEL_NAMES = (/"COMPLEX_ELPA_KERNEL_GENERIC        ", &
                                "COMPLEX_ELPA_KERNEL_GENERIC_SIMPLE ", &
                                "COMPLEX_ELPA_KERNEL_BGP            ", &
                                "COMPLEX_ELPA_KERNEL_BGQ            ", &
                                "COMPLEX_ELPA_KERNEL_SSE            ", &
                                "COMPLEX_ELPA_KERNEL_SSE_BLOCK1     ", &
                                "COMPLEX_ELPA_KERNEL_SSE_BLOCK2     ", &
                                "COMPLEX_ELPA_KERNEL_AVX_BLOCK1     ", &
                                "COMPLEX_ELPA_KERNEL_AVX_BLOCK2     ", &
                                "COMPLEX_ELPA_KERNEL_AVX2_BLOCK1    ", &
                                "COMPLEX_ELPA_KERNEL_AVX2_BLOCK2    ", &
                                "COMPLEX_ELPA_KERNEL_AVX512_BLOCK1  ", &
                                "COMPLEX_ELPA_KERNEL_AVX512_BLOCK2  ", &
                                "COMPLEX_ELPA_KERNEL_GPU            "/)

200
  integer(kind=c_int), parameter                           ::             &
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
           AVAILABLE_REAL_ELPA_KERNELS(number_of_real_kernels) =       &
                                      (/                               &
#if WITH_REAL_GENERIC_KERNEL
                                        1                              &
#else
                                        0                              &
#endif
#if WITH_REAL_GENERIC_SIMPLE_KERNEL
                                          ,1                           &
#else
                                          ,0                           &
#endif
#if WITH_REAL_BGP_KERNEL
                                            ,1                         &
#else
                                            ,0                         &
#endif
#if WITH_REAL_BGQ_KERNEL
                                              ,1                       &
#else
                                              ,0                       &
#endif
#if WITH_REAL_SSE_ASSEMBLY_KERNEL
                                                ,1                     &
#else
                                                ,0                     &
#endif
#if WITH_REAL_SSE_BLOCK2_KERNEL
                                                  ,1                   &
#else
                                                  ,0                   &
#endif
#if WITH_REAL_SSE_BLOCK4_KERNEL
                                                    ,1                 &
#else
                                                    ,0                 &
#endif
#if WITH_REAL_SSE_BLOCK6_KERNEL
                                                      ,1               &
#else
                                                      ,0               &

#endif
#if WITH_REAL_AVX_BLOCK2_KERNEL
                                                        ,1             &
#else
                                                        ,0             &
#endif
#if WITH_REAL_AVX_BLOCK4_KERNEL
                                                          ,1           &
#else
                                                          ,0           &
#endif
#if WITH_REAL_AVX_BLOCK6_KERNEL
                                                            ,1         &
#else
                                                            ,0         &
#endif
#if WITH_REAL_AVX2_BLOCK2_KERNEL
                                                              ,1       &
#else
                                                              ,0       &
#endif
#if WITH_REAL_AVX2_BLOCK4_KERNEL
                                                               ,1      &
#else
                                                               ,0      &
#endif
#if WITH_REAL_AVX2_BLOCK6_KERNEL
                                                               ,1      &
#else
                                                               ,0      &
#endif
#if WITH_REAL_AVX512_BLOCK2_KERNEL
                                                                 ,1    &
#else
                                                                 ,0    &
#endif
#if WITH_REAL_AVX512_BLOCK4_KERNEL
                                                                   ,1  &
#else
                                                                   ,0  &
#endif
#if WITH_REAL_AVX512_BLOCK6_KERNEL
                                                                     ,1  &
#else
                                                                     ,0  &
#endif

#ifdef WITH_GPU_VERSION
                                                                       ,1    &
#else
                                                                       ,0    &
#endif
                                                       /)

297
  integer(kind=c_int), parameter ::                                          &
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372
           AVAILABLE_COMPLEX_ELPA_KERNELS(number_of_complex_kernels) =    &
                                      (/                                  &
#if WITH_COMPLEX_GENERIC_KERNEL
                                        1                                 &
#else
                                        0                                 &
#endif
#if WITH_COMPLEX_GENERIC_SIMPLE_KERNEL
                                          ,1                              &
#else
                                          ,0                              &
#endif
#if WITH_COMPLEX_BGP_KERNEL
                                            ,1                            &
#else
                                            ,0                            &
#endif
#if WITH_COMPLEX_BGQ_KERNEL
                                              ,1                          &
#else
                                              ,0                          &
#endif
#if WITH_COMPLEX_SSE_ASSEMBLY_KERNEL
                                                ,1                        &
#else
                                                ,0                        &
#endif
#if WITH_COMPLEX_SSE_BLOCK1_KERNEL
                                                  ,1                      &
#else
                                                  ,0                      &
#endif
#if WITH_COMPLEX_SSE_BLOCK2_KERNEL
                                                    ,1                    &
#else
                                                    ,0                    &
#endif
#if WITH_COMPLEX_AVX_BLOCK1_KERNEL
                                                      ,1                  &
#else
                                                      ,0                  &
#endif
#if WITH_COMPLEX_AVX_BLOCK2_KERNEL
                                                        ,1                &
#else
                                                        ,0                &
#endif
#if WITH_COMPLEX_AVX2_BLOCK1_KERNEL
                                                         ,1               &
#else
                                                         ,0               &
#endif
#if WITH_COMPLEX_AVX2_BLOCK2_KERNEL
                                                           ,1             &
#else
                                                           ,0             &
#endif
#if WITH_COMPLEX_AVX512_BLOCK1_KERNEL
                                                             ,1               &
#else
                                                             ,0               &
#endif
#if WITH_COMPLEX_AVX512_BLOCK2_KERNEL
                                                               ,1             &
#else
                                                               ,0             &
#endif

#ifdef WITH_GPU_VERSION
                                                                 ,1           &
#else
                                                                 ,0           &
#endif
                                                               /)

373 374

  contains
375

376

377
   function elpa_real_kernel_name(THIS_ELPA_REAL_KERNEL) result(name)
378 379 380 381 382
      implicit none

      integer, intent(in) :: THIS_ELPA_REAL_KERNEL
      character(35)        :: name

383

384 385 386 387 388 389
      if (AVAILABLE_REAL_ELPA_KERNELS(THIS_ELPA_REAL_KERNEL) .eq. 1) then
        name = trim(REAL_ELPA_KERNEL_NAMES(THIS_ELPA_REAL_KERNEL))
      else
        name = ""
      endif
      return
390

391
    end function
392 393

   function elpa_complex_kernel_name(THIS_ELPA_COMPLEX_KERNEL) result(name)
394 395 396 397 398 399 400 401 402 403 404 405 406
      implicit none

      integer, intent(in) :: THIS_ELPA_COMPLEX_KERNEL
      character(35)       :: name


      if (AVAILABLE_COMPLEX_ELPA_KERNELS(THIS_ELPA_COMPLEX_KERNEL) .eq. 1) then
        name = trim(COMPLEX_ELPA_KERNEL_NAMES(THIS_ELPA_COMPLEX_KERNEL))
      else
        name = ""
      endif

      return
407 408 409

    end function

410
end module elpa2_utilities