elpa_invert_trm.X90 4.9 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
!    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".

53
#include "../sanity.X90"
Andreas Marek's avatar
Andreas Marek committed
54
55

       use precision
56
57
58
       use elpa_type
!       use elpa1_compute
!       use elpa_utilities
Andreas Marek's avatar
Andreas Marek committed
59
60
61
62
63
64
65
66
67
68
       use elpa_mpi
#ifdef HAVE_DETAILED_TIMINGS
       use timings
#else
       use timings_dummy
#endif
       implicit none

       integer(kind=ik)             :: na, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols
#if  REALCASE ==  1
69
70
71
!#ifdef USE_ASSUMED_SIZE
!       real(kind=REAL_DATATYPE)     :: a(lda,*)
!#else
Andreas Marek's avatar
Andreas Marek committed
72
       real(kind=REAL_DATATYPE)     :: a(lda,matrixCols)
73
!#endif
Andreas Marek's avatar
Andreas Marek committed
74
75
76
#endif

#if COMPLEXCASE == 1
77
78
79
!#ifdef USE_ASSUMED_SIZE
!       complex(kind=COMPLEX_DATATYPE)   :: a(lda,*)
!#else
Andreas Marek's avatar
Andreas Marek committed
80
       complex(kind=COMPLEX_DATATYPE)   :: a(lda,matrixCols)
81
82
83
84
85
86
87
88
89
90
91
92
!#endif
#endif

 !      integer(kind=ik)             :: my_prow, my_pcol, np_rows, np_cols, mpierr
 !      integer(kind=ik)             :: l_cols, l_rows, l_col1, l_row1, l_colx, l_rowx
 !      integer(kind=ik)             :: n, nc, i, info, ns, nb
!#if REALCASE ==  1
!       real(kind=REAL_DATATYPE), allocatable   :: tmp1(:), tmp2(:,:), tmat1(:,:), tmat2(:,:)
!#endif
!#if COMPLEXCASE == 1
!       complex(kind=COMPLEX_DATATYPE), allocatable    :: tmp1(:), tmp2(:,:), tmat1(:,:), tmat2(:,:)
!#endif
Andreas Marek's avatar
Andreas Marek committed
93
94
       logical, intent(in)          :: wantDebug
       logical                      :: success
95
96
 !      integer(kind=ik)             :: istat
 !      character(200)               :: errorMessage
Andreas Marek's avatar
Andreas Marek committed
97

98
99
100
       integer(kind=ik)            :: nev
       integer(kind=iK)            :: successInternal
       type(elpa_t)                :: elpaAPI
Andreas Marek's avatar
Andreas Marek committed
101

102
103
104
105
106
       call timer%start("elpa_invert_trm_&
       &MATH_DATATYPE&
       &_&
       &PRECISION &
       ")
Andreas Marek's avatar
Andreas Marek committed
107

108
       success = .true.
Andreas Marek's avatar
Andreas Marek committed
109

110
111
112
       if (elpa_init(20170403) /= ELPA_OK) then
         success = .false.
         error stop "ELPA API version not supported"
Andreas Marek's avatar
Andreas Marek committed
113
114
       endif

115
116
117
118
119
120
121
       nev = 10
       elpaAPI = elpa_create(na, nev, lda, matrixCols, nblk, successInternal)
       if (successInternal .ne. ELPA_OK) then
         print *, "Cannot create elpa object"
         success = .false.
         stop
         return
Andreas Marek's avatar
Andreas Marek committed
122
123
       endif

124
125
       call elpaAPI%set_comm_rows(mpi_comm_rows)
       call elpaAPI%set_comm_cols(mpi_comm_cols)
Andreas Marek's avatar
Andreas Marek committed
126

127
       call elpaAPI%invert_trm(a, successInternal)
Andreas Marek's avatar
Andreas Marek committed
128

129
130
131
132
133
134
135
136
137
       if (successInternal .ne. ELPA_OK) then
         print *, "Cannot run cholesky"
         stop
         success = .false.
         return
       else
         success =.true.
       endif
       call elpaAPI%destroy()
Andreas Marek's avatar
Andreas Marek committed
138

139
       call elpa_uninit()
Andreas Marek's avatar
Andreas Marek committed
140

141
142
143
144
145
       call timer%stop("elpa_invert_trm_&
       &MATH_DATATYPE&
       &_&
       &PRECISION &
       ")
Andreas Marek's avatar
Andreas Marek committed
146
147
148
149
150

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