elpa_solve_tridi.X90 4.26 KB
Newer Older
Andreas Marek's avatar
Andreas Marek committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
49
50
51
52
53
54
55
56
!    This file is part of ELPA.
!
!    The ELPA library was originally created by the ELPA consortium,
!    consisting of the following organizations:
!
!    - Max Planck Computing and Data Facility (MPCDF), formerly known as
!      Rechenzentrum Garching der Max-Planck-Gesellschaft (RZG),
!    - 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,
!    - Max-Plack-Institut für Mathematik in den Naturwissenschaften,
!      Leipzig, Abt. Komplexe Strukutren in Biologie und Kognition,
!      and
!    - IBM Deutschland GmbH
!
!    This particular source code file contains additions, changes and
!    enhancements authored by Intel Corporation which is not part of
!    the ELPA consortium.
!
!    More information can be found here:
!    http://elpa.mpcdf.mpg.de/
!
!    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.
!
!
! ELPA1 -- Faster replacements for ScaLAPACK symmetric eigenvalue routines
!
! 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".
!
! Author: A. Marek, MPCDF



57
#include "../../general/sanity.X90"
58
59

      use precision
60
61
62
      use elpa1_auxiliary_impl, only : elpa_solve_tridi_&
      &PRECISION&
      &_impl
63
      use elpa
64
      use elpa_abstract_impl
65
      implicit none
66
67
      integer(kind=ik)            :: na, nev, ldq, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols
      real(kind=REAL_DATATYPE)    :: d(na), e(na)
68
#ifdef USE_ASSUMED_SIZE
69
      real(kind=REAL_DATATYPE)    :: q(ldq,*)
70
#else
71
      real(kind=REAL_DATATYPE)    :: q(ldq,matrixCols)
72
#endif
73

74
      logical, intent(in)         :: wantDebug
75
76
      logical                     :: success ! the return value
      integer                     :: error
77
      class(elpa_t), pointer      :: obj
78

79
80
81
      !call timer%start("elpa_solve_tridi_&
      !&PRECISION&
      !&_legacy_interface")
82
83
84

      success = .false.

85
      if (elpa_init(CURRENT_API_VERSION) /= ELPA_OK) then
Pavel Kus's avatar
Pavel Kus committed
86
        print *, "ELPA API version not supported"
87
88
89
        success = .false.
      endif

90
      obj => elpa_allocate()
91

92
93
94
95
96
      call obj%set("na", na)
      call obj%set("nev", nev)
      call obj%set("local_nrows", ldq)
      call obj%set("local_ncols", matrixCols)
      call obj%set("nblk", nblk)
97

98
99
      call obj%set("mpi_comm_rows", mpi_comm_rows)
      call obj%set("mpi_comm_cols", mpi_comm_cols)
100

101
      if (obj%setup() .ne. ELPA_OK) then
102
        print *, "Cannot setup ELPA instance"
103
104
105
106
        success = .false.
        return
      endif

107
108
109
      if (wantDebug) then
        call obj%set("debug",1)
      endif
110

111
112
113
114
115
116
117
118
      call obj%solve_tridiagonal(d, e, q(1:ldq,1:matrixCols), error)
      if (error /= ELPA_OK) then
        print *, "Cannot run solve_tridi"
        success = .false.
        return
      else
        success = .true.
      endif
119

120
      call elpa_deallocate(obj)
121
122
      call elpa_uninit()

123
124
125
     !call timer%stop("elpa_solve_tridi_&
     !&PRECISION&
     !&_legacy_interface")
126
127
128
129
130
131

#undef REALCASE
#undef COMPLEXCASE
#undef DOUBLE_PRECISION
#undef SINGLE_PRECISION

132
! vim: syntax=fortran