elpa_cholesky_template_legacy.X90 4.8 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
!    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.

45
#include "../../general/sanity.X90"
46 47 48
     use elpa_type
!     use elpa1_compute
!     use elpa_utilities
Andreas Marek's avatar
Andreas Marek committed
49 50 51 52 53 54 55 56 57 58 59
     use elpa_mpi
#ifdef HAVE_DETAILED_TIMINGS
     use timings
#else
     use timings_dummy
#endif
     use precision
     implicit none

      integer(kind=ik)              :: na, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols
#if REALCASE == 1
60 61 62
#ifdef USE_ASSUMED_SIZE
      real(kind=REAL_DATATYPE)      :: a(lda,*)
#else
Andreas Marek's avatar
Andreas Marek committed
63
      real(kind=REAL_DATATYPE)      :: a(lda,matrixCols)
64
#endif
Andreas Marek's avatar
Andreas Marek committed
65 66
#endif
#if COMPLEXCASE == 1
67 68 69
#ifdef USE_ASSUMED_SIZE
      complex(kind=COMPLEX_DATATYPE)   :: a(lda,*)
#else
Andreas Marek's avatar
Andreas Marek committed
70
      complex(kind=COMPLEX_DATATYPE)   :: a(lda,matrixCols)
71
#endif
72 73
#endif
!      integer(kind=ik)              :: my_prow, my_pcol, np_rows, np_cols, mpierr
74
       integer(kind=ik)              :: nev
75 76 77 78 79 80 81 82 83 84 85
!      integer(kind=ik)              :: l_cols, l_rows, l_col1, l_row1, l_colx, l_rowx
!      integer(kind=ik)              :: n, nc, i, info
!      integer(kind=ik)              :: lcs, lce, lrs, lre
!      integer(kind=ik)              :: tile_size, l_rows_tile, l_cols_tile

!#if REALCASE == 1
!      real(kind=REAL_DATATYPE), allocatable    :: tmp1(:), tmp2(:,:), tmatr(:,:), tmatc(:,:)
!#endif
!#if COMPLEXCASE == 1
!      complex(kind=COMPLEX_DATATYPE), allocatable    :: tmp1(:), tmp2(:,:), tmatr(:,:), tmatc(:,:)
!#endif
Andreas Marek's avatar
Andreas Marek committed
86 87
      logical, intent(in)           :: wantDebug
      logical                       :: success
88 89 90 91
      integer(kind=ik)                            :: successInternal
!      integer(kind=ik)              :: istat
!      character(200)                :: errorMessage

92
      type(elpa_t)                 :: e
Andreas Marek's avatar
Andreas Marek committed
93 94 95 96

      call timer%start("elpa_cholesky_&
      &MATH_DATATYPE&
      &_&
97 98
      &PRECISION&
      &_legacy_interface")
Andreas Marek's avatar
Andreas Marek committed
99 100 101

      success = .true.

102
      if (elpa_init(20170403) /= ELPA_OK) then
Pavel Kus's avatar
Pavel Kus committed
103
        print *, "ELPA API version not supported"
104
        success = .false.
Pavel Kus's avatar
Pavel Kus committed
105 106
        stop
        return
Andreas Marek's avatar
Andreas Marek committed
107 108
      endif

109 110 111 112 113 114 115 116 117 118 119 120
      e = elpa_allocate()

      call e%set("na", na)
      call e%set("local_nrows", lda)
      call e%set("local_ncols", matrixCols)
      call e%set("nblk", nblk)

      call e%set("mpi_comm_rows", mpi_comm_rows)
      call e%set("mpi_comm_cols", mpi_comm_cols)

      call e%setup(successInternal)

121 122 123 124 125
      if (successInternal .ne. ELPA_OK) then
        print *, "Cannot create elpa object"
        success = .false.
        stop
        return
Andreas Marek's avatar
Andreas Marek committed
126 127 128
      endif


129
      call e%cholesky(a(1:lda,1:matrixCols), successInternal)
Andreas Marek's avatar
Andreas Marek committed
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.
Andreas Marek's avatar
Andreas Marek committed
138
      endif
139
      call e%destroy()
Andreas Marek's avatar
Andreas Marek committed
140

141
      call elpa_uninit()
Andreas Marek's avatar
Andreas Marek committed
142 143 144 145 146

      call timer%stop("elpa_cholesky_&
      &MATH_DATATYPE&
      &_&
      &PRECISION&
147
      &_legacy_interface")
Andreas Marek's avatar
Andreas Marek committed
148 149 150 151 152

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