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 : ! This particular source code file contains additions, changes and
19 : ! enhancements authored by Intel Corporation which is not part of
20 : ! the ELPA consortium.
21 : !
22 : ! More information can be found here:
23 : ! http://elpa.mpcdf.mpg.de/
24 : !
25 : ! ELPA is free software: you can redistribute it and/or modify
26 : ! it under the terms of the version 3 of the license of the
27 : ! GNU Lesser General Public License as published by the Free
28 : ! Software Foundation.
29 : !
30 : ! ELPA is distributed in the hope that it will be useful,
31 : ! but WITHOUT ANY WARRANTY; without even the implied warranty of
32 : ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 : ! GNU Lesser General Public License for more details.
34 : !
35 : ! You should have received a copy of the GNU Lesser General Public License
36 : ! along with ELPA. If not, see <http://www.gnu.org/licenses/>
37 : !
38 : ! ELPA reflects a substantial effort on the part of the original
39 : ! ELPA consortium, and we ask you to respect the spirit of the
40 : ! license that we chose: i.e., please contribute any changes you
41 : ! may have back to the original ELPA library distribution, and keep
42 : ! any derivatives of ELPA under the same license that we chose for
43 : ! the original distribution, the GNU Lesser General Public License.
44 : !
45 : !
46 : ! ELPA1 -- Faster replacements for ScaLAPACK symmetric eigenvalue routines
47 : !
48 : ! Copyright of the original code rests with the authors inside the ELPA
49 : ! consortium. The copyright of any additional modifications shall rest
50 : ! with their original authors, but shall adhere to the licensing terms
51 : ! distributed along with the original code in the file "COPYING".
52 :
53 : #include "../../general/sanity.F90"
54 :
55 : use precision
56 : use elpa
57 : ! use elpa1_compute
58 : ! use elpa_utilities
59 : use elpa_mpi
60 : implicit none
61 :
62 : integer(kind=ik) :: na, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols
63 : #if REALCASE == 1
64 : #ifdef USE_ASSUMED_SIZE
65 : real(kind=REAL_DATATYPE) :: a(lda,*)
66 : #else
67 : real(kind=REAL_DATATYPE) :: a(lda,matrixCols)
68 : #endif
69 : #endif
70 :
71 : #if COMPLEXCASE == 1
72 : #ifdef USE_ASSUMED_SIZE
73 : complex(kind=COMPLEX_DATATYPE) :: a(lda,*)
74 : #else
75 : complex(kind=COMPLEX_DATATYPE) :: a(lda,matrixCols)
76 : #endif
77 : #endif
78 :
79 : ! integer(kind=ik) :: my_prow, my_pcol, np_rows, np_cols, mpierr
80 : ! integer(kind=ik) :: l_cols, l_rows, l_col1, l_row1, l_colx, l_rowx
81 : ! integer(kind=ik) :: n, nc, i, info, ns, nb
82 : !#if REALCASE == 1
83 : ! real(kind=REAL_DATATYPE), allocatable :: tmp1(:), tmp2(:,:), tmat1(:,:), tmat2(:,:)
84 : !#endif
85 : !#if COMPLEXCASE == 1
86 : ! complex(kind=COMPLEX_DATATYPE), allocatable :: tmp1(:), tmp2(:,:), tmat1(:,:), tmat2(:,:)
87 : !#endif
88 : logical, intent(in) :: wantDebug
89 : logical :: success
90 :
91 : integer(kind=iK) :: successInternal, error
92 : class(elpa_t), pointer :: e
93 :
94 : !call timer%start("elpa_invert_trm_&
95 : !&MATH_DATATYPE&
96 : !&_&
97 : !&PRECISION&
98 : !&_legacy_interface")
99 :
100 1152 : success = .true.
101 :
102 1152 : if (elpa_init(CURRENT_API_VERSION) /= ELPA_OK) then
103 0 : print *, "ELPA API version not supported"
104 0 : success = .false.
105 0 : return
106 : endif
107 :
108 1152 : e => elpa_allocate()
109 :
110 1152 : call e%set("na", na, error)
111 1152 : if (error .ne. ELPA_OK) then
112 0 : print *,"Problem setting option. Aborting..."
113 0 : stop
114 : endif
115 1152 : call e%set("local_nrows", lda, error)
116 1152 : if (error .ne. ELPA_OK) then
117 0 : print *,"Problem setting option. Aborting..."
118 0 : stop
119 : endif
120 1152 : call e%set("local_ncols", matrixCols, error)
121 1152 : if (error .ne. ELPA_OK) then
122 0 : print *,"Problem setting option. Aborting..."
123 0 : stop
124 : endif
125 1152 : call e%set("nblk", nblk, error)
126 1152 : if (error .ne. ELPA_OK) then
127 0 : print *,"Problem setting option. Aborting..."
128 0 : stop
129 : endif
130 :
131 1152 : call e%set("mpi_comm_rows", mpi_comm_rows, error)
132 1152 : if (error .ne. ELPA_OK) then
133 0 : print *,"Problem setting option. Aborting..."
134 0 : stop
135 : endif
136 1152 : call e%set("mpi_comm_cols", mpi_comm_cols, error)
137 1152 : if (error .ne. ELPA_OK) then
138 0 : print *,"Problem setting option. Aborting..."
139 0 : stop
140 : endif
141 :
142 1152 : if (e%setup() .ne. ELPA_OK) then
143 0 : print *, "Cannot setup ELPA instance"
144 0 : success = .false.
145 0 : return
146 : endif
147 :
148 1152 : if (wantDebug) then
149 1152 : call e%set("debug",1, error)
150 1152 : if (error .ne. ELPA_OK) then
151 0 : print *,"Problem setting option. Aborting..."
152 0 : stop
153 : endif
154 : endif
155 :
156 1152 : call e%invert_triangular(a(1:lda,1:matrixCols), successInternal)
157 :
158 1152 : if (successInternal .ne. ELPA_OK) then
159 0 : print *, "Cannot run invert_trm"
160 0 : success = .false.
161 0 : return
162 : else
163 1152 : success =.true.
164 : endif
165 1152 : call elpa_deallocate(e)
166 :
167 1152 : call elpa_uninit()
168 :
169 : !call timer%stop("elpa_invert_trm_&
170 : !&MATH_DATATYPE&
171 : !&_&
172 : !&PRECISION&
173 : !&_legacy_interface")
174 :
175 : #undef REALCASE
176 : #undef COMPLEXCASE
177 : #undef DOUBLE_PRECISION
178 : #undef SINGLE_PRECISION
|