Skip to content

Commit 8ebf66b

Browse files
committed
Remove ctx in matrixSetToAnother
1 parent 8ea85f9 commit 8ebf66b

File tree

6 files changed

+13
-22
lines changed

6 files changed

+13
-22
lines changed

source/module_base/kernels/cuda/math_kernel_op.cu

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -980,8 +980,7 @@ void matrixTranspose_op<std::complex<double>, base_device::DEVICE_GPU>::operator
980980
}
981981

982982
template <>
983-
void matrixSetToAnother<double, base_device::DEVICE_GPU>::operator()(const base_device::DEVICE_GPU* d,
984-
const int& n,
983+
void matrixSetToAnother<double, base_device::DEVICE_GPU>::operator()(const int& n,
985984
const double* A,
986985
const int& LDA,
987986
double* B,
@@ -993,8 +992,7 @@ void matrixSetToAnother<double, base_device::DEVICE_GPU>::operator()(const base_
993992
cudaCheckOnDebug();
994993
}
995994
template <>
996-
void matrixSetToAnother<std::complex<float>, base_device::DEVICE_GPU>::operator()(const base_device::DEVICE_GPU* d,
997-
const int& n,
995+
void matrixSetToAnother<std::complex<float>, base_device::DEVICE_GPU>::operator()(const int& n,
998996
const std::complex<float>* A,
999997
const int& LDA,
1000998
std::complex<float>* B,
@@ -1006,8 +1004,7 @@ void matrixSetToAnother<std::complex<float>, base_device::DEVICE_GPU>::operator(
10061004
cudaCheckOnDebug();
10071005
}
10081006
template <>
1009-
void matrixSetToAnother<std::complex<double>, base_device::DEVICE_GPU>::operator()(const base_device::DEVICE_GPU* d,
1010-
const int& n,
1007+
void matrixSetToAnother<std::complex<double>, base_device::DEVICE_GPU>::operator()(const int& n,
10111008
const std::complex<double>* A,
10121009
const int& LDA,
10131010
std::complex<double>* B,

source/module_base/kernels/math_kernel_op.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ struct matrixTranspose_op<T, base_device::DEVICE_CPU>
339339
template <typename T>
340340
struct matrixSetToAnother<T, base_device::DEVICE_CPU>
341341
{
342-
void operator()(const base_device::DEVICE_CPU* d, const int& n, const T* A, const int& LDA, T* B, const int& LDB)
342+
void operator()(const int& n, const T* A, const int& LDA, T* B, const int& LDB)
343343
{
344344
#ifdef _OPENMP
345345
#pragma omp parallel for collapse(2) schedule(static, 8192 / sizeof(T))

source/module_base/kernels/math_kernel_op.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,15 +302,14 @@ template <typename T, typename Device> struct matrixSetToAnother {
302302
/// @brief initialize matrix B with A
303303
///
304304
/// Input Parameters
305-
/// \param d : the type of computing device
306305
/// \param n : first dimension of matrix
307306
/// \param A : input matrix A
308307
/// \param LDA : leading dimension of A
309308
/// \param LDB : leading dimension of B
310309
///
311310
/// Output Parameters
312311
/// \param B : output matrix B
313-
void operator()(const Device *d, const int &n, const T *A, const int &LDA,
312+
void operator()(const int &n, const T *A, const int &LDA,
314313
T *B, const int &LDB);
315314
};
316315

@@ -372,7 +371,7 @@ struct constantvector_addORsub_constantVector_op<T, base_device::DEVICE_GPU> {
372371
};
373372

374373
template <typename T> struct matrixSetToAnother<T, base_device::DEVICE_GPU> {
375-
void operator()(const base_device::DEVICE_GPU *d, const int &n,
374+
void operator()(const int &n,
376375
const T *A, // input
377376
const int &LDA,
378377
T *B, // output

source/module_base/kernels/rocm/math_kernel_op.hip.cu

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -889,8 +889,7 @@ void matrixTranspose_op<std::complex<double>, base_device::DEVICE_GPU>::operator
889889
}
890890

891891
template <>
892-
void matrixSetToAnother<double, base_device::DEVICE_GPU>::operator()(const base_device::DEVICE_GPU* d,
893-
const int& n,
892+
void matrixSetToAnother<double, base_device::DEVICE_GPU>::operator()(const int& n,
894893
const double* A,
895894
const int& LDA,
896895
double* B,
@@ -902,8 +901,7 @@ void matrixSetToAnother<double, base_device::DEVICE_GPU>::operator()(const base_
902901
hipCheckOnDebug();
903902
}
904903
template <>
905-
void matrixSetToAnother<std::complex<float>, base_device::DEVICE_GPU>::operator()(const base_device::DEVICE_GPU* d,
906-
const int& n,
904+
void matrixSetToAnother<std::complex<float>, base_device::DEVICE_GPU>::operator()(const int& n,
907905
const std::complex<float>* A,
908906
const int& LDA,
909907
std::complex<float>* B,
@@ -915,8 +913,7 @@ void matrixSetToAnother<std::complex<float>, base_device::DEVICE_GPU>::operator(
915913
hipCheckOnDebug();
916914
}
917915
template <>
918-
void matrixSetToAnother<std::complex<double>, base_device::DEVICE_GPU>::operator()(const base_device::DEVICE_GPU* d,
919-
const int& n,
916+
void matrixSetToAnother<std::complex<double>, base_device::DEVICE_GPU>::operator()(const int& n,
920917
const std::complex<double>* A,
921918
const int& LDA,
922919
std::complex<double>* B,

source/module_base/kernels/test/math_kernel_test.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,7 @@ TEST_F(TestModuleHsolverMathKernel, matrixSetToAnother_op_gpu)
665665
B.size());
666666

667667
// run
668-
ModuleBase::matrixSetToAnother<std::complex<double>, base_device::DEVICE_GPU>()(gpu_ctx,
669-
n,
668+
ModuleBase::matrixSetToAnother<std::complex<double>, base_device::DEVICE_GPU>()(n,
670669
device_A,
671670
LDA,
672671
device_B,
@@ -680,8 +679,7 @@ TEST_F(TestModuleHsolverMathKernel, matrixSetToAnother_op_gpu)
680679
B_gpu2cpu.size());
681680

682681
std::vector<std::complex<double>> B_cpu(8);
683-
ModuleBase::matrixSetToAnother<std::complex<double>, base_device::DEVICE_CPU>()(cpu_ctx,
684-
n,
682+
ModuleBase::matrixSetToAnother<std::complex<double>, base_device::DEVICE_CPU>()(n,
685683
A.data(),
686684
LDA,
687685
B_cpu.data(),

source/module_hsolver/diago_iter_assist.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void DiagoIterAssist<T, Device>::diagH_subspace(const hamilt::Hamilt<T, Device>*
136136

137137
if (!in_place)
138138
{
139-
ModuleBase::matrixSetToAnother<T, Device>()(ctx, n_band, temp, ld_temp, evc.get_pointer(), dmax);
139+
ModuleBase::matrixSetToAnother<T, Device>()(n_band, temp, ld_temp, evc.get_pointer(), dmax);
140140
delmem_complex_op()(temp);
141141
}
142142
delmem_complex_op()(hcc);
@@ -561,7 +561,7 @@ void DiagoIterAssist<T, Device>::diag_subspace_psi(const T* hcc,
561561
&zero,
562562
temp,
563563
dmin);
564-
ModuleBase::matrixSetToAnother<T, Device>()(ctx, n_band, temp, dmin, evc.get_pointer(), dmax);
564+
ModuleBase::matrixSetToAnother<T, Device>()(n_band, temp, dmin, evc.get_pointer(), dmax);
565565
delmem_complex_op()(temp);
566566
}
567567

0 commit comments

Comments
 (0)