SIRIUS 7.5.0
Electronic structure library and applications
eigensolver.cpp
Go to the documentation of this file.
1// Copyright (c) 2013-2019 Anton Kozhevnikov, Thomas Schulthess
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without modification, are permitted provided that
5// the following conditions are met:
6//
7// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
8// following disclaimer.
9// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
10// and the following disclaimer in the documentation and/or other materials provided with the distribution.
11//
12// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
13// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
14// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
15// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
16// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
17// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
18// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19
20/** \file eigensolver.cpp
21 *
22 * \brief Contains implementation of eigensolver factory.
23 */
24
25#include "eigensolver.hpp"
26#include "eigenproblem.hpp"
27
28namespace sirius {
29
30namespace la {
31
32std::unique_ptr<Eigensolver>
33Eigensolver_factory(std::string name__)
34{
35 std::transform(name__.begin(), name__.end(), name__.begin(), ::tolower);
36
37 Eigensolver* ptr = nullptr;
38 switch (get_ev_solver_t(name__)) {
40 ptr = new Eigensolver_lapack();
41 break;
42 }
43#if defined(SIRIUS_SCALAPACK)
45 ptr = new Eigensolver_scalapack();
46 break;
47 }
48#endif
49#if defined(SIRIUS_DLAF)
50 case ev_solver_t::dlaf: {
51 ptr = new Eigensolver_dlaf();
52 break;
53 }
54#endif
55#if defined(SIRIUS_ELPA)
56 case ev_solver_t::elpa: {
57 if (name__ == "elpa1") {
58 ptr = new Eigensolver_elpa(1);
59 } else {
60 ptr = new Eigensolver_elpa(2);
61 }
62 break;
63 }
64#endif
65#if defined(SIRIUS_MAGMA)
66 case ev_solver_t::magma: {
67 ptr = new Eigensolver_magma();
68 break;
69 }
71 ptr = new Eigensolver_magma_gpu();
72 break;
73 }
74#endif
75#if defined(SIRIUS_CUDA)
77 ptr = new Eigensolver_cuda();
78 break;
79 }
80#endif
81 default: {
82 RTE_THROW("not compiled with the selected eigen-solver");
83 }
84 }
85 return std::unique_ptr<Eigensolver>(ptr);
86}
87
88}
89
90}
91
Contains definition and implementation of various eigenvalue solver interfaces.
Contains definition of eigensolver factory.
ev_solver_t get_ev_solver_t(std::string name__)
Get type of an eigen solver by name (provided as a string).
Definition: eigensolver.hpp:61
@ dlaf
DLA-Future solver.
@ magma_gpu
MAGMA with GPU pointers.
@ cusolver
CUDA eigen-solver.
@ magma
MAGMA with CPU pointers.
std::enable_if_t< std::is_same< T, real_type< F > >::value, void > transform(::spla::Context &spla_ctx__, sddk::memory_t mem__, la::dmatrix< F > const &M__, int irow0__, int jcol0__, real_type< F > alpha__, Wave_functions< T > const &wf_in__, spin_index s_in__, band_range br_in__, real_type< F > beta__, Wave_functions< T > &wf_out__, spin_index s_out__, band_range br_out__)
Apply linear transformation to the wave-functions.
Namespace of the SIRIUS library.
Definition: sirius.f90:5