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 : #include "../../general/sanity.F90"
46 : use elpa
47 : use precision
48 : implicit none
49 :
50 : integer(kind=ik) :: na, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols
51 : #if REALCASE == 1
52 : #ifdef USE_ASSUMED_SIZE
53 : real(kind=REAL_DATATYPE) :: a(lda,*)
54 : #else
55 : real(kind=REAL_DATATYPE) :: a(lda,matrixCols)
56 : #endif
57 : #endif
58 : #if COMPLEXCASE == 1
59 : #ifdef USE_ASSUMED_SIZE
60 : complex(kind=COMPLEX_DATATYPE) :: a(lda,*)
61 : #else
62 : complex(kind=COMPLEX_DATATYPE) :: a(lda,matrixCols)
63 : #endif
64 : #endif
65 : logical, intent(in) :: wantDebug
66 : logical :: success
67 : integer(kind=ik) :: successInternal, error
68 :
69 : class(elpa_t), pointer :: e
70 :
71 : !call timer%start("elpa_cholesky_&
72 : !&MATH_DATATYPE&
73 : !&_&
74 : !&PRECISION&
75 : !&_legacy_interface")
76 :
77 2304 : success = .true.
78 :
79 2304 : if (elpa_init(CURRENT_API_VERSION) /= ELPA_OK) then
80 0 : print *, "ELPA API version not supported"
81 0 : success = .false.
82 0 : return
83 : endif
84 :
85 2304 : e => elpa_allocate()
86 :
87 2304 : call e%set("na", na, error)
88 2304 : if (error .ne. ELPA_OK) then
89 0 : print *,"Problem setting option. Aborting..."
90 0 : stop
91 : endif
92 2304 : call e%set("local_nrows", lda, error)
93 2304 : if (error .ne. ELPA_OK) then
94 0 : print *,"Problem setting option. Aborting..."
95 0 : stop
96 : endif
97 2304 : call e%set("local_ncols", matrixCols, error)
98 2304 : if (error .ne. ELPA_OK) then
99 0 : print *,"Problem setting option. Aborting..."
100 0 : stop
101 : endif
102 2304 : call e%set("nblk", nblk, error)
103 2304 : if (error .ne. ELPA_OK) then
104 0 : print *,"Problem setting option. Aborting..."
105 0 : stop
106 : endif
107 :
108 2304 : call e%set("mpi_comm_rows", mpi_comm_rows, error)
109 2304 : if (error .ne. ELPA_OK) then
110 0 : print *,"Problem setting option. Aborting..."
111 0 : stop
112 : endif
113 2304 : call e%set("mpi_comm_cols", mpi_comm_cols, error)
114 2304 : if (error .ne. ELPA_OK) then
115 0 : print *,"Problem setting option. Aborting..."
116 0 : stop
117 : endif
118 :
119 : !! the elpa object needs nev to be set (in case the EVP-solver is
120 : !! called later. Thus it is set by user, do nothing, otherwise,
121 : !! set it to na as default
122 : !if (e%is_set("nev")) .ne. 1) then
123 : ! call e%set("nev", na)
124 : !endif
125 :
126 2304 : if (e%setup() .ne. ELPA_OK) then
127 0 : print *, "Cannot setup ELPA instance"
128 0 : success = .false.
129 0 : return
130 : endif
131 :
132 2304 : if (wantDebug) then
133 2304 : call e%set("debug",1, error)
134 2304 : if (error .ne. ELPA_OK) then
135 0 : print *,"Problem setting option. Aborting..."
136 0 : stop
137 : endif
138 : endif
139 2304 : call e%cholesky(a(1:lda,1:matrixCols), successInternal)
140 :
141 2304 : if (successInternal .ne. ELPA_OK) then
142 0 : print *, "Cannot run cholesky"
143 0 : success = .false.
144 0 : return
145 : else
146 2304 : success =.true.
147 : endif
148 2304 : call elpa_deallocate(e)
149 :
150 2304 : call elpa_uninit()
151 :
152 : !call timer%stop("elpa_cholesky_&
153 : !&MATH_DATATYPE&
154 : !&_&
155 : !&PRECISION&
156 : !&_legacy_interface")
157 :
158 : #undef REALCASE
159 : #undef COMPLEXCASE
160 : #undef DOUBLE_PRECISION
161 : #undef SINGLE_PRECISION
162 :
163 : ! vim: syntax=fortran
|