Skip to content

Commit 240da39

Browse files
authored
Refactor: rename dngvd op (#6542)
* Rename dnevx to heevx * Update comments * Rename dngvd to hegvd * Rename dngvx to hegvx
1 parent b062b07 commit 240da39

File tree

8 files changed

+81
-62
lines changed

8 files changed

+81
-62
lines changed

source/source_hsolver/diago_dav_subspace.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ void Diago_DavSubspace<T, Device>::diag_zhegvx(const int& nbase,
542542
if (this->diag_comm.rank == 0)
543543
{
544544
base_device::memory::synchronize_memory_op<T, Device, Device>()(this->d_scc, scc, nbase * this->nbase_x);
545-
dngvd_op<T, Device>()(this->ctx, nbase, this->nbase_x, this->hcc, this->d_scc, this->d_eigenvalue, this->vcc);
545+
hegvd_op<T, Device>()(this->ctx, nbase, this->nbase_x, this->hcc, this->d_scc, this->d_eigenvalue, this->vcc);
546546
syncmem_var_d2h_op()((*eigenvalue_iter).data(), this->d_eigenvalue, this->nbase_x);
547547
}
548548
#endif
@@ -564,7 +564,7 @@ void Diago_DavSubspace<T, Device>::diag_zhegvx(const int& nbase,
564564
s_diag[i][j] = scc[i * this->nbase_x + j];
565565
}
566566
}
567-
dngvx_op<T, Device>()(this->ctx,
567+
hegvx_op<T, Device>()(this->ctx,
568568
nbase,
569569
this->nbase_x,
570570
this->hcc,

source/source_hsolver/diago_david.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,15 +622,15 @@ void DiagoDavid<T, Device>::diag_zhegvx(const int& nbase,
622622
resmem_var_op()(eigenvalue_gpu, nbase_x);
623623
syncmem_var_h2d_op()(eigenvalue_gpu, this->eigenvalue, nbase_x);
624624

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

627627
syncmem_var_d2h_op()(this->eigenvalue, eigenvalue_gpu, nbase_x);
628628
delmem_var_op()(eigenvalue_gpu);
629629
#endif
630630
}
631631
else
632632
{
633-
dnevx_op<T, Device>()(this->ctx, nbase, nbase_x, hcc, nband, this->eigenvalue, vcc);
633+
heevx_op<T, Device>()(this->ctx, nbase, nbase_x, hcc, nband, this->eigenvalue, vcc);
634634
}
635635
}
636636

source/source_hsolver/diago_iter_assist.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ void DiagoIterAssist<T, Device>::diagH_LAPACK(const int nstart,
372372
resmem_var_op()(eigenvalues, nstart);
373373
setmem_var_op()(eigenvalues, 0, nstart);
374374

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

377377
if (base_device::get_device_type<Device>(ctx) == base_device::GpuDevice)
378378
{

source/source_hsolver/kernels/cuda/dngvd_op.cu

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void xheevd_wrapper (
205205
}
206206

207207
template <typename T>
208-
struct dngvd_op<T, base_device::DEVICE_GPU>
208+
struct hegvd_op<T, base_device::DEVICE_GPU>
209209
{
210210
using Real = typename GetTypeReal<T>::type;
211211
void operator()(const base_device::DEVICE_GPU* d,
@@ -225,7 +225,7 @@ struct dngvd_op<T, base_device::DEVICE_GPU>
225225
};
226226

227227
template <typename T>
228-
struct dnevx_op<T, base_device::DEVICE_GPU>
228+
struct heevx_op<T, base_device::DEVICE_GPU>
229229
{
230230
using Real = typename GetTypeReal<T>::type;
231231
void operator()(const base_device::DEVICE_GPU* d,
@@ -244,7 +244,7 @@ struct dnevx_op<T, base_device::DEVICE_GPU>
244244
};
245245

246246
template <typename T>
247-
struct dngvx_op<T, base_device::DEVICE_GPU>
247+
struct hegvx_op<T, base_device::DEVICE_GPU>
248248
{
249249
using Real = typename GetTypeReal<T>::type;
250250
void operator()(const base_device::DEVICE_GPU* d,
@@ -260,18 +260,18 @@ struct dngvx_op<T, base_device::DEVICE_GPU>
260260
}
261261
};
262262

263-
template struct dngvd_op<std::complex<float>, base_device::DEVICE_GPU>;
264-
template struct dnevx_op<std::complex<float>, base_device::DEVICE_GPU>;
265-
template struct dngvx_op<std::complex<float>, base_device::DEVICE_GPU>;
263+
template struct hegvd_op<std::complex<float>, base_device::DEVICE_GPU>;
264+
template struct heevx_op<std::complex<float>, base_device::DEVICE_GPU>;
265+
template struct hegvx_op<std::complex<float>, base_device::DEVICE_GPU>;
266266

267-
template struct dngvd_op<std::complex<double>, base_device::DEVICE_GPU>;
268-
template struct dnevx_op<std::complex<double>, base_device::DEVICE_GPU>;
269-
template struct dngvx_op<std::complex<double>, base_device::DEVICE_GPU>;
267+
template struct hegvd_op<std::complex<double>, base_device::DEVICE_GPU>;
268+
template struct heevx_op<std::complex<double>, base_device::DEVICE_GPU>;
269+
template struct hegvx_op<std::complex<double>, base_device::DEVICE_GPU>;
270270

271271
#ifdef __LCAO
272-
template struct dngvd_op<double, base_device::DEVICE_GPU>;
273-
template struct dnevx_op<double, base_device::DEVICE_GPU>;
274-
template struct dngvx_op<double, base_device::DEVICE_GPU>;
272+
template struct hegvd_op<double, base_device::DEVICE_GPU>;
273+
template struct heevx_op<double, base_device::DEVICE_GPU>;
274+
template struct hegvx_op<double, base_device::DEVICE_GPU>;
275275
#endif
276276

277277
} // namespace hsolver

source/source_hsolver/kernels/dngvd_op.cpp

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
namespace hsolver
88
{
9-
9+
// hegvd and sygvd; dn for dense?
1010
template <typename T>
11-
struct dngvd_op<T, base_device::DEVICE_CPU>
11+
struct hegvd_op<T, base_device::DEVICE_CPU>
1212
{
1313
using Real = typename GetTypeReal<T>::type;
1414
void operator()(const base_device::DEVICE_CPU* d,
@@ -83,7 +83,7 @@ struct dngvd_op<T, base_device::DEVICE_CPU>
8383
};
8484

8585
template <typename T>
86-
struct dngv_op<T, base_device::DEVICE_CPU>
86+
struct hegv_op<T, base_device::DEVICE_CPU>
8787
{
8888
using Real = typename GetTypeReal<T>::type;
8989
void operator()(const base_device::DEVICE_CPU* d,
@@ -139,8 +139,16 @@ struct dngv_op<T, base_device::DEVICE_CPU>
139139
}
140140
};
141141

142+
// heevx and syevx
143+
/**
144+
* @brief heevx computes the first m eigenvalues and their corresponding eigenvectors of
145+
* a complex generalized Hermitian-definite eigenproblem.
146+
*
147+
* both heevx and syevx are implemented through the `evx` interface of LAPACK.
148+
* wrapped in LapackWrapper::xheevx
149+
*/
142150
template <typename T>
143-
struct dnevx_op<T, base_device::DEVICE_CPU>
151+
struct heevx_op<T, base_device::DEVICE_CPU>
144152
{
145153
using Real = typename GetTypeReal<T>::type;
146154
void operator()(const base_device::DEVICE_CPU* /*ctx*/,
@@ -235,7 +243,7 @@ struct dnevx_op<T, base_device::DEVICE_CPU>
235243
};
236244

237245
template <typename T>
238-
struct dngvx_op<T, base_device::DEVICE_CPU>
246+
struct hegvx_op<T, base_device::DEVICE_CPU>
239247
{
240248
using Real = typename GetTypeReal<T>::type;
241249
void operator()(const base_device::DEVICE_CPU* d,
@@ -321,21 +329,21 @@ struct dngvx_op<T, base_device::DEVICE_CPU>
321329
}
322330
};
323331

324-
template struct dngvd_op<std::complex<float>, base_device::DEVICE_CPU>;
325-
template struct dngvd_op<std::complex<double>, base_device::DEVICE_CPU>;
332+
template struct hegvd_op<std::complex<float>, base_device::DEVICE_CPU>;
333+
template struct hegvd_op<std::complex<double>, base_device::DEVICE_CPU>;
326334

327-
template struct dnevx_op<std::complex<float>, base_device::DEVICE_CPU>;
328-
template struct dnevx_op<std::complex<double>, base_device::DEVICE_CPU>;
335+
template struct heevx_op<std::complex<float>, base_device::DEVICE_CPU>;
336+
template struct heevx_op<std::complex<double>, base_device::DEVICE_CPU>;
329337

330-
template struct dngvx_op<std::complex<float>, base_device::DEVICE_CPU>;
331-
template struct dngvx_op<std::complex<double>, base_device::DEVICE_CPU>;
338+
template struct hegvx_op<std::complex<float>, base_device::DEVICE_CPU>;
339+
template struct hegvx_op<std::complex<double>, base_device::DEVICE_CPU>;
332340

333-
template struct dngv_op<std::complex<float>, base_device::DEVICE_CPU>;
334-
template struct dngv_op<std::complex<double>, base_device::DEVICE_CPU>;
341+
template struct hegv_op<std::complex<float>, base_device::DEVICE_CPU>;
342+
template struct hegv_op<std::complex<double>, base_device::DEVICE_CPU>;
335343
#ifdef __LCAO
336-
template struct dngvd_op<double, base_device::DEVICE_CPU>;
337-
template struct dnevx_op<double, base_device::DEVICE_CPU>;
338-
template struct dngvx_op<double, base_device::DEVICE_CPU>;
339-
template struct dngv_op<double, base_device::DEVICE_CPU>;
344+
template struct hegvd_op<double, base_device::DEVICE_CPU>;
345+
template struct heevx_op<double, base_device::DEVICE_CPU>;
346+
template struct hegvx_op<double, base_device::DEVICE_CPU>;
347+
template struct hegv_op<double, base_device::DEVICE_CPU>;
340348
#endif
341349
} // namespace hsolver

source/source_hsolver/kernels/dngvd_op.h

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
// TODO: This is a temperary location for these functions.
22
// And will be moved to a global module(module base) later.
3+
4+
// DeNse Generalized eigenValue eXtended
5+
// he stands for Hermitian
6+
// sy stands for Symmetric
7+
// gv stands for Generalized eigenValue problem
8+
// ev stands for EigenValues
9+
// dn stands for dense, maybe, who knows?
10+
// x stands for compute a subset of the eigenvalues and, optionally,
11+
// their corresponding eigenvectors
12+
// d for all, x for selected
13+
314
#ifndef MODULE_HSOLVER_DNGVD_H
415
#define MODULE_HSOLVER_DNGVD_H
516

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

2233

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

4960
template <typename T, typename Device>
50-
struct dngv_op
61+
struct hegv_op
5162
{
5263
using Real = typename GetTypeReal<T>::type;
53-
/// @brief DNGVX computes first m eigenvalues and eigenvectors of a complex generalized
64+
/// @brief HEGV computes first m eigenvalues and eigenvectors of a complex generalized
5465
/// Input Parameters
5566
/// @param d : the type of device
5667
/// @param nbase : the number of dim of the matrix
@@ -64,10 +75,10 @@ struct dngv_op
6475
};
6576

6677
template <typename T, typename Device>
67-
struct dngvx_op
78+
struct hegvx_op
6879
{
6980
using Real = typename GetTypeReal<T>::type;
70-
/// @brief DNGVX computes first m eigenvalues and eigenvectors of a complex generalized
81+
/// @brief HEGVX computes first m eigenvalues and eigenvectors of a complex generalized
7182
/// Input Parameters
7283
/// @param d : the type of device
7384
/// @param nbase : the number of dim of the matrix
@@ -82,10 +93,10 @@ struct dngvx_op
8293
};
8394

8495
template <typename T, typename Device>
85-
struct dnevx_op
96+
struct heevx_op
8697
{
8798
using Real = typename GetTypeReal<T>::type;
88-
/// @brief DNEVX computes the first m eigenvalues and their corresponding eigenvectors of
99+
/// @brief heevx computes the first m eigenvalues and their corresponding eigenvectors of
89100
/// a complex generalized Hermitian-definite eigenproblem
90101
///
91102
/// In this op, the CPU version is implemented through the `evx` interface, and the CUDA version

0 commit comments

Comments
 (0)