Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/source_hsolver/diago_dav_subspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ void Diago_DavSubspace<T, Device>::diag_zhegvx(const int& nbase,
if (this->diag_comm.rank == 0)
{
base_device::memory::synchronize_memory_op<T, Device, Device>()(this->d_scc, scc, nbase * this->nbase_x);
dngvd_op<T, Device>()(this->ctx, nbase, this->nbase_x, this->hcc, this->d_scc, this->d_eigenvalue, this->vcc);
hegvd_op<T, Device>()(this->ctx, nbase, this->nbase_x, this->hcc, this->d_scc, this->d_eigenvalue, this->vcc);
syncmem_var_d2h_op()((*eigenvalue_iter).data(), this->d_eigenvalue, this->nbase_x);
}
#endif
Expand All @@ -564,7 +564,7 @@ void Diago_DavSubspace<T, Device>::diag_zhegvx(const int& nbase,
s_diag[i][j] = scc[i * this->nbase_x + j];
}
}
dngvx_op<T, Device>()(this->ctx,
hegvx_op<T, Device>()(this->ctx,
nbase,
this->nbase_x,
this->hcc,
Expand Down
4 changes: 2 additions & 2 deletions source/source_hsolver/diago_david.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -622,15 +622,15 @@ void DiagoDavid<T, Device>::diag_zhegvx(const int& nbase,
resmem_var_op()(eigenvalue_gpu, nbase_x);
syncmem_var_h2d_op()(eigenvalue_gpu, this->eigenvalue, nbase_x);

dnevx_op<T, Device>()(this->ctx, nbase, nbase_x, hcc, nband, eigenvalue_gpu, vcc);
heevx_op<T, Device>()(this->ctx, nbase, nbase_x, hcc, nband, eigenvalue_gpu, vcc);

syncmem_var_d2h_op()(this->eigenvalue, eigenvalue_gpu, nbase_x);
delmem_var_op()(eigenvalue_gpu);
#endif
}
else
{
dnevx_op<T, Device>()(this->ctx, nbase, nbase_x, hcc, nband, this->eigenvalue, vcc);
heevx_op<T, Device>()(this->ctx, nbase, nbase_x, hcc, nband, this->eigenvalue, vcc);
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/source_hsolver/diago_iter_assist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ void DiagoIterAssist<T, Device>::diagH_LAPACK(const int nstart,
resmem_var_op()(eigenvalues, nstart);
setmem_var_op()(eigenvalues, 0, nstart);

dngvd_op<T, Device>()(ctx, nstart, ldh, hcc, scc, eigenvalues, vcc);
hegvd_op<T, Device>()(ctx, nstart, ldh, hcc, scc, eigenvalues, vcc);

if (base_device::get_device_type<Device>(ctx) == base_device::GpuDevice)
{
Expand Down
24 changes: 12 additions & 12 deletions source/source_hsolver/kernels/cuda/dngvd_op.cu
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void xheevd_wrapper (
}

template <typename T>
struct dngvd_op<T, base_device::DEVICE_GPU>
struct hegvd_op<T, base_device::DEVICE_GPU>
{
using Real = typename GetTypeReal<T>::type;
void operator()(const base_device::DEVICE_GPU* d,
Expand All @@ -225,7 +225,7 @@ struct dngvd_op<T, base_device::DEVICE_GPU>
};

template <typename T>
struct dnevx_op<T, base_device::DEVICE_GPU>
struct heevx_op<T, base_device::DEVICE_GPU>
{
using Real = typename GetTypeReal<T>::type;
void operator()(const base_device::DEVICE_GPU* d,
Expand All @@ -244,7 +244,7 @@ struct dnevx_op<T, base_device::DEVICE_GPU>
};

template <typename T>
struct dngvx_op<T, base_device::DEVICE_GPU>
struct hegvx_op<T, base_device::DEVICE_GPU>
{
using Real = typename GetTypeReal<T>::type;
void operator()(const base_device::DEVICE_GPU* d,
Expand All @@ -260,18 +260,18 @@ struct dngvx_op<T, base_device::DEVICE_GPU>
}
};

template struct dngvd_op<std::complex<float>, base_device::DEVICE_GPU>;
template struct dnevx_op<std::complex<float>, base_device::DEVICE_GPU>;
template struct dngvx_op<std::complex<float>, base_device::DEVICE_GPU>;
template struct hegvd_op<std::complex<float>, base_device::DEVICE_GPU>;
template struct heevx_op<std::complex<float>, base_device::DEVICE_GPU>;
template struct hegvx_op<std::complex<float>, base_device::DEVICE_GPU>;

template struct dngvd_op<std::complex<double>, base_device::DEVICE_GPU>;
template struct dnevx_op<std::complex<double>, base_device::DEVICE_GPU>;
template struct dngvx_op<std::complex<double>, base_device::DEVICE_GPU>;
template struct hegvd_op<std::complex<double>, base_device::DEVICE_GPU>;
template struct heevx_op<std::complex<double>, base_device::DEVICE_GPU>;
template struct hegvx_op<std::complex<double>, base_device::DEVICE_GPU>;

#ifdef __LCAO
template struct dngvd_op<double, base_device::DEVICE_GPU>;
template struct dnevx_op<double, base_device::DEVICE_GPU>;
template struct dngvx_op<double, base_device::DEVICE_GPU>;
template struct hegvd_op<double, base_device::DEVICE_GPU>;
template struct heevx_op<double, base_device::DEVICE_GPU>;
template struct hegvx_op<double, base_device::DEVICE_GPU>;
#endif

} // namespace hsolver
42 changes: 25 additions & 17 deletions source/source_hsolver/kernels/dngvd_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

namespace hsolver
{

// hegvd and sygvd; dn for dense?
template <typename T>
struct dngvd_op<T, base_device::DEVICE_CPU>
struct hegvd_op<T, base_device::DEVICE_CPU>
{
using Real = typename GetTypeReal<T>::type;
void operator()(const base_device::DEVICE_CPU* d,
Expand Down Expand Up @@ -83,7 +83,7 @@ struct dngvd_op<T, base_device::DEVICE_CPU>
};

template <typename T>
struct dngv_op<T, base_device::DEVICE_CPU>
struct hegv_op<T, base_device::DEVICE_CPU>
{
using Real = typename GetTypeReal<T>::type;
void operator()(const base_device::DEVICE_CPU* d,
Expand Down Expand Up @@ -139,8 +139,16 @@ struct dngv_op<T, base_device::DEVICE_CPU>
}
};

// heevx and syevx
/**
* @brief heevx computes the first m eigenvalues and their corresponding eigenvectors of
* a complex generalized Hermitian-definite eigenproblem.
*
* both heevx and syevx are implemented through the `evx` interface of LAPACK.
* wrapped in LapackWrapper::xheevx
*/
template <typename T>
struct dnevx_op<T, base_device::DEVICE_CPU>
struct heevx_op<T, base_device::DEVICE_CPU>
{
using Real = typename GetTypeReal<T>::type;
void operator()(const base_device::DEVICE_CPU* /*ctx*/,
Expand Down Expand Up @@ -235,7 +243,7 @@ struct dnevx_op<T, base_device::DEVICE_CPU>
};

template <typename T>
struct dngvx_op<T, base_device::DEVICE_CPU>
struct hegvx_op<T, base_device::DEVICE_CPU>
{
using Real = typename GetTypeReal<T>::type;
void operator()(const base_device::DEVICE_CPU* d,
Expand Down Expand Up @@ -321,21 +329,21 @@ struct dngvx_op<T, base_device::DEVICE_CPU>
}
};

template struct dngvd_op<std::complex<float>, base_device::DEVICE_CPU>;
template struct dngvd_op<std::complex<double>, base_device::DEVICE_CPU>;
template struct hegvd_op<std::complex<float>, base_device::DEVICE_CPU>;
template struct hegvd_op<std::complex<double>, base_device::DEVICE_CPU>;

template struct dnevx_op<std::complex<float>, base_device::DEVICE_CPU>;
template struct dnevx_op<std::complex<double>, base_device::DEVICE_CPU>;
template struct heevx_op<std::complex<float>, base_device::DEVICE_CPU>;
template struct heevx_op<std::complex<double>, base_device::DEVICE_CPU>;

template struct dngvx_op<std::complex<float>, base_device::DEVICE_CPU>;
template struct dngvx_op<std::complex<double>, base_device::DEVICE_CPU>;
template struct hegvx_op<std::complex<float>, base_device::DEVICE_CPU>;
template struct hegvx_op<std::complex<double>, base_device::DEVICE_CPU>;

template struct dngv_op<std::complex<float>, base_device::DEVICE_CPU>;
template struct dngv_op<std::complex<double>, base_device::DEVICE_CPU>;
template struct hegv_op<std::complex<float>, base_device::DEVICE_CPU>;
template struct hegv_op<std::complex<double>, base_device::DEVICE_CPU>;
#ifdef __LCAO
template struct dngvd_op<double, base_device::DEVICE_CPU>;
template struct dnevx_op<double, base_device::DEVICE_CPU>;
template struct dngvx_op<double, base_device::DEVICE_CPU>;
template struct dngv_op<double, base_device::DEVICE_CPU>;
template struct hegvd_op<double, base_device::DEVICE_CPU>;
template struct heevx_op<double, base_device::DEVICE_CPU>;
template struct hegvx_op<double, base_device::DEVICE_CPU>;
template struct hegv_op<double, base_device::DEVICE_CPU>;
#endif
} // namespace hsolver
27 changes: 19 additions & 8 deletions source/source_hsolver/kernels/dngvd_op.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
// TODO: This is a temperary location for these functions.
// And will be moved to a global module(module base) later.

// DeNse Generalized eigenValue eXtended
// he stands for Hermitian
// sy stands for Symmetric
// gv stands for Generalized eigenValue problem
// ev stands for EigenValues
// dn stands for dense, maybe, who knows?
// x stands for compute a subset of the eigenvalues and, optionally,
// their corresponding eigenvectors
// d for all, x for selected

#ifndef MODULE_HSOLVER_DNGVD_H
#define MODULE_HSOLVER_DNGVD_H

Expand All @@ -21,10 +32,10 @@ inline float get_real(const float &x) { return x; }


template <typename T, typename Device>
struct dngvd_op
struct hegvd_op
{
using Real = typename GetTypeReal<T>::type;
/// @brief DNGVD computes all the eigenvalues and eigenvectors of a complex generalized
/// @brief HEGVD computes all the eigenvalues and eigenvectors of a complex generalized
/// Hermitian-definite eigenproblem. If eigenvectors are desired, it uses a divide and conquer algorithm.
///
/// In this op, the CPU version is implemented through the `gvd` interface, and the CUDA version
Expand All @@ -47,10 +58,10 @@ struct dngvd_op
};

template <typename T, typename Device>
struct dngv_op
struct hegv_op
{
using Real = typename GetTypeReal<T>::type;
/// @brief DNGVX computes first m eigenvalues and eigenvectors of a complex generalized
/// @brief HEGV computes first m eigenvalues and eigenvectors of a complex generalized
/// Input Parameters
/// @param d : the type of device
/// @param nbase : the number of dim of the matrix
Expand All @@ -64,10 +75,10 @@ struct dngv_op
};

template <typename T, typename Device>
struct dngvx_op
struct hegvx_op
{
using Real = typename GetTypeReal<T>::type;
/// @brief DNGVX computes first m eigenvalues and eigenvectors of a complex generalized
/// @brief HEGVX computes first m eigenvalues and eigenvectors of a complex generalized
/// Input Parameters
/// @param d : the type of device
/// @param nbase : the number of dim of the matrix
Expand All @@ -82,10 +93,10 @@ struct dngvx_op
};

template <typename T, typename Device>
struct dnevx_op
struct heevx_op
{
using Real = typename GetTypeReal<T>::type;
/// @brief DNEVX computes the first m eigenvalues and their corresponding eigenvectors of
/// @brief heevx computes the first m eigenvalues and their corresponding eigenvectors of
/// a complex generalized Hermitian-definite eigenproblem
///
/// In this op, the CPU version is implemented through the `evx` interface, and the CUDA version
Expand Down
Loading
Loading